Is it possible to profile the performance of corou...
# coroutines
n
Is it possible to profile the performance of coroutines using VisualVM? If it can be done how would the coroutines be profiled? I'm mainly interested in memory usage as I ended up with a bit of a scare the other day when the JVM crashed due to running out of memory. Noticed when running VisualVM that the profiled JVM program is using many threads which is concerning considering that the program only uses coroutines. Was expecting the thread count to average around 5 with the total CPU cores mainly affecting the thread count. Actual thread count is averaging around 29.
o
somewhat, the coroutines will not have proper stacktraces due to how it's implemented, but all of the code will show up somewhere in the profiler, assuming you use profiling and not snapshots
n
What are the differences between profiling, and snapshots? This is my first time profiling a JVM program.
o
sorry, mis-spoke -- meant sampler, not snapshots, though the idea is basically that. see https://stackoverflow.com/questions/39655945/whats-the-difference-between-sampler-and-profiler-in-jvisualvm/39655977
if you're wondering why it is possible for a java tool to see coroutine code and why the stacktraces will be potentially miseading, you should probably understand how coroutines are implemented: https://github.com/Kotlin/KEEP/blob/master/proposals/coroutines.md#implementation-details
n
Resource usage summary of the JVM program. Heap memory usage looks fine (max usage is around 65 MB), and is well under the max heap limit (nearly 1 GB).
Contents of the JVM crash log file.
o
the heap is not the only thing the JVM has -- you should probably watch

https://youtu.be/c755fFv1Rnk

👍 1
277 Views