29 Kasım 2026 Pazar

JEP 444 - Virtual Threads

Açıklaması şöyle
virtual threads don't remove your bottlenecks, they move them
 
with a regular tomcat setup you had 200 threads, so at most 200 requests were in flight at once
 
turn on spring.threads.virtual.enabled and that cap becomes tomcat's max-connections, 8192 by default. thousands of requests in flight, each on its own virtual thread, all happy to wait
 
your DB itself is still protected, hikari's pool (10 connections by default) was always the real limit there. what changes is the line in front of it. before, at most 200 threads could wait for a connection. now it can be thousands, and once the wait goes past connectionTimeout (30s by default) requests start failing instead of just being slow
downstream calls with no limit of their own feel it the most. the API you call just got a lot more concurrent traffic from you what to think about before flipping the flag:

how long a request should wait for a DB connection, and what happens when it can't get one
limits on downstream calls. JEP 444 suggests a Semaphore, not pooling virtual threads. just remember it's per instance, so 50 permits on 6 pods is 300 calls 
a timeout on every downstream call, or one hung request keeps its permit forever load testing with realistic concurrency, not just measuring throughput
Çok fazla virtual thread varsa işlemleri sınırlandırmak için Semaphore kullanılır.

Hiç yorum yok:

Yorum Gönder