You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Bruce Foster <gi...@gmail.com> on 2009/11/18 15:48:09 UTC

Newbie, tomcat performance tuning

HI,

I'm new to the list and tomcat.


I have a web application deployed in tomcat 6. this application is
quite CPU hungry and I would like to optimise the tomcat accordingly.

I'm expecting to have 200 concurrent connections to the server at
peak, not much for a standard web application but ours is imagery
based and bit resource hungry.

Can you guide me where and what parameters that  I can tweak in tomcat
to get high performance? for eg, JVM memory, threads, etc etc



My server configuration;

tomcat 6.0
2 x quard core xenon processor (8 core)
12 GB ram
SAS Dirve (15k rpm), RAID
Windows 2003 server, 64 bit
NO other application running on this server.


-- 
Thanks

Bruce
NSW Australia

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


RE: Newbie, tomcat performance tuning

Posted by Neil Aggarwal <ne...@JAMMConsulting.com>.
Bruce:

> Can you guide me where and what parameters that  I can tweak in tomcat
> to get high performance? for eg, JVM memory, threads, etc etc

Have you seen this page:
http://wiki.apache.org/tomcat/FAQ/Performance_and_Monitoring

	Neil

--
Neil Aggarwal, (281)846-8957, http://UnmeteredVPS.net
Host your tomcat app on a CentOS VPS for only $25/month!
Unmetered bandwidth, 7 day no risk trial, Google Checkout


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Newbie, tomcat performance tuning

Posted by David kerber <dc...@verizon.net>.
Caldarale, Charles R wrote:
>> From: Bruce Foster [mailto:gis.foster@gmail.com]
>> Subject: Re: Newbie, tomcat performance tuning

...

> 
>> read somewhere tomcat with 8 thread (8 core processor), how do I
>> configure that option?
> 
> Read Peter's response.  You will need way more than 8 threads in any real-world environment.  The JVM will use as many cores as are available.

For sure:  I normally keep 30 to 50 working on a 4-core machine.  A few 
are always waiting for something (disk write, http socket, etc) of 
course, but not for long.

D


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


RE: Newbie, tomcat performance tuning

Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: Bruce Foster [mailto:gis.foster@gmail.com]
> Subject: Re: Newbie, tomcat performance tuning
> 
> 1. Need to get JDK and not JRE, latest version of JDK and use the
> "server" version

Tomcat only needs the JRE, but the JDK contains some interesting tools that you may find useful.  Make sure you get a 1.6 or later level of either.  If you're running on a 64-bit platform, use the 64-bit JRE/JDK.  If you do use a 64-bit JVM, only the server mode is available.

> 2. Look at the connector pool

The above is ambiguous, since it could refer to either the HTTP/HTTPS connector, or database connections.

> 3. Need to modify the heap size, with 12GB ram and NO other
> application running I will allocate 6GB ram as Max and Min for JVM.

You cannot set the heap anywhere near that large unless you're running on a 64-bit JVM.

> do I need to look at the server threads? if yes then where to I set
> that option?

In the <Connector> or <Executor> elements in server.xml.

> read somewhere tomcat with 8 thread (8 core processor), how do I
> configure that option?

Read Peter's response.  You will need way more than 8 threads in any real-world environment.  The JVM will use as many cores as are available.

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Newbie, tomcat performance tuning

Posted by Peter Crowther <pe...@melandra.com>.
2009/11/19 Bruce Foster <gi...@gmail.com>

> do I need to look at the server threads? if yes then where to I set
> that option?
>
> read somewhere tomcat with 8 thread (8 core processor), how do I
> configure that option?
>
> If you can find me that "somewhere", I'll go and grumble at the author
:-).  It's very poor advice unless your web application is 100% CPU-bound,
doing no I/O (including sending no output over HTTP) and no database
accesses.

For realistic loads, some will be waiting on I/O to database, sending data
to the browser etc..  The actual number of threads you want is therefore
higher, depending on your own web application - and the only way to find out
is to profile.

Setting the number of threads too high costs you a little bit of CPU (so the
scheduler can account for them) and a little bit of RAM (for their stacks
and other data structures).  Setting the number of threads too low costs you
failed requests from your users, up to and including the server appearing to
be down because it's got backed up handling incoming requests, despite
having enough RAM and CPU.  If you're not sure what to do, keep the threads
unchanged; if you *have* to alter it, prefer higher rather than lower unless
you can demonstrate that it will cause RAM or CPU issues to do so.

