This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
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.
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.
Joined: Jul 23, 2006
Thanks Bill for your prompt reply.
I did try making connection pool small but I got an error that the thread pool is exhausted.
Author and all-around good cowpoke
Joined: Mar 22, 2000
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.
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.