Backend Development 6 min read

Performance Tuning of Tomcat Connector Parameters for Asynchronous Servlet Applications

This article examines how Tomcat connector settings such as acceptCount, maxConnections, maxThreads, executor, and protocol affect concurrency and throughput in asynchronous servlet environments, and demonstrates tuning steps that significantly improve performance.

Qunar Tech Salon
Qunar Tech Salon
Qunar Tech Salon
Performance Tuning of Tomcat Connector Parameters for Asynchronous Servlet Applications

Background: In a middle‑tier application we used Servlet 3.0 asynchronous support expecting higher concurrency, but stress tests showed no improvement because connection limits prevented requests from reaching worker threads.

Principle: Tomcat consists of a Connector (acceptor queue and Executor) and a Container; a request passes through the acceptor queue, is checked against maxConnections, then handed to the Executor which allocates worker threads.

Key Parameters: acceptCount (backlog length), maxConnections (max simultaneous connections, defaults to maxThreads in BIO mode), executor (ThreadPoolExecutor behavior modified by Tomcat), maxThreads (max worker threads), protocol (BIO, NIO, APR). Their interactions control throughput and blocking.

Application – Default Settings: With asynchronous servlets and mocked backend services, the default Tomcat settings limited throughput to about 140 TPS with 300 threads, because maxConnections equaled maxThreads, preventing full utilization of worker threads.

Application – Tuning maxConnections: Raising maxConnections to 2000 allowed 200 worker threads to stay busy, increasing throughput to roughly 1300 TPS, achieving the expected maximum.

Application – NIO Connector: Switching to an NIO connector reduced the required thread count by about half while keeping similar throughput; however, if the servlet or backend calls are not asynchronous, throughput drops.

Conclusion: Properly adjusting maxConnections, acceptCount, and choosing the appropriate protocol (NIO) can unlock Tomcat’s potential, especially when worker threads are fast; otherwise, reducing these values avoids request queuing and time‑outs.

backendPerformanceConnectorthreadpoolTomcatAsynchronous Servlet
Qunar Tech Salon
Written by

Qunar Tech Salon

Qunar Tech Salon is a learning and exchange platform for Qunar engineers and industry peers. We share cutting-edge technology trends and topics, providing a free platform for mid-to-senior technical professionals to exchange and learn.

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.