File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Optimizing Tomcat for heavy load

 
shiva sarna
Greenhorn
Posts: 23
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13045
6
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 23
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 13045
6
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 23
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic