How many tomcat threads




















Even if you are using a sharded cluster of nosql servers, does the server farm offer enough bandwidth between those machines? What else will run on the same machine with the web-app server? Anache httpd? Oce you've determined the approx. If you have a load balancer in front of your web application server, set a small acceptCount, it's better for the load balancer to see unaccepted requests and switch to another server than putting users on hold on an already busy one.

This again depends on the kind of load you are expecting. It's even reasonable to have minSpareThreads, maxSpareThreads and maxThreads setup so that an exact number of threads is always ready, never reclaimed, and performances are predictable.

If you are running tomcat on a dedicated machine, you can raise minSpareThreads and maxSpareThreads without any danger of hogging other processes, otherwise tune them down cause threads are resources shared with the rest of the processes running on most OS.

How are we doing? Please help us improve Stack Overflow. Take our short survey. Stack Overflow for Teams — Collaborate and share knowledge with a private group. Create a free Team What is Teams? Collectives on Stack Overflow. Learn more. How to determine the best number of threads in Tomcat?

Ask Question. Asked 12 years, 3 months ago. Active 3 years, 3 months ago. Viewed 18k times. Improve this question. Add a comment. Active Oldest Votes. The value is in ms, default value is ms. If value is negative, threads are not renewed. Links Docs Home Config Ref. Top Level Elements Server Service. Containers Context Engine Host Cluster. Historically there has been a thread pool per connector created but this allows you to share a thread pool, between primarily connector but also other components when those get configured to support executors The executor has to implement the org.

Common Attributes All implementations of Executor support the following attributes: Attribute Description className The class of the implementation. StandardThreadExecutor name The name used to reference this pool in other places in server. On simulating the traffic surge in the test environment it was found that the reason for cpu starvation was improper apache and tomcat configuration. On a sudden increase in traffic, multiple apache workers became busy and a very large number of tomcat threads also got busy.

There was a huge jump in system cpu as none of the threads could do any meaningful work since most of the time cpu would be context switching. Since this was a mid tier service, there was not much use of apache. So, instead of tuning two systems apache and tomcat , it was decided to simplify the stack and get rid of apache. Tomcat has an acceptor thread to accept connections.

In addition, there is a pool of worker threads which do the real work. The high level flow for an incoming request is:. In case the number of tomcat threads and acceptCount values are set to be too high, a sudden increase in traffic will fill up the OS queues and make all the worker threads busy. Here is a recommendation for doing this in practice:.

Estimate the number of threads expected to be busy at peak load. If the server responds back in 5 ms on avg for a request, then a single thread can do a max of requests per second rps.

In case the machine has a quad core cpu, it can do max rps. Now assume that 4 requests since the assumption is that the machine is a quad core come in parallel and hit the machine.

This will make 4 worker threads busy. For the next 5 ms all these threads will be busy. The total rps to the system is the max value of , so in next 5 ms, 4 more requests will come and make another 4 threads busy. Subsequent requests will pick up one of the already busy threads which has become free.

So, on an average there should not be more than 8 threads busy at rps. The behavior will be a little different in practice because all system resources like cpu will be shared. Hence one should experiment for the total throughput the system can sustain and do a calculation for expected number of busy threads.

This will provide a base line for the number of threads needed to sustain peak load. In order to provide some buffer lets more than triple the number of max threads needed to This buffer is arbitrary and can be further tuned if needed.



0コメント

  • 1000 / 1000