aspose file tools*
The moose likes Tomcat and the fly likes Optimizing Tomcat for heavy load Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Tomcat
Bookmark "Optimizing Tomcat for heavy load" Watch "Optimizing Tomcat for heavy load" New topic
Author

Optimizing Tomcat for heavy load

shiva sarna
Greenhorn

Joined: Jul 23, 2006
Posts: 23
Hi,

I am working with tomcat 5.5.17 and am invloved in increasing the performance of a web application.

I have identified database connections as the bottleneck have taken measures to slove the problem as follows.

1. While trying to hit the server with 500 simultaneous users I have changed the parameter of connector as follows:

<Connector port="8080" maxHttpHeaderSize="8192" maxProcessors="150"
maxThreads="200" minSpareThreads="25" maxSpareThreads="75"
maxKeepAliveRequests="1" enableLookups="false" redirectPort="8443" acceptCount="200"
connectionTimeout="0" disableUploadTimeout="true"
moveAbandoned="true" removeAbandonedTimeout="300"/>


If I am expecting 500 users to hit my server I make the total count of maxSpareThread,maxThreads,minSpareThread and acceptCount to 500 i.e all these 4 parameters add upto 500.

2) I have also made my connection pool large enough to handle 500 threads ( I am using JNDI for connection pooling).

My questions are:

1) Is this approach right?.

2) How can I further optomize my tomcat?.

3)Can you please refer any documentation which can help me with this. At present I refer to apache tomcat website for help http://tomcat.apache.org/.

4) Please suggest any open source tools which can help me view how much time tomcat takes to process each request and other usefull informations. At present I am using Jmeter to load test the web application.

thanks for your time and help.

regards

shiva


SCJP 5.0
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12835
    
    5
I have also made my connection pool large enough to handle 500 threads

I'm no JDBC expert but I suspect that is a bad idea since each connection takes a lot of resources. Perhaps you should start with a smaller pool and see what happens.

Avoiding DB queries as much as possible by using a cache of recent / common results is something to look into. I suspect that devoting memory to a cache is more productive than using it for more connections.

Bill
shiva sarna
Greenhorn

Joined: Jul 23, 2006
Posts: 23
Thanks Bill for your prompt reply.

I did try making connection pool small but I got an error that the thread pool is exhausted.

regards

shiva
[ January 29, 2007: Message edited by: shiva sarna ]
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12835
    
    5
error that the thread pool is exhausted.


Well, if all the request threads are busy trying to do DB requests they will certainly not be available for new requests but I dont see what this has to do with the number of DB connections in the pool.

Think about the database side - what is the capacity of your database for handling simultaneous connections?

If this was my problem I think I would adjust the DB connection pool size to the capacity of the DB. In the web app I would provide for recognizing that all connections are busy and sending a messge to that effect to the client, possibly with some sort of automatic retry.

Bill
Perry McKenzie
Greenhorn

Joined: Jul 16, 2003
Posts: 23
I know one thing we ran into with big loads on tomcat servers was making sure we had enough available file handles available on the box. We actually had to increase the number of available file handles to 8k to make things happy.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Optimizing Tomcat for heavy load