Scrivio Interview library
LeadershipPrincipal7 min read · updated 12 November 2026

With virtual threads final since Java 21, some engineers argue thread pools are obsolete. What role do executors and pools still have, and what would you tell teams to stop doing?

Thread pools are not obsolete, but their main reason for existing has shrunk. Executors still matter because they separate submitting a task from the policy for running it, and platform-thread pools still fit CPU-bound work and code that should not run on virtual threads. What has changed is that pools were mostly a way to ration expensive platform threads, and virtual threads are cheap enough to create one per task. So I would tell teams to stop pooling virtual threads and to stop using pool sizes as a hidden throttle on downstream systems, and instead express concurrency limits directly with semaphores or connection pool sizes.

Background to this question

When virtual threads became final in Java 21, many teams switched on spring.threads.virtual.enabled and asked what to do with their carefully tuned pools. Some declared pools dead; others carried on as before and wrapped virtual threads in fixed pools, which gives the worst of both. A senior engineer is asked this because the answer requires separating what pools did on purpose from what they did by accident. In this answer, we will recall why pools existed, see what executors still give us, look at the accidental job of pool sizes as throttles and how to replace it, decide where platform pools still belong, and end with clear guidance for teams.

1Why Pools Existed

A platform thread is a thin wrapper over an operating-system thread. Creating one costs tens of microseconds, it reserves a stack of around a megabyte of address space by default, and the OS scheduler struggles once there are many thousands. So for twenty years the answer was to create a fixed number of threads once and reuse them through a pool. Pools were a rationing mechanism for an expensive resource.

Virtual threads, final since Java 21, change the cost. A virtual thread is a Java object scheduled by the JVM onto a small set of carrier platform threads. Creating one is cheap, it starts with a small stack held on the heap, and when it blocks on I/O the JVM unmounts it from its carrier, so the carrier can run other virtual threads. A million concurrent virtual threads is feasible. Rationing is no longer needed, so the main reason for pooling is gone.

2What Executors Still Give Us

The ExecutorService interface was never only about pools. It separates two decisions: the code that submits a task, and the policy for how that task runs, on which threads, with what limits, and with what lifecycle. That separation is still valuable. With virtual threads, Executors.newVirtualThreadPerTaskExecutor() is simply a new policy behind the same interface, so code that submits tasks and collects futures barely changes.

Executors also give us lifecycle management, a defined place to shut work down, and since Java 19, close() for try-with-resources so that all tasks started in a block finish before it ends. Spring's TaskExecutor abstractions, @Async and scheduled tasks all continue to work through executors; switching them to virtual threads is a configuration change, not a redesign.

Java
// Same submitting code, different policy
ExecutorService io = Executors.newVirtualThreadPerTaskExecutor(); // one virtual thread per task
ExecutorService cpu = Executors.newFixedThreadPool(Runtime.getRuntime().availableProcessors());
Future<Quote> q = io.submit(() -> pricingClient.quote(order)); // blocking HTTP call, cheap to wait
Future<Report> r = cpu.submit(() -> renderPdf(data)); // CPU-bound, sized to cores

3The Accidental Job of Pool Size

Pools also did something nobody designed explicitly: they limited concurrency. A pool of 20 threads calling a partner API meant at most 20 calls in flight, which happened to protect the partner, and a request pool of 200 Tomcat threads meant at most 200 concurrent database transactions. When we replace the pool with a thread per task, those limits disappear. Ten thousand concurrent requests become ten thousand concurrent calls to a partner rated for 50, or ten thousand requests queuing for a connection pool of 30.

The right response is not to put the pool back, but to state the limit where it belongs. A Semaphore with 50 permits around the partner call says exactly what we mean, and it fails or waits in a visible place. The database connection pool size, for example HikariCP's maximumPoolSize, is already the real limit on database concurrency, with a connection timeout that turns overload into a clear error. Rate limiters and bulkheads from libraries such as Resilience4j serve the same purpose.

Java
private final Semaphore partnerLimit = new Semaphore(50); // the partner's documented limit
Quote callPartner(Order o) throws InterruptedException {
if (!partnerLimit.tryAcquire(200, TimeUnit.MILLISECONDS)) {
throw new PartnerBusyException(); // visible, measurable overload
}
try {
return partnerClient.quote(o); // at most 50 in flight
} finally {
partnerLimit.release();
}
}
Pool sizes and what replaces them
Old pool settingWhat it really limitedExplicit replacement
Partner client pool of 20Calls in flight to partnerSemaphore(20) or bulkhead
Tomcat max threads 200Concurrent requestsRate limit or admission control
DB worker pool of 30Concurrent queriesConnection pool size and timeout
CPU pool of N coresCPU-bound parallelismKeep it: platform pool sized to cores

4Where Platform Pools Still Belong

