Scrivio Interview library
DesignIntermediate6 min read · updated 12 November 2026

Your service team must decide between Spring WebFlux and Spring MVC with virtual threads for a new high-concurrency API on Java 25. How would you decide?

On Java 25, Spring MVC with virtual threads is usually the default for a high-concurrency API: it handles many concurrent requests with ordinary blocking code, simple stack traces and familiar libraries. WebFlux is the better fit for streaming, back-pressure and stacks that are non-blocking from end to end, but it adds complexity. We decide by checking whether our drivers and libraries are blocking or reactive, load testing both options with our real workload, and weighing team familiarity and our existing services.

Why this question is asked

For years, high concurrency in Spring meant WebFlux, because each blocking request held a platform thread, and threads are expensive. Virtual threads changed that equation, and many teams are now asking whether they still need reactive code. Interviewers ask this to see whether we understand what each model actually does, rather than repeating 'reactive scales better'. In this answer, we will recap both models, see what virtual threads give MVC, where WebFlux still wins, why the libraries decide a lot, how to load test fairly, and how team factors fit in.

1A Quick Recap of the Two Models

Spring MVC is the servlet-based stack: each request runs on a thread from start to finish, and when the code calls a database or another service, that thread waits. With classic platform threads, which map one-to-one to operating system threads, a server typically runs a pool of about 200, so 200 requests waiting on slow calls exhaust it. Spring WebFlux is the reactive stack built on Project Reactor and usually Netty: a small number of event-loop threads handle all requests, and code never blocks; instead it returns Mono and Flux objects that describe work to run when data arrives.

Virtual threads, final since Java 21 and mature in Java 25, are threads managed by the JVM. When a virtual thread blocks on I/O, the JVM unmounts it from its carrier thread, which then runs another virtual thread. So we can have one virtual thread per request, tens of thousands at once, while still writing blocking code.

Java
# application.properties (Spring Boot 3.2 and later)
spring.threads.virtual.enabled=true
# Tomcat now handles each request on a new virtual thread
@GetMapping("/orders/{id}")
OrderView order(@PathVariable long id) {
Order o = orders.findById(id).orElseThrow(); // blocks only this virtual thread
Customer c = customers.fetch(o.customerId()); // plain RestClient call
return OrderView.of(o, c);
}

Notice that the controller is ordinary MVC code. The only change for high concurrency is one property.

2What Virtual Threads Give Spring MVC

With virtual threads, MVC scales to many concurrent waiting requests without a reactive rewrite. The benefits are practical: stack traces show our code in order, a debugger steps through it normally, ThreadLocal-based features like MDC logging and Spring Security's context keep working, and every blocking library we already use, JDBC, JPA, blocking HTTP clients, works as before.

There are caveats. Virtual threads do not make the database faster: if our connection pool has 50 connections, the 51st concurrent query still waits, so pools and downstream limits become the real bottleneck, and we may need bulkheads or semaphores to avoid overloading dependencies. Earlier Java versions pinned a virtual thread to its carrier inside synchronized blocks; Java 24 removed most of that pinning, so on Java 25 it is much less of a concern, but check your libraries for other pinning cases such as native calls.

3Where WebFlux Still Wins

WebFlux remains the better fit for some workloads. Streaming responses, such as server-sent events to thousands of clients or proxying large data streams, map naturally to Flux. Back-pressure, where a slow consumer signals the producer to slow down, is built into Reactive Streams and hard to reproduce with blocking code. Gateways and proxies that do little work per request but hold many connections benefit from the event-loop model. And if the whole stack is already reactive, with R2DBC for the database, a reactive Kafka or Redis client and WebClient, WebFlux uses resources very efficiently.

The cost is complexity. Reactive code is harder to write, read, debug and test; a forgotten blocking call on an event-loop thread can stall the whole server; and stack traces are hard to follow without extra tooling.

MVC with virtual threads vs WebFlux
ConcernMVC + virtual threadsWebFlux
Programming styleblocking, sequentialreactive, Mono and Flux
Debugging and stack tracesnormalharder, needs tooling
JDBC and JPAwork as beforeneed R2DBC or offloading
Streaming and back-pressurepossible, limitedbuilt in
Many idle long-lived connectionsgoodvery good
Team learning curvelowhigh
For typical request and response APIs, the first column is usually enough.

4Checking Whether Our Libraries Block

The libraries under the API often decide the question. If the service uses PostgreSQL through JPA, the JDBC driver blocks. On MVC with virtual threads that is fine. On WebFlux, we must either switch to R2DBC, which means giving up JPA, or wrap blocking calls with publishOn or subscribeOn on a bounded elastic scheduler, which brings back threads and loses much of the reactive advantage. The same check applies to other clients: messaging, caches, SDKs from cloud providers and internal libraries.

