Skip to main content

Virtual Threads

This page explains the system.useVirtualThreads option in YueMi-Spigot and its trade-offs.

Comparison Table

FeatureVirtual Threads (YueMi)Thread Pool (Paper)
Minimum Threads Alive0 (spawn on demand)4 core threads kept alive
Idle Thread Keep-Alive~10s~30s
Scaling BehaviorUp to tens of thousands of tasksLimited by physical threads
Best ForI/O-bound tasks (DB, HTTP, disk)Mixed workloads, stable under CPU load
Memory Overhead per ThreadVery low (KBs)Higher (MBs)
CPU-bound WorkloadsNo real advantagePredictable & stable
CompatibilityNewer (Java 21+, may expose plugin issues)Mature and widely tested
Resource EfficiencyVery highModerate

Pros of Virtual Threads

  • Extremely lightweight; can handle massive concurrency.
  • Great for async plugins that perform database, network, or file operations.
  • Frees server owners from tuning thread pool sizes.

Trade-offs

  • Still a newer JVM feature; some plugins may not be fully compatible.
  • No performance boost for CPU-heavy async tasks.
  • May reveal concurrency bugs in poorly written plugins.