Paul, Subhro wrote:
-----Original Message-----
From: Konstantin Kolinko [mailto:knst.koli...@gmail.com]
Sent: Sunday, March 29, 2015 5:59 PM
To: Tomcat Users List
Subject: Re: Tomcat server Performance imporvement required
Email sent from outside of PSEG. Use caution before using links/attachments.
2015-03-29 9:52 GMT+03:00 Paul, Subhro <subhro.p...@pseg.com>:
Dear Team,
I am an application developer from TCS and working for PSEG
(https://www.pseg.com).
You might have seen my queries which I forwarded on 12 Feb, 2015 for Tomcat
server crashing issue. After that we have added some resources to the servers.
Now we have two Tomcat6 servers each one is having 16GB of RAM and 8CUPS. All
server are Linux 6.5 64 bit OS.
As per application architecture we have two Apache Proxy servers and two Tomcat
servers. Also we have two loadbalancers, one for Proxy loadbalancing and another for
Tomcat loadbalancing. So, when request comes that comes to proxy loadbalncer first
then Apache Proxy server -> Tomcat loadbalancer -> Tomcat server.
Some days back on 19th and 23rd of March another incident occurs when server
faced some issues again. This time none of the servers where crashed but for
some highly used pages in the site, Apache proxy server started complaining
Timeout which is 60 seconds. After googling we thought we could increase the
Time out in Proxy but client don't accept that.
So we need some tuning parameters on Tomcat server for better performance.
Below are some of the setting parameters from actual server. Ports are masked.
Initializing param:
JAVA_OPTS="${JAVA_OPTS} -Xms1024M -Xmx1024M"
CATALINA_OPTS="${CATALINA_OPTS} -Xms1024M -Xmx1024M"
Memory options should go into CATALINA_OPTS only, not both.
If you are using a 64-bit JVM, it needs more memory than a 32-bit JVM
would need, as object pointers require more memory.
<...>
Best regards,
Konstantin Kolinko
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org
Dear Team,
Thanks for your replies.
We are going to increase the heap size of CATALINA to 4GB like
CATALINA_OPTS="${CATALINA_OPTS} -Xms4096M -Xmx4096M".
Is it required to increase the maxThread count also as we are increasing the
heap size? As of now the this parameter is as below:
maxThreads="512"
The size of the heap and the number of threads available to process transactions may have
a relationship with eachother, but it is indirect, and you do not "have to" modify them in
parallel.
In other words :
- the maxThreads parameter specifies how many independent threads (think "agents") Tomcat
may start and have running at the same time, each one of them usually processing one HTTP
request from one client. It should be commensurate thus to how many HTTP requests you
expect your server to have to service simultaneously at any given moment in time.
Which itself is a factor of :
- how many new requests your server is expected to receive over a given period
of time
- and how long each request takes on average to be serviced by your server
Suppose that you expect 1000 new requests to arrive within 1 second.
And suppose that it takes on average 0.5 s to service one request.
Then you would need approximately 500 threads to do the job.
(Because the 1st request would be allocated to the first thread, etc. And after 0.5 s, the
first thread would be free again, so it could handle the 501st request and so on).
Conversely, if it took on average 2 s to process one request, then you would need 2000
threads to handle the load (because after 1 s, 1000 threads would be busy for at least
another second, but 1000 new requests will arrive during that next second.)
- each of these threads will use some capacity in the Heap. So if you have 1000 possible
threads active at some moment, it is likely that this will use up more Heap capacity than
if you had only 500.
And finally, memory is not the only thing which each thread is using; it also uses CPU
time, and there is always a limit somewhere, depending on the total resources of your system.
As mentioned before, the only way to actually find out what is optimal for your system, is
to monitor what actually is happening during a normal workload.
If the size of the Heap is not comfortable enough for the number of threads running in
your application, the JVM will start performing more frequent Garbage Collections to free
space on the Heap more often. This in itself uses up some processing capacity and thus
slows down your server, which may have the result of increasing the number of threads
active, which may have the result of increasing the demand on memory in the Heap, etc..
A general remark : starting to play around with such parameters is a real waste of time,
if you do not at least have some real-world measurements to back up your changes.
There is no general rule, it all depends on your particular circumstances.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org