Virtual threads help when tasks spend most of their time waiting. For CPU-bound work, such as rendering, compression, image processing or heavy computation, there is nothing to wait for, so more threads than cores only adds switching. A fixed platform pool sized to the number of cores, or a ForkJoinPool for divide-and-conquer work, remains the right tool, and it also keeps CPU-heavy tasks from occupying the carrier threads that virtual threads need.

Some code should also stay on platform threads. Before Java 24, blocking inside synchronized pinned a virtual thread to its carrier; JEP 491 in Java 24 removed that limitation for most cases, but calls into native code through JNI can still pin. Libraries that cache expensive objects in ThreadLocal per thread assumed a few long-lived threads; with a new virtual thread per task, that cache is rebuilt every time. And code that depends on thread priorities or on thread identity for the lifetime of the application needs a platform thread. For these, a dedicated platform pool is still correct.

5What I Would Tell Teams to Stop Doing

Two practices should stop. First, pooling virtual threads: wrapping virtual threads in a fixed pool of 200 adds back the queueing and the limit we just removed, while keeping none of the reasons pooling existed. Virtual threads are meant to be created per task and thrown away. Second, sizing pools to throttle downstreams implicitly: if a limit protects a database or a partner, it should be written as that limit, with a name, a metric and an alert, not encoded as a thread count that someone will later change for an unrelated reason.

The guidance in short form would be: use newVirtualThreadPerTaskExecutor or Spring's virtual-thread setting for I/O-bound work; express every concurrency limit explicitly at the resource it protects; keep platform pools sized to cores for CPU-bound work and for code that must not run on virtual threads; and measure pinning with JFR's jdk.VirtualThreadPinned event during the migration.

6Follow-up questions

Does Spring Boot need changes to use virtual threads?

On Spring Boot 3.2 and later, spring.threads.virtual.enabled=true makes Tomcat, Jetty, @Async, scheduling and several other components use virtual threads. The work is mostly checking downstream limits and pinning, not changing code.

Is there still a reason to limit the number of virtual threads at all?

Not their number as such, but the resources they use. Each in-flight request holds memory for its data, so admission control at the edge, such as a rate limit or a maximum number of concurrent requests, still protects the service from overload.

How do you find code that relied on a pool as a throttle?

Look for small, oddly specific pool sizes in configuration, especially near clients for external systems, and ask what breaks if that number grows tenfold. Load tests after enabling virtual threads, watching downstream error rates and connection pool wait times, reveal the rest.

7Conclusion

In this answer, we separated what thread pools did on purpose from what they did by accident. Pools rationed expensive platform threads, and virtual threads make that unnecessary, but executors remain useful because they separate task submission from execution policy and lifecycle. Pool sizes also acted as hidden concurrency limits, which we now express directly with semaphores, connection pools and bulkheads. Platform pools still fit CPU-bound work and code that must not run on virtual threads, and teams should stop pooling virtual threads and stop using pool sizes to throttle downstreams.

What to say in the interviewAbout 90 seconds aloud

Open with

I'd separate executors from pools. Executors are still valuable: they separate submitting work from the policy for running it, they give us lifecycle and shutdown, and with virtual threads the policy just becomes newVirtualThreadPerTaskExecutor behind the same interface.

Then, if they want more

Pools, though, were mainly a rationing mechanism, because platform threads are expensive OS threads with big stacks. Virtual threads are cheap and unmount when they block on I/O, so for I/O-bound work there's no reason to pool them; a thread per task is the intended model. The trap is that pool sizes were quietly doing a second job, limiting concurrency.

A pool of 20 calling a partner meant at most 20 calls in flight. Switch to virtual threads and that limit disappears, so I'd ask teams to state limits directly where the resource is: a Semaphore around the partner call, the database connection pool size with a timeout, or a bulkhead, each with a metric.

Platform pools still have a role. CPU-bound work wants a fixed pool sized to the cores, or a ForkJoinPool, and some code shouldn't run on virtual threads, like heavy JNI calls that pin the carrier, or libraries that cache expensive objects in thread locals.

So the two things I'd tell teams to stop are pooling virtual threads, which just reintroduces queueing, and using a pool size as an implicit throttle on downstream systems.

About this answer

Last updated
12 November 2026
Versions it names
Java 21, Java 24, Java 19, Spring Boot 3.2
Checked
Its structure and format are checked automatically. Use it as a carefully prepared study note: where a detail matters, confirm it against the documentation below. What the checks cover
Where the question comes from
Written by Scrivio for practice. It is not taken from an interview.
Report an issue with this answer

Copy the line below and send it to the author with what you found. It carries the address of this page.

Issue with "With virtual threads final since Java 21, some engineers argue thread pools are...": https://scrivio-interview-library.netlify.app/java/executors/53c223f209/