Quick revision
The short answer
Java first tied every connection to an operating system thread, which was simple but did not scale because threads are expensive. NIO selectors and later reactive frameworks scaled by sharing a few threads across thousands of connections, at the price of code that is much harder to write, debug and operate. Virtual threads now give us the simple blocking style with the scaling, so the investment message is: default new services to the simpler model, keep stable reactive systems, and fund training and observability for whichever model we run.
What to remember
In this answer, we told the history of Java I/O as three eras: blocking threads that were simple but expensive, selectors and reactive frameworks that scaled but cost engineering time, and virtual threads that bring both. For leadership, that becomes four investments: upgrade the JVM fleet, set a simple default for new services, keep stable reactive systems unless they measurably hurt, and fund training and observability for whichever model each service uses.
Your turn
Answer it aloud as you would in the interview, or type your answer below. Then show one part at a time and compare.
Java first tied every connection to an operating system thread, which was simple but did not scale because threads are expensive. NIO selectors and later reactive frameworks scaled by sharing a few threads across thousands of connections, at the price of code that is much harder to write, debug and operate. Virtual threads now give us the simple blocking style with the scaling, so the investment message is: default new services to the simpler model, keep stable reactive systems, and fund training and observability for whichever model we run.
Why this question is asked
Leaders rarely need to know what epoll is, but they do decide where engineering time goes: whether to fund a reactive rewrite, retrain a team, or upgrade the JVM fleet. An architect who can tell the history of Java I/O as a story about cost, and say what it means for the budget, earns trust; one who explains it as a list of APIs loses the room. Interviewers ask this at principal level to hear that translation. In this answer, we will walk through the three eras in plain terms, use one analogy that leadership can hold on to, show what each era cost the business, and then turn that into concrete platform investment recommendations.
1Era One: One Thread for Every Connection
From Java 1.0, network code used blocking streams. The program reads from a socket and the thread waits until data arrives. It is the natural way to write code: step one, step two, step three. Each connection got its own operating system thread, and the thread spent most of its life waiting.
The problem is cost. An operating system thread reserves memory for its stack, often around a megabyte, and the kernel must schedule it. A server could comfortably run a few thousand threads, not hundreds of thousands. As the web grew, the industry talked about the "C10K problem", serving ten thousand clients at once, and thread-per-connection could not get there economically.
2Era Two: Selectors and Reactive Frameworks
Java 1.4 added NIO in 2002, with non-blocking channels and selectors: one thread asks the operating system which of thousands of connections are ready and serves only those. Frameworks such as Netty, Vert.x and later Project Reactor and Spring WebFlux built on it. Scaling problems were solved; a few threads could serve tens of thousands of connections.
But the cost moved from hardware to people. Code had to be written as chains of callbacks or reactive operators. Stack traces stopped showing business logic. Profilers and debuggers struggled, thread-locals used for request context broke, and one accidental blocking call could freeze a whole server. Teams needed specialists, onboarding took longer, and incidents took longer to diagnose.
3Era Three: Virtual Threads Make Blocking Cheap Again
Java 21, released in 2023, made virtual threads final. A virtual thread is managed by the JVM: when it waits for I/O, the JVM parks it in ordinary memory, a few kilobytes, and uses the real thread for someone else. Developers write the simple step-by-step code of era one, and the JVM does the sharing of era two behind the scenes. Spring Boot exposes it with a single setting.
So the history is not a straight line of progress. It is a swing: simplicity, then scale at the cost of simplicity, then both. That framing matters for leadership because it explains why yesterday's best practice, going reactive, is no longer the default, without implying that the people who chose it were wrong.
| Era | How it scales | What it costs us |
|---|---|---|
| Blocking, thread per connection (1996-) | buy more servers | hardware; caps out at a few thousand connections |
| Selectors and reactive (2002-, mainstream ~2015) | a few threads share many connections | engineer time, specialist skills, harder incidents |
| Virtual threads (Java 21, 2023-) | the JVM shares threads for us | a JVM upgrade, library checks, some retraining |
4Explaining It in One Picture
For a non-technical audience I use a restaurant. In era one, every table has its own waiter who stands beside it the whole meal, even while the guests read the menu; it is simple, but the restaurant can only seat as many tables as it can afford waiters. In era two, a few waiters cover the whole floor, but every order must be written on a ticket in a special format, and when something goes wrong nobody can tell which table it belonged to. In era three, waiters still look after "their" table in the simple way, but whenever a table is just reading the menu, the waiter is free to serve others, and the restaurant manager handles that automatically.
The point of the analogy is the message behind it: we no longer have to choose between simple work and a full restaurant. Leadership does not need the mechanism, only the trade it changes.
5What It Means for Platform Investment
The first recommendation is a JVM upgrade path. Virtual threads need Java 21, and Java 25 removed an important limitation around synchronized blocks, so a fleet on Java 17 gets none of this. Funding the upgrade of base images, CI and frameworks to Java 25 and Spring Boot 3.5 or 4 is the enabling investment.
The second is a stated default: new request-response services use the simpler blocking model on virtual threads. That reduces onboarding time and the number of specialists we need. Reactive stays an approved choice for streaming, gateways and very high connection counts, with a design note.
The third is restraint. We do not rewrite stable reactive systems for fashion. A rewrite of a working WebFlux service might cost a team a quarter and buys nothing customers see. We migrate when the old model is measurably hurting us: incident time, delivery speed, or the inability to hire people who can maintain it.
The fourth is people and tools. Whichever model a service uses, invest in training, in observability that understands it (tracing that follows requests across threads, JFR and profiling dashboards, alerts on pinning or event-loop blocking), and in load-testing before changes. Most incidents in this area come from teams using a model they were never taught.
- Upgrade the fleet to Java 25the precondition for everything else
- Default new services to MVC on virtual threadssimpler code, fewer specialists
- Is an existing reactive service hurting delivery or incidents?Yesplan a measured migrationNoleave it alone
- Fund training and observability for both modelstracing, profiling, load tests
4 steps in order. Play them, or step through them one at a time.
6Follow-up questions
Were we wrong to adopt reactive frameworks?
No. With the tools of 2015 to 2022, reactive was the only way to reach high concurrency on the JVM without huge hardware bills, and it still fits streaming and gateway workloads well. The context changed; the decision was reasonable at the time. Saying this clearly keeps the teams who built those systems on side.
How would you measure whether the new default is paying off?
I would track onboarding time to first production change, incident mean time to resolve for services on each model, and infrastructure cost per thousand requests. If MVC on virtual threads matches reactive on cost while improving the first two, the default is justified; if not, we revisit it.
What is the biggest risk in the migration?
Hidden assumptions in libraries. Code that pins carrier threads, or relies on per-thread caches, can make virtual threads slower than the old pool. We manage it with a library checklist, JFR pinning events in load tests, and moving one service at a time.
7Conclusion
In this answer, we told the history of Java I/O as three eras: blocking threads that were simple but expensive, selectors and reactive frameworks that scaled but cost engineering time, and virtual threads that bring both. For leadership, that becomes four investments: upgrade the JVM fleet, set a simple default for new services, keep stable reactive systems unless they measurably hurt, and fund training and observability for whichever model each service uses.
Open with
I would tell it as a story about where the cost sits. Originally Java gave every connection its own operating system thread. The code was easy, but threads are expensive, so a server topped out at a few thousand connections and we paid in hardware.
Then, if they want more
NIO selectors and frameworks like Netty and WebFlux fixed that by letting a handful of threads serve thousands of connections, but the cost moved to people: the code is harder to write and debug, stack traces stop showing business logic, and you need specialists.
Virtual threads in Java 21 bring the simple style back, because the JVM parks a waiting thread cheaply and reuses the real thread, so we get the scale without the complexity.
For a non-technical audience I use the waiter analogy: one waiter per table, then a few waiters with a complicated ticket system, then waiters who look after their table but are freed automatically while guests read the menu.
For investment, I would recommend upgrading the fleet to Java 25, making Spring MVC on virtual threads the default for new request-response services, keeping reactive as an approved choice for streaming and gateways, and not rewriting stable reactive systems unless they measurably hurt delivery or incidents.
And whichever model a team uses, I would fund training, tracing and load testing for it, because that is where most incidents start.
About this answer
- Last updated
- 12 November 2026
- Versions it names
- Java 21, Java 25, Java 17, Spring Boot 3.5
- 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.
- Official documentation
- The Java Language Specification, Java SE 21, Java SE 21 API documentation
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 went from blocking thread-per-connection I/O, to NIO selectors and reactive...": https://scrivio-interview-library.netlify.app/java/io-and-nio/e55b8b6b99/