Starting from JVM 19, the virtual threads of Project Loom are provided as a preview feature. This demo provides test API endpoints for comparing virtual threads with platform threads and Kotlin coroutines.
curl -iL -XPOST localhost:8080/api/sleep-by-platform-threads -H "Content-Type: application/json" -d '{"threadCount": 100000}'
curl -iL -XPOST localhost:8080/api/sleep-by-virtual-threads -H "Content-Type: application/json" -d '{"threadCount": 100000}'
curl -iL -XPOST localhost:8080/api/sleep-by-io-dispatcher -H "Content-Type: application/json" -d '{"sleepCount": 100000, "isBlocking": true}'
curl -iL -XPOST localhost:8080/api/sleep-by-loom-dispatcher -H "Content-Type: application/json" -d '{"sleepCount": 100000, "isBlocking": true}'
Platform Threads |
Virtual Threads |
Dispatchers.IO |
Virtual Thread per Task Dispatcher |