- Peter

Re: Newbie, tomcat performance tuning

Posted by Hassan Schroeder <ha...@gmail.com>.
On Thu, Nov 19, 2009 at 4:27 AM, Bruce Foster <gi...@gmail.com> wrote:

> 3. Need to modify the heap size, with 12GB ram and NO other
> application running I will allocate 6GB ram as Max and Min for JVM.

Well, nothing exceeds like excess, but you might want to start a bit
lower and increase as it seems necessary.

Consider that you may need to do debugging, and with a 6GB JVM
a heap dump will be ginormous - trying to load a 5+GB .hprof file on
your desktop system to analyze can be awkward...

/* Note: not a hypothetical issue: I just hit this with an 8GB server
    that OOM'd anyway :-)
 */

FWIW,
-- 
Hassan Schroeder ------------------------ hassan.schroeder@gmail.com
twitter: @hassan

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Newbie, tomcat performance tuning

Posted by Bruce Foster <gi...@gmail.com>.
Thanks Everyone who responded. Just great.

OK, looks like I got lot of home work to do now; if I were to summarize,

1. Need to get JDK and not JRE, latest version of JDK and use the
"server" version

2. Look at the connector pool

3. Need to modify the heap size, with 12GB ram and NO other
application running I will allocate 6GB ram as Max and Min for JVM.

do I need to look at the server threads? if yes then where to I set
that option?

read somewhere tomcat with 8 thread (8 core processor), how do I
configure that option?


Thanks

Bruce





On Thu, Nov 19, 2009 at 3:54 AM, Christopher Schultz
<ch...@christopherschultz.net> wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Bruce,
>
> On 11/18/2009 9:48 AM, Bruce Foster wrote:
>> I'm new to the list and tomcat.
>
> Welcome!
>
>> I have a web application deployed in tomcat 6. this application is
>> quite CPU hungry and I would like to optimise the tomcat accordingly.
>>
>> I'm expecting to have 200 concurrent connections to the server at
>> peak, not much for a standard web application but ours is imagery
>> based and bit resource hungry.
>
> Can you be more specific about what resources your webapp is hungry for?
>
> If a typical request needs 10MiB of memory to process an image, then
> you'll need to make sure that 50MiB * 200 requests = 10GiB of heap space
> is available to your webapp.
>
> Can your webapp handle 200 simultaneous requests? Consider using a
> load-testing tool such as JMeter to see how your webapp performs under
> load. Watch heap usage (in the JVM! 'Task Manager' is not useful, here),
> CPU utilization, disk usage, etc. to see what appears to be your
> limiting resource(s) and then tackle those.
>
> You already know the number of concurrent requests you are expecting at
> peak (200), so you have sort of set that requirement already (though I
> might allocate 225 or 250 just in case you get some bursts in there).
>
> Memory (and GC behavior) is really the only thing you can tune at the
> JVM level. Generally speaking, more heap space is better if you're going
> to need it. Also, setting the min and max heap sizes to the same values
> will avoid heap re-sizing which just wastes time if you know you want
> that memory dedicated to the heap anyway.
>
> Hope that helps,
> - -chris
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.10 (MingW32)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
>
> iEYEARECAAYFAksEUPEACgkQ9CaO5/Lv0PBqMwCfaTsem7ypj+aPTloqlDDKGI69
> zXQAn1UjW0kB5q3RvppuLCjRwT9CJ6YT
> =t0x1
> -----END PGP SIGNATURE-----
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>



-- 
Thanks

Bruce
NSW Australia

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Newbie, tomcat performance tuning

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Bruce,

On 11/18/2009 9:48 AM, Bruce Foster wrote:
> I'm new to the list and tomcat.

Welcome!

> I have a web application deployed in tomcat 6. this application is
> quite CPU hungry and I would like to optimise the tomcat accordingly.
> 
> I'm expecting to have 200 concurrent connections to the server at
> peak, not much for a standard web application but ours is imagery
> based and bit resource hungry.

Can you be more specific about what resources your webapp is hungry for?

