https://kotlinlang.org logo
#coroutines
Title
# coroutines
e

enleur

09/14/2018, 5:17 AM
replaced my cached thread pool dispatcher with
<http://Dispatchers.IO|Dispatchers.IO>
, now it cuts unused threads instant, but consumes more cpu
e

elizarov

09/14/2018, 5:43 AM
Can you add more details on your workload and observations please
e

enleur

09/14/2018, 11:17 AM
~100 requests per minute, every request wrapped by interceptor to run with Dispatchers.IO context (just for migration period). ktor 0.9.4, netty engine. inside jdbc, okhttp i’ll try to reproduce it in the sandbox, but not sure if it’s an issue
w

withoutclass

09/14/2018, 12:56 PM
100/minute is pretty slow. I was doing some load testing with Vegeta and
<http://Dispatchers.IO|Dispatchers.IO>
. At about 2500 requests/second I only lost somewhere around 11% of requests. The packet loss was only because I hit the thread limit (about 90 on my machine).
e

enleur

09/14/2018, 1:15 PM
it was not load testing, it’s regular production load for our inner service. just noticed changes on metrics after deploy
v

Vsevolod Tolstopyatov [JB]

09/14/2018, 2:09 PM
@enleur thanks for the report. Could you please clarify: 1) Is this problem critical for you? 2) Could it be the case when load is increased because system has more load after 11::30? As a workaround, you can increase
kotlinx.coroutines.scheduler.keep.alive.sec
system property and see if that helps
increasing
kotlinx.coroutines.scheduler.resolution.ns
may help as well, but is less recommended
e

enleur

09/14/2018, 4:22 PM
Thanks for help
1) Is this problem critical for you?
No, It is not an issue. It was critical when it hanged and consumed all 4 cores 🙂 but that was fixed in 0.26
2) Could it be the case when load is increased because system has more load after 11::30?
Load was stable and I think you’re right, it uses more cpu because of thread utilisation
3 Views