• Post Reply Bookmark Topic Watch Topic
  • New Topic

Simultaneous requests handled by tomcat  RSS feed

 
Abhimanyu Jain
Ranch Hand
Posts: 151
1
Eclipse IDE Java MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Could you please let me know how many requests tomcat can handle simultaneously?

Thanks in advance!!
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13078
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There is a configuration variable that sets the number of Threads allocated for handling requests. One Thread handles one request/response cycle.

The last time I looked a typical value was 150. Obviously this is something that can be tuned according to what the applications require.

Bill
 
Abhimanyu Jain
Ranch Hand
Posts: 151
1
Eclipse IDE Java MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you for your response.

Can we find it in the configuration file? Is the configuration file located somewhere in tomcat?
 
Ivan Jozsef Balazs
Rancher
Posts: 999
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
.../conf/server.xml
 
Abhimanyu Jain
Ranch Hand
Posts: 151
1
Eclipse IDE Java MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you!!

I got it. It says 150 maximum number of threads. But the entire section has been commented out. Why is it so?
 
Tim Holloway
Bartender
Posts: 18715
71
Android Eclipse IDE Linux
  • Likes 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Actually, the stock server.xml has 2 elements which illustrate maxThreadCount.

One is for use with a named thread pool, which allows several Tomcat Connectors to share a single thread pool instead of each constructing and using their own.

The other is a maxThreadCount on the model https Connector (port 8443).

The actual maxThreadCount by default is 200, so with non-shared thread pools and having uncommented the https Connector, you'd be able to handle 200 threads coming in on port 8080 (the default) and 150 from traffic coming in on port 8443 (specified by maxThreadCount on its Connector element).

You can actually have even more concurrent incoming requests, but after the processor thread pools are exhausted, the subsequent requests queue up waiting for a free thread until the number of queue slots defined by the Connector's "acceptCount" attribute are filled. The default for acceptCount is 100. So on port 8080, by default, if you have 300 or more simultaneous requests (pool size + acceptCount queue size), the later requests will be bounced back to the client with a "connection refused" error.

This is a lot of requests, so if you even think you're in danger of exceeding that many, it's probably a good idea to set up a multi-server cluster with some sort of load-balancing. And, of course, make sure the apps spend as little time processing as possible. Definitely no long-running SQL operations in the request-handling logic, for example. Not that that's a good idea, regardless.
 
Abhimanyu Jain
Ranch Hand
Posts: 151
1
Eclipse IDE Java MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you for sharing this valuable information.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!