Quick revision
The short answer
server.tomcat.threads.max (default 200) is how many worker threads process requests at once, server.tomcat.max-connections (default 8192 for the NIO connector) is how many connections Tomcat accepts and keeps open, and server.tomcat.accept-count (default 100) is the size of the operating system's backlog queue for connections waiting once max-connections is reached. When all three are full, new connections are refused or time out on the client.
What to remember
In this answer, we followed a request through Tomcat's three limits. threads.max, 200 by default, caps requests running at once. max-connections, 8192 for NIO, caps open connections. accept-count, 100, is the OS backlog for connections waiting beyond that. When all three are full, new connections are refused or time out with no HTTP response. We also saw that raising threads helps only for waiting work whose downstreams can keep up.
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.
server.tomcat.threads.max (default 200) is how many worker threads process requests at once, server.tomcat.max-connections (default 8192 for the NIO connector) is how many connections Tomcat accepts and keeps open, and server.tomcat.accept-count (default 100) is the size of the operating system's backlog queue for connections waiting once max-connections is reached. When all three are full, new connections are refused or time out on the client.
Why this question is asked
These three properties decide what happens to our service on its busiest day. If we misunderstand them, we either see mysterious timeouts at a load the service should handle, or we raise a number and make things worse. Interviewers ask about them because the answer shows whether we understand the path a request takes before our controller ever runs. In this answer, we will recap how Tomcat receives a request, explain each property with its default, walk through what happens as load rises until all three limits are full, and see when raising the thread count helps and when it does not.
1A Quick Recap of How Tomcat Receives a Request
A client first opens a TCP connection to our port. The operating system completes the connection handshake and puts the new connection in a queue called the backlog. Tomcat's acceptor thread takes connections from that queue and registers them with a poller, a thread that watches many connections at once and notices when one of them has data to read.
When a request arrives on a connection, Tomcat hands it to a worker thread from its pool. The worker parses the request, runs our filters and controller, writes the response and goes back to the pool. With HTTP keep-alive the connection stays open for the next request, so Tomcat usually holds many more connections than it has busy threads. That is why connections and threads are limited separately.
2The Three Properties and Their Defaults
Each property limits a different stage of that path, and it helps to see them side by side.
- Client opens a TCP connectionhandshake done by the operating system
- OS backlog queueaccept-count = 100 waiting connections
- Connections Tomcat holdsmax-connections = 8192, busy or idle
- Worker threads
threads.max= 200 requests running at once - Our controller and its downstream callsdatabase pool, HTTP clients
5 layers, from the top down. Step through them one at a time.
A request passes each limit in turn before our code runs.
threads.max is the number of requests that can be processed at the same moment. The 201st simultaneous request does not fail; its connection is open and waiting, and Tomcat runs it as soon as a worker is free.
max-connections is the number of connections Tomcat accepts and keeps track of, whether they are busy or idle keep-alive connections. Once it is reached, Tomcat's acceptor stops taking new connections from the operating system.
accept-count is passed to the operating system as the backlog size. It is the waiting room outside the door: connections the OS has completed but Tomcat has not yet accepted because it is at max-connections. On Linux the kernel also caps it with net.core.somaxconn, so the effective value can be smaller than what we set.
3What Happens as Load Rises
Let us follow a service as traffic grows. Up to 200 concurrent requests, every request gets a thread immediately. Between 200 and 8192 open connections, requests wait on their open connection for a free thread, and latency grows by the waiting time, but nothing is refused. Most overloaded Tomcat services live in this zone: response times climb and clients see slow answers.
Once 8192 connections are open, Tomcat stops accepting. New connections now wait in the operating system's backlog, up to 100 of them. When the backlog is full too, the operating system can no longer queue new connections. Depending on the OS and its settings, the client either gets the connection refused immediately or its connection attempt hangs and times out, often after several seconds. Either way, those clients receive no HTTP response at all, not even a 503.
- Room in the OS backlog (under 100)?YesQueue until Tomcat accepts itNoRefused or client timeout
- Tomcat below 8192 connections?YesTomcat accepts it nowNoStay in the backlog
- A worker thread free (under 200 busy)?YesRun the request nowNoWait on the open connection
3 steps in order. Play them, or step through them one at a time.
Every new connection passes through the OS backlog; Tomcat takes it only while below max-connections.
4When Raising threads.max Helps, and When It Hurts
A common first reaction to latency is to raise threads.max to 800. Whether that helps depends on what the threads are doing. If they are waiting, for example on a slow HTTP call to another service that can handle more parallel calls, more threads let more requests wait in parallel and throughput rises.
But if the work is CPU bound, more threads than cores only adds context switching, and each thread also costs memory for its stack. And if the threads are waiting for something with its own small limit, more threads just make a longer queue in front of it. The classic example is the database connection pool: with Hikari's default of 10 connections, 800 threads mean 790 of them waiting for a connection instead of 190.
So the rule is: more threads help only if the work is waiting rather than CPU bound, and only if the downstream pools and services can keep up with the extra parallel calls. Before changing threads.max, we look at a thread dump or at the busy-thread metric tomcat.threads.busy to see where the time goes.
5Follow-up questions
Why is max-connections so much larger than threads.max?
Because most open connections are idle at any moment. With keep-alive, a browser or a client pool keeps a connection open between requests, so 8192 connections may carry only a few hundred active requests. The NIO connector's poller watches all of them with a few threads and only hands a connection to a worker when data arrives.
Does Tomcat return 503 when it is full?
No, not by itself. Requests waiting for a thread just wait, and connections beyond the backlog are refused or time out at the TCP level. If we want a fast 503 instead, we have to add it ourselves, for example with a concurrency limit in a filter or at the load balancer.
How do virtual threads change these settings?
With spring.threads.virtual.enabled=true, Tomcat runs each request on a new virtual thread, so threads.max no longer limits concurrency in the same way. max-connections and accept-count still apply, and the downstream limits, such as the database pool, become the real cap on how many requests do work at once.
6Conclusion
In this answer, we followed a request through Tomcat's three limits. threads.max, 200 by default, caps requests running at once. max-connections, 8192 for NIO, caps open connections. accept-count, 100, is the OS backlog for connections waiting beyond that. When all three are full, new connections are refused or time out with no HTTP response. We also saw that raising threads helps only for waiting work whose downstreams can keep up.
Open with
These three properties limit different stages of how Tomcat takes in requests. server.tomcat.threads.max, 200 by default, is the size of the worker pool, so it is how many requests are actually being processed at the same time. server.tomcat.max-connections, 8192 by default for the NIO connector, is how many connections Tomcat accepts and keeps open, busy or idle, which is why it is much larger: with keep-alive most connections are idle at any moment. server.tomcat.accept-count, 100 by default, is the backlog Tomcat asks the operating system for, the queue of connections waiting once max-connections is reached.
Then, if they want more
So as load rises, first requests wait on their open connection for a free thread and latency grows. Then, beyond 8192 connections, new ones wait in the OS backlog. When that backlog is full as well, new connections are refused or the client's connect times out, and the client gets no HTTP response at all.
On tuning, I would not simply raise threads.max. More threads help only when the threads are waiting on I/O and the downstream, such as the database pool, can accept more parallel work. If threads are stuck waiting for a ten-connection pool, more threads just make the queue longer, so I check a thread dump first.
About this answer
- Last updated
- 12 November 2026
- 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
- Spring Boot reference
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 "Explain server.tomcat.threads.max, server.tomcat.accept-count and...": https://scrivio-interview-library.netlify.app/spring-boot/embedded-servers/1bf8f4c3ab/