Backend Development 3 min read

Understanding Tomcat Embedded Core Thread Model: Acceptor, Poller, and Worker Threads

This article explains Tomcat’s embedded core thread architecture, detailing the roles of Acceptor, Poller, and worker threads, their interaction with TCP connection queues, and how network I/O and large responses are processed, supplemented with code excerpts and diagrams.

Cognitive Technology Team
Cognitive Technology Team
Cognitive Technology Team
Understanding Tomcat Embedded Core Thread Model: Acceptor, Poller, and Worker Threads

Based on tomcat-embed-core 9.0.60 with the default Http11NioProtocol , the article outlines the three critical thread types in Tomcat: Acceptor Thread (accepts client connections), Poller Thread (polls network I/O events and manages an event queue), and the business processing thread pool.

The Acceptor Thread uses a blocking listening socket whose TCP full‑connection queue size can be configured. Accepted client connections are placed into the Poller Thread’s event queue, awaiting processing.

Relevant source code for starting the Acceptor Thread:

protected void startAcceptorThread() {
    acceptor = new Acceptor<>(this);
    String threadName = getName() + "-Acceptor";
    acceptor.setThreadName(threadName);
    Thread t = new Thread(acceptor, threadName);
    t.setPriority(getAcceptorThreadPriority());
    t.setDaemon(getDaemon());
    t.start();
}

Clients then enter the Poller Thread’s event queue, as illustrated by the following diagrams:

The Poller Thread follows the Reactor model, handling the event queue and network I/O events. The corresponding source method is:

org.apache.tomcat.util.net.NioEndpoint.Poller#run

Network I/O handling may delegate to the business thread pool for asynchronous execution, as shown in the method:

org.apache.tomcat.util.net.AbstractEndpoint#processSocket

Each thread type has an associated queue: the Acceptor Thread’s queue is the TCP full‑connection queue, while the TCP half‑connection queue size can be tuned via OS settings. The Poller Thread’s queue also registers write events when a response exceeds the write buffer capacity, allowing the data to be written in subsequent polls.

Additional diagrams illustrate the TCP three‑way handshake, half‑ and full‑connection queues, and the flow of data through Tomcat’s threading model.

backendTomcatThread modelAcceptor ThreadPoller Thread
Cognitive Technology Team
Written by

Cognitive Technology Team

Cognitive Technology Team regularly delivers the latest IT news, original content, programming tutorials and experience sharing, with daily perks awaiting you.

0 followers
Reader feedback

How this landed with the community

login Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.