Scrivio Interview library
LeadershipPrincipal7 min read · updated 12 November 2026

Java server code moved from thread-per-request to reactive event loops for scalability, and now virtual threads bring back thread-per-request with blocking code. What concurrency model should your company standardise on for the next decade, and how do you handle existing reactive services?

I would standardise new request-response services on plain blocking code running on virtual threads, and keep reactive programming for cases that truly need streaming or backpressure across boundaries. Reactive spread because platform threads were expensive, and virtual threads, final since JDK 21, remove most of that cost while keeping code that is easier to write, debug and profile. Existing reactive services that run well stay as they are and are migrated only when they need major changes anyway.

Why this question is asked

Few architecture decisions affect as many engineers as the choice of concurrency model, because it decides how every service is written, tested and operated. The Java world has swung twice: from thread-per-request to reactive event loops for scale, and now, with virtual threads, back towards thread-per-request. Interviewers ask senior leaders this question to see whether they can separate the real reasons behind each swing from fashion, set a clear standard, and handle existing systems without a wasteful rewrite. In this answer, we will recap why reactive became popular, see what virtual threads change, look at where reactive still wins, write the standard itself, plan for existing services, and note the JDK features to watch.

1A Quick Recap: Why Reactive Became Popular

A platform thread is a Java thread backed by an operating system thread. It reserves stack memory and costs a context switch whenever the OS schedules it, so a server could afford a few hundred to a few thousand of them. In a thread-per-request server, each request holds its thread while it waits for the database or another service. With a 200-thread pool and requests that spend 95 percent of their time waiting, the server ran out of threads long before it ran out of CPU.

Reactive frameworks such as Project Reactor, used by Spring WebFlux, solved this by never waiting on a thread. A request becomes a chain of callbacks that a few event loop threads run as data arrives. That scales very well, but it moves the cost into the code: every API returns Mono or Flux, stack traces show framework internals instead of our call path, thread-local context such as security or MDC must be propagated by hand, and one blocking call anywhere can stall an event loop.

2What Virtual Threads Change

A virtual thread is a thread managed by the JVM rather than the OS. When it blocks on I/O, the JVM unmounts it from its carrier thread, a small pool of platform threads, and mounts another virtual thread in its place. Creating a million virtual threads is fine; they cost a few hundred bytes to a few kilobytes each while parked.

So the economic reason for reactive mostly disappears for blocking I/O. We can write ordinary sequential code, call JDBC and blocking HTTP clients, and still hold tens of thousands of concurrent requests. Debuggers, profilers, thread dumps and stack traces work as they always did, and the large ecosystem of blocking libraries works without adapters.

Java
// Spring Boot 3.2+ : Tomcat, @Async and scheduling use virtual threads
spring.threads.virtual.enabled=true
@GetMapping("/orders/{id}")
OrderDto order(@PathVariable long id) {
Order o = orders.findById(id).orElseThrow(); // blocks a virtual thread, carrier is freed
Customer c = customers.fetch(o.customerId()); // plain blocking HTTP call
return toDto(o, c); // stack trace shows exactly these lines
}

Notice that nothing in this code mentions concurrency. That is the main benefit for a company: every engineer can read and debug it. There are still a few things to watch, such as connection pool sizes that now become the real limit, and libraries that pin a carrier thread; JDK 24 removed pinning for synchronized blocks, so check your version and libraries.

3Where Reactive Still Wins

Virtual threads answer the cost of waiting. They do not give us a model for streams. Reactive libraries are still the better fit in three situations. The first is real streaming, such as server-sent events, WebSocket fan-out or processing an unbounded flow of messages, where operators like buffer, window and merge express the logic well. The second is backpressure across boundaries, where a slow consumer must be able to tell a fast producer to slow down, for example through R2DBC, reactive Kafka or RSocket. The third is services already built on reactive that run well, with a team that knows the model.

Choosing the model per service
Service shapeRecommended modelReason
CRUD or request-response APIBlocking code on virtual threadsSimplest code; scales for I/O waits
Calls many blocking libraries (JPA, SDKs)Blocking code on virtual threadsNo adapters, no event loop risk
Long-lived streams, SSE, WebSocket fan-outReactiveStream operators and backpressure
Stable reactive service, few changesKeep reactiveRewrite cost with no business gain
Reactive service needing a major reworkConsider moving to blockingMigration cost is paid anyway
The standard sets a default; exceptions are allowed when the service shape calls for them.

4Writing the Standard