So we make a list of every dependency the API calls and mark each as blocking or reactive. If most are blocking, WebFlux means rewriting or wrapping them; if the stack is mostly reactive already, WebFlux fits naturally.

5Load Testing Both With Our Real Workload

Benchmarks from blog posts measure someone else's workload. We build a small prototype of the critical endpoints in both styles and load test them with realistic traffic, for example with Gatling or k6: the real mix of endpoints, real payload sizes, and realistic downstream latencies (say 80 milliseconds for the database and 200 for a partner API). We measure throughput, p95 and p99 latency, CPU and memory at the target concurrency, say 10,000 concurrent requests, and behaviour under overload.

Often the result is that both meet the target, with WebFlux using somewhat less memory, and the downstream connection pools limiting both. That is useful: when both are good enough, simplicity and familiarity should decide.

Step throughChoosing the stack for the new API
  1. Need streaming or back-pressure?
    YesFavour WebFluxNoCheck the libraries
  2. Are the main drivers reactive?
    YesWebFlux is a natural fitNoFavour MVC with virtual threads
  3. Load test both with the real workloadthroughput, p95, p99, memory
  4. Both meet the target?
    YesPick the simpler one for the teamNoPick the one that meets it
  5. Record the choice in an ADR

5 steps in order. Play them, or step through them one at a time.

6Team Familiarity and Existing Services

Finally, we weigh the people and the estate. If the team and the other services are on MVC, a new WebFlux service brings a different style, different libraries and different debugging habits, which costs in reviews and on-call. If the company already runs reactive services and has the skills, the cost is lower. We record the decision in an ADR with the load test results and the assumptions, such as 'no streaming needs, all drivers blocking', so a future change, for example a new streaming feature, can be judged against them.

7Follow-up questions

Do virtual threads make reactive programming obsolete?

Not entirely. They remove the main reason most request and response services used reactive code, which was thread efficiency while waiting. Reactive streams still offer back-pressure, rich stream composition and efficient handling of very many long-lived connections, so they remain the better tool for streaming-heavy workloads.

What new bottleneck appears with virtual threads?

Downstream resources. With thousands of concurrent requests, a connection pool of 50 or a partner API's rate limit becomes the limit, and requests queue there. We size pools deliberately, add timeouts, and limit concurrency to fragile dependencies with a semaphore or bulkhead.

Can one application use both?

Spring MVC can use WebClient for non-blocking outgoing calls, and WebFlux can offload blocking work, but a single application runs on one web stack. Mixing styles widely inside one service usually makes it harder to reason about, so it is better to pick one model per service.

8Conclusion

In this answer, we saw that on Java 25, Spring MVC with virtual threads handles high concurrency with blocking code, normal debugging and existing libraries, while WebFlux remains strongest for streaming, back-pressure and fully reactive stacks at the cost of complexity. We decide by checking whether our drivers are blocking or reactive, load testing both with the real workload, and weighing team familiarity and existing services, then recording the decision with its assumptions.

What to say in the interviewAbout 80 seconds aloud

Open with

On Java 25, my default for a new high-concurrency request and response API would be Spring MVC with virtual threads. With spring.threads.virtual.enabled, each request gets a virtual thread, and blocking calls only park that virtual thread, so we can handle thousands of concurrent waiting requests with ordinary code, normal stack traces, MDC and security context working, and JDBC and JPA as they are.

Then, if they want more

The bottleneck then moves to downstream resources like connection pools, so I would size those and add timeouts.

WebFlux still wins for streaming, server-sent events, back-pressure and gateway-like workloads with many long-lived connections, especially when the stack is reactive end to end with R2DBC and WebClient, but it is harder to write, debug and test, and one blocking call on the event loop can stall everything. So I would list our dependencies and mark which are blocking.

If the database is JPA over JDBC, that strongly favours MVC. Then I would build a small prototype of the key endpoints both ways and load test them with our real mix and realistic downstream latencies, looking at p95, p99 and memory.

If both meet the target, I would pick the one the team and our other services already use, and record the decision and its assumptions in an ADR.

About this answer

Last updated
12 November 2026
Versions it names
Java 25, Java 21, Java 24, 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 official documentation for the version you use. 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 "Your service team must decide between Spring WebFlux and Spring MVC with virtual threads...": https://scrivio-interview-library.netlify.app/architecture/architecture-decisions/7ffddf6580/