Need Help - Android App - Coroutines *background*:...
# coroutines
Need Help - Android App - Coroutines background: Create secure socket server to allow maximum possible socket client to connect. as to build connection with socket client, socket server need continues loop to accept connection. along way to communicate with each client need to open stream input and output to listen and send messages, this also need continues loop to read messages. Technically: I have tried using Thread but at this level handle thread and expect performance is hard, so come to the solution to use Coroutine. I have also tried Ktor for coroutine socket but don't find proper way(or I don't understand) how we want to build SSL Not a Coroutine master just learn and implemented. Problem: observed its uses higher CPU after some sort of time and UI start freezing, sometimes it hanging the phone. Also, continuously getting below kind of warning logs:
Copy code
zygote: Explicit concurrent copying GC freed 35008(4MB) AllocSpace objects, 5(164KB) LOS objects, 89% free, 2MB/20MB, paused 211us total 67.413ms

zygote: Increasing code cache capacity to 512KB

Choreographer: Skipped 48 frames!  The application may be doing too much work on its main thread.

zygote: Do partial code cache collection, code=53KB, data=54KB
zygote: After code cache collection, code=53KB, data=54KB
zygote: Increasing code cache capacity to 256KB
(after some optimization it lowered but still having the issue) I need help to select the right approach understand the issue insightful in way to resolve and use correctly.
IMO the way to achieve maximum possible performance with many sockets (or any I/O channel) is to create a thread pool (e.g. 1 thread per CPU core), use selectable channels (e.g.
), and a
to monitor multiple sockets on the threads.
Thank you @Niklas Gürtler let me try that way!