A standard should be short enough that everyone remembers it. Mine would say: new request-response services use Spring MVC, or the framework of choice, with blocking code on virtual threads. Reactive is allowed when a service needs streaming or end-to-end backpressure, and the team writes down that reason in a short decision record. Shared libraries offer blocking APIs first.

The reason to choose blocking as the default is the cost over ten years, not raw performance. Most of the cost of a service is the people who read, change and operate it. Hiring is easier, onboarding is faster, incidents are shorter when stack traces are readable, and the same code runs fine whether a service has ten requests per second or ten thousand. We should still measure: before making the standard final, run a load test of a representative service on both models, so the decision rests on numbers from our own systems.

5Handling Existing Reactive Services

Rewriting working software because the fashion changed is one of the most expensive mistakes a platform group can make. A stable reactive service with a team that understands it has already paid its complexity cost; rewriting it adds risk and delivers no feature.

So the plan is to leave stable reactive services alone and to migrate opportunistically. When a service needs a major change anyway, a new data store, a large feature or a framework upgrade, the team estimates whether moving to blocking code makes that change cheaper, and if so does both together. Services where the reactive expertise has left the team move higher in the queue, because the operational risk is growing. Mixed calls are fine meanwhile: a blocking service and a reactive service talk over HTTP or Kafka and do not care how the other is built.

Step throughDeciding what to do with a reactive service
  1. Is it stable and owned by a team that knows reactive?
    YesKeep it; review yearlyNoLook at upcoming change
  2. Is a major change planned?new store, big feature, upgrade
    YesEstimate migrating as part of itNoKeep it, flag the skills risk
  3. Does migrating make the change cheaper?
    YesMigrate with the changeNoKeep reactive

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

6What to Watch in the JDK

Two related features will shape blocking code further. Structured concurrency, the StructuredTaskScope API, lets a method start several subtasks on virtual threads and treat them as one unit, so failures cancel siblings and no thread leaks. It is still a preview API in JDK 25 and its shape has changed between releases, so we should try it in non-critical code but not build shared libraries on it yet. Scoped values, final in JDK 25, are an immutable, bounded alternative to ThreadLocal that works well with very many virtual threads, and they are a good fit for passing request context. A platform group should follow both and update the standard when structured concurrency becomes final.

7Follow-up questions

Do virtual threads make reactive code faster?

No. Virtual threads help code that blocks. A well-written reactive service does not block, so it gains little. The gain from virtual threads is that blocking code can now reach similar throughput for I/O-bound work with much simpler code.

What are the risks of the virtual thread default?

The main ones are hidden limits and pinning. When threads become cheap, the database connection pool, rate limits of downstream services and memory per request become the bottlenecks, so we must set them deliberately. Some native calls and older libraries can still pin a virtual thread to its carrier; JDK 24 removed pinning for synchronized, but we should check JFR pinning events in load tests.

8Conclusion

In this answer, we saw that reactive programming spread because platform threads were expensive, and that virtual threads, final in JDK 21, remove most of that cost for blocking I/O while keeping code that is easy to write, debug and profile and that works with existing libraries. We set the standard: new request-response services use blocking code on virtual threads unless they need streaming or backpressure, where reactive still wins. We leave stable reactive services alone and migrate them when they need major changes anyway, and we watch structured concurrency, still a preview in JDK 25, and scoped values, final in JDK 25.

What to say in the interviewAbout 90 seconds aloud

Open with

I would standardise on blocking, thread-per-request code running on virtual threads for new request-response services. The reason reactive spread was that platform threads were expensive, so a few hundred threads waiting on the database capped the server.

Then, if they want more

Virtual threads, final since JDK 21, remove most of that cost: when one blocks on I/O, the JVM parks it and frees the carrier, so we can hold tens of thousands of requests with ordinary sequential code.

That code is much easier to write, debug and profile, stack traces make sense, and it works with JPA and every blocking library we already use. Reactive still has a place: real streaming, end-to-end backpressure, and services already built on it that run well. So the standard allows reactive when a team records a reason like that.

For existing reactive services, I would not rewrite anything that is stable. When a service needs a major change anyway, the team estimates whether moving to blocking makes that change cheaper and does both together, and services where the reactive expertise has left move up the list.

Before making it final, I would load-test a representative service on both models, so we decide on our own numbers. And I would keep an eye on structured concurrency, still a preview in JDK 25, and scoped values, which are final in JDK 25, and update the standard as they mature.

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 "Java server code moved from thread-per-request to reactive event loops for scalability...": https://scrivio-interview-library.netlify.app/java/concurrency-patterns/f4e153e8e5/