0

I have a tomcat application running on an 8 core system. I observed that when changed maxthread count from 16 to 2 ,there was a dramatic improvement of performance for throughputs of 13 req/sec

So, started printing the active thread count , it seems that when maxthread of tomcat was set to 2 , the active threads on an average for 8 , so basically 8 threads operating on 8 cores , best possible outcome

However, when I increased the throughput to 30-40 req/sec I saw requests queueing up . So , what happened here is that due to only maxthreads 2 requests started piling up .

And when I then set maxThreads to very high value like 10k I saw JVM taking long again context switching .

My question is , is there any property in tomcat wherein I can specify how many requests are to be picked up to process in JVM parallely .

acceptCount property wont help cause it only defines threshold of request up .

There is another property called acceptorThreadCount which is defined as number of threads to be used to accept connections , is this the property I need to tune , or is there any other property , or anything I am missing here?

Manas Saxena
  • 2,171
  • 6
  • 39
  • 58
  • Possible duplicate of [Spring Boot - Limit on number of connections created](https://stackoverflow.com/questions/39002090/spring-boot-limit-on-number-of-connections-created) – Olaf Kock Aug 30 '18 at 12:33

1 Answers1

0

According to the Connector documentation for maxThreads (I'm assuming that this is where you changed your maxThreads configuration):

The maximum number of request processing threads to be created by this Connector, which therefore determines the maximum number of simultaneous requests that can be handled. If not specified, this attribute is set to 200. If an executor is associated with this connector, this attribute is ignored as the connector will execute tasks using the executor rather than an internal thread pool. Note that if an executor is configured any value set for this attribute will be recorded correctly but it will be reported (e.g. via JMX) as -1 to make clear that it is not used.

There's no problem (quite the opposite) setting the thread count to higher than the number of available cores, as not every core always is working (quite often they're waiting for external input, e.g. data from a database).

In case I've missed the point and you change a different maxThreads configuration, please clarify. On the other hand, your question is about the configuration that specifies how many requests are handled in parallel: If you referred to a different maxThreads, then tomcat's default is 200, and it can be changed in the Connector's configuration (or, as the documentation says, with Executors)

Olaf Kock
  • 46,930
  • 8
  • 59
  • 90