Spring Boot & Microservices (50 Qs)•Part 3: Microservices, Distributed Systems & Observability (25 - 35)
Spring Boot 3 Virtual Threads Integration: `spring.threads.virtual.enabled=true`.
senior LevelSystem DesignMicroservices
In Simple Words:
In Spring Boot 3.2+, enabling Java 21 Virtual Threads requires a single configuration property:
spring.threads.virtual.enabled=true
- What it Does: Replaces Tomcat's platform thread pool with an unbounded Virtual Thread executor. Every incoming HTTP request and
@Asynctask runs on its own virtual thread. - Immediate Benefit: Tomcat can handle 50,000+ concurrent blocking requests (database queries, REST calls) with steady sub-second latency and minimal memory overhead without writing reactive
WebFluxcode!