If a typical request needs 10MiB of memory to process an image, then
you'll need to make sure that 50MiB * 200 requests = 10GiB of heap space
is available to your webapp.

Can your webapp handle 200 simultaneous requests? Consider using a
load-testing tool such as JMeter to see how your webapp performs under
load. Watch heap usage (in the JVM! 'Task Manager' is not useful, here),
CPU utilization, disk usage, etc. to see what appears to be your
limiting resource(s) and then tackle those.

You already know the number of concurrent requests you are expecting at
peak (200), so you have sort of set that requirement already (though I
might allocate 225 or 250 just in case you get some bursts in there).

Memory (and GC behavior) is really the only thing you can tune at the
JVM level. Generally speaking, more heap space is better if you're going
to need it. Also, setting the min and max heap sizes to the same values
will avoid heap re-sizing which just wastes time if you know you want
that memory dedicated to the heap anyway.

Hope that helps,
- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAksEUPEACgkQ9CaO5/Lv0PBqMwCfaTsem7ypj+aPTloqlDDKGI69
zXQAn1UjW0kB5q3RvppuLCjRwT9CJ6YT
=t0x1
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Newbie, tomcat performance tuning

Posted by David kerber <dc...@verizon.net>.
Caldarale, Charles R wrote:
>> From: David kerber [mailto:dckerber@verizon.net]
>> Subject: Re: Newbie, tomcat performance tuning
>>
>> And set it to run the server-mode jvm rather than the client.
> 
> I believe that all 64-bit JVMs default to server mode, which is why I didn't mention it.  As I recall, the 64-bit JRE doesn't even include a client mode JVM.  (But I'll have to check; I'm stuck on a 32-bit box right now.)

I didn't know that, but haven't looked into it at all; I'm just now 
setting up my first 64-bit machine.

D

> 
>  - Chuck



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


RE: Newbie, tomcat performance tuning

Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: David kerber [mailto:dckerber@verizon.net]
> Subject: Re: Newbie, tomcat performance tuning
> 
> And set it to run the server-mode jvm rather than the client.

I believe that all 64-bit JVMs default to server mode, which is why I didn't mention it.  As I recall, the 64-bit JRE doesn't even include a client mode JVM.  (But I'll have to check; I'm stuck on a 32-bit box right now.)

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Newbie, tomcat performance tuning

Posted by David kerber <dc...@verizon.net>.
Caldarale, Charles R wrote:
>> From: Bruce Foster [mailto:gis.foster@gmail.com]
>> Subject: Newbie, tomcat performance tuning
>>
>> Can you guide me where and what parameters that  I can tweak in tomcat
>> to get high performance? for eg, JVM memory, threads, etc etc
> 
> Other than the number of threads in the <Connector> pool, there's not much you can set in Tomcat that will have any effect on a webapp that's CPU-intensive.  The biggest contributor will be the overall architecture of your webapp, followed by the implementation itself.  For the former, you mostly have to insure that you're not doing the same thing multiple times unnecessarily; for the latter, use a profiler to determine what areas are the most heavily used and optimize those.  Can't really provide any specifics until you instrument the webapp.
> 
> One thing you can do is run a 1.6 JVM, since that is measurably faster (usually) than 1.5.  Of course, make sure it's a 64-bit JVM, since you're on a 64-bit platform.
> 
>  - Chuck

And set it to run the server-mode jvm rather than the client.  This 
makes a BIG difference IME.

D




---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


RE: Newbie, tomcat performance tuning

Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: Bruce Foster [mailto:gis.foster@gmail.com]
> Subject: Newbie, tomcat performance tuning
> 
> Can you guide me where and what parameters that  I can tweak in tomcat
> to get high performance? for eg, JVM memory, threads, etc etc

Other than the number of threads in the <Connector> pool, there's not much you can set in Tomcat that will have any effect on a webapp that's CPU-intensive.  The biggest contributor will be the overall architecture of your webapp, followed by the implementation itself.  For the former, you mostly have to insure that you're not doing the same thing multiple times unnecessarily; for the latter, use a profiler to determine what areas are the most heavily used and optimize those.  Can't really provide any specifics until you instrument the webapp.

One thing you can do is run a 1.6 JVM, since that is measurably faster (usually) than 1.5.  Of course, make sure it's a 64-bit JVM, since you're on a 64-bit platform.

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org