How to inspect Virtual Threads on a running JVM?

478 Views Asked by At

I have been using Project Loom to revive a game server - it's very old code that was written back when green threads were a thing, so writing a server on one-thread-per-connection model was not unreasonable - and it works quite well, in particular considering it's a preview feature.

(I know, it's a preview feature, but this is a personal project and I'm happy to adjust if APIs change in the future - beats rewriting battle-tested code that already does its job well)

On a traditional, thread-based app, I'd use the likes of VisualVM to inspect the running threads - but virtual threads being actually workloads, they won't show up there (I only see the thread pool that they share). I wonder if someone has already come up with a tool that allows one to inspect the virtual threads (e.g., to know precisely where they are blocked or whether they are running, how many of them are around, etc); it would help me a lot with debugging minor stuff.

Any advice?

0

There are 0 best solutions below