FYI: we are starting to experiment with rolling ou...
# coroutines
d
FYI: we are starting to experiment with rolling out Kotlin coroutines for a project. We turned on kotlinx.coroutines.debug because we read some docs saying the performance impact is negligable. We also deploy with the YourKit profiler debug agent. We were seeing some odd performance issues (like, to the degree of k8s killing our servers due to liveness check failures), so we configure to get a stack trace when we get killed. Every thread that had any code written by us running in it ended with something like
Copy code
"epollEventLoopGroup-4-3 @call-handler#1379475" #50 prio=10 os_prio=0 tid=0x00007fbe1c05fec0 nid=0x42 runnable [0x00007fbe22efb000]
   java.lang.Thread.State: RUNNABLE
	at com.yourkit.runtime.Callback.setEventTableStringColumn(Native Method)
	at com.yourkit.runtime.CallbackProxyImpl.setEventTableStringColumn(CallbackProxyImpl.java:197)
	at com.yourkit.probes.StringColumn.setValue(StringColumn.java:17)
	at com.yourkit.probes.ResourceTable.setResourceName(ResourceTable.java:70)
	at com.yourkit.probes.builtin.Threads$Thread_setName_Probe.onReturn(Threads.java:199)
	at java.lang.Thread.setName(Thread.java:1133)
	- locked <0x00000006827db478> (a io.netty.util.concurrent.FastThreadLocalThread)
	at kotlinx.coroutines.CoroutineId.restoreThreadContext(CoroutineContext.kt:83)
	at kotlinx.coroutines.CoroutineId.restoreThreadContext(CoroutineContext.kt:60)
	at kotlinx.coroutines.internal.ThreadContextKt.restoreThreadContext(ThreadContext.kt:95)
	at kotlinx.coroutines.intrinsics.UndispatchedKt.startCoroutineUndispatched(Undispatched.kt:200)
	at kotlinx.coroutines.CoroutineStart.invoke(CoroutineStart.kt:111)
	at kotlinx.coroutines.AbstractCoroutine.start(AbstractCoroutine.kt:154)
	at kotlinx.coroutines.future.FutureKt.future(Future.kt:44)
	at kotlinx.coroutines.future.FutureKt.future$default(Future.kt:36)
So we're certainly not positive but it sure seems like kotlinx.coroutines.debug has non-negligable performance impact when combined with YourKit.