Print

Technical Articles

The Meaning of Maximum Number of Threads on WAS
[ Name: 제니퍼소프트, Date: 07-05-06 07:23:28 ] ( ko ja en )

Let’s explore the effect of increasing maximum thread count in web application server (WAS).

Let’s take look at the water funnel below as an example.

In a given time period, the amount of water in the funnel depends on the rate of water poured in and the rate of water funneled out. The water, in our case, is the active services count.

Increasing the maximum active service thread in WAS is can be described with the following diagram.

It is like making the funnel body longer or wider without actually effecting stem of the funnel. Is there any performance improvement here? No, since the funnel performance is measured by the rate of water flow, only improvement is that the funnel can hold more water before it over-flows when the rate of water coming in exceeds the rate of water funneled out. The rate of water outflow is controlled by the funnel stem only (assuming that gravity does not play a role here). In this senario, increasing the maximum thread count in WAS improves the queue size for active services waiting to be processed, but it does not improve the overall performace of the system which is the rate that system processes the incoming active service requests.

So, How do you widen the funnel stem in context of WAS administration? Widening the funnel stem means improving application’s overall ability to process the incoming requests. the stem of the funnel can be expressed as the bottle neck of the system. For example, if the DB is experiencing performance problem and it cannot provide data to the application fast enough, then DB is the bottleneck of the system. While DB sends and receives data, other components that are not experiencing performance issue have to wait for their turn to be serviced by the DB, causing increase in service response time. To improve response timel, the bottleneck must be removed. Solution can be tuning inefficient query or upgrading to faster DB hardware etc…

When should active service thread count for WAS be increased and by how much should it be increase? Please look at the next diagram.

As you can see above, active service thread count should be increased when it is narrower than the funnel stem, and it should be increased to match the funnel stem width, the rate of system processing the active services. How do you calculate the rate of system processing active services? The rate of system processing active services is measured in TPS. The active service count should be set at the point where highest TPS is recorded. For example, in a system with DB and WAS, as the number of incoming request increase, if the performance problem occurs in DB first, then even if the active service count is gradually increased, there will be a point where the throughput(TPS) will no longer increase due to DB capacity limit. The point where the throughput no longer increases despite continual increase in active service thread count should be the max thread count. Increasing the active service thread count more than this point is not recommend. If active service thread count is set too high, system can suffer from negative effect such as thread context switching, hindering the system process ability. On the flip side, if the service processing speed is extrememly high, then there should be no need for high active service thread count, since the incoming active service requests are processed immediately without delays. When the service processing speed is high, the active service thread count should be set low.

Won Young Lee

Filename Title Size
1.gif 23,858 Bytes
4.gif 45,811 Bytes
2.gif 39,390 Bytes
tt1.gif 21,835 Bytes
3.gif 18,360 Bytes
tt2.gif 46,544 Bytes
4.gif 48,643 Bytes