You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Stefan Frei <st...@gmail.com> on 2016/05/06 12:11:29 UTC

setting jvm parameters to optimize production performance

Tomcat 8.0.33
Debain jessie
java 8

Hello

i cannot find any resources how to set configure the setenv.sh for a
production environment.

Does somebody have some tips?

Best regards

Stefan

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


Re: setting jvm parameters to optimize production performance

Posted by "André Warnier (tomcat)" <aw...@ice-sa.com>.
On 06.05.2016 14:11, Stefan Frei wrote:
> Tomcat 8.0.33
> Debain jessie
> java 8
>
> Hello
>
> i cannot find any resources how to set configure the setenv.sh for a
> production environment.
>
> Does somebody have some tips?
>

You have not been looking very hard.
How about this for a start :

http://tomcat.apache.org/
-> Problems ? -> FAQ
which leads to :
http://wiki.apache.org/tomcat/FAQ
and more specifically :
- http://wiki.apache.org/tomcat/FAQ/Performance_and_Monitoring
and
- http://wiki.apache.org/tomcat/FAQ/Troubleshooting_and_Diagnostics

and then, consider the following set of tips :

1) the standard parameters with which Tomcat is configured "out of the box" are already 
chosen by the Tomcat developers (who presumably know what they are doing), so as to cover 
a "reasonable" Tomcat setup and workload.
So don't forget this, and don't start changing things all over the place, before you even 
know if there is a problem.

2) before you change anything, make sure that you have a *reason* to change it. Do you 
really have a problem ? How do you know that ?
Have you *measured* the problem ?
If you go to a support mailing list, and you just say "my Tomcat is slow", nobody will be 
able to help you.

3) before you change any parameter (and there are many), make sure that you really 
understand what this setting does.  Really.  Read the on-line documentation about it, 
there is a lot available (like the links above).

4) before you change any parameter (and there are many), make a backup of the previous 
settings.

5) Tomcat is Java code, which runs inside a Java Virtual Machine (JVM), which itself runs 
under an Operating System, which itself runs on a hardware box.
All of these have configuration parameters (yes, even the box : it has physical RAM, one 
or more CPUs, faster or slower disks, faster or slower network connections).
If you really have a problem, is it really a problem with Tomcat, or is it a problem with 
the network connection, or a problem with the box on which Tomcat runs, or a problem of 
the JVM under which Tomcat runs ?

Assuming that you have read and done all the above,

6) if you start changing parameters, do it one parameter at a time, and then look at the 
result and measure again.  And if it does not help, go back to the previous configuration, 
and read the documentation again, because you obviously thought that it was going to help, 
and it didn't. So you must have missed something.
Changing multiple parameters at the same time - except if they are somehow related - is a 
good recipe for not understanding anything at all anymore.



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


Re: setting jvm parameters to optimize production performance

Posted by Olaf Kock <to...@olafkock.de>.

Am 06.05.2016 um 14:11 schrieb Stefan Frei:
> Tomcat 8.0.33
> Debain jessie
> java 8
>
> Hello
>
> i cannot find any resources how to set configure the setenv.sh for a
> production environment.
>
> Does somebody have some tips?
*How* to set them?

CATALINA_OPTS="-your -parameters -here"

*Which* ones to set?

It depends. Some applications are memory bound, some are CPU- or I/O
bound. You want to check your applications and user profiles, then make
an initial guess (e.g. about memory settings). Monitor the running
system and ideally have a load test.
In that load test:

* Identify bottleneck #1
* Fix it
* Measure again
* Find out that bottleneck #2 has been promoted to #1
* Rinse/Repeat.

There are no serious recommendation for initial settings as every
application has a different profile.

Generic tipps though:

* Make -Xmx the same as -Xms (to allocate all memory immediately - no
use to run out of OS memory sunday night at 3:00, rather detect this
condition upon server start)
* Make sure you're not using virtual memory (swap space) if you care for
performance
* Start with "minimum memory" for your application / load profile, add a
safety margin - rather than starting with the available RAM and
subtracting a safety margin: You want garbage collection to be
relatively often but quick - rather than rarely and with long duration.

Hope that helps,
Olaf

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


Re: setting jvm parameters to optimize production performance

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

Stafan,

On 5/6/16 8:11 AM, Stefan Frei wrote:
> Tomcat 8.0.33 Debain jessie java 8
> 
> Hello
> 
> i cannot find any resources how to set configure the setenv.sh for
> a production environment.
> 
> Does somebody have some tips?

Just turn off the "suck bit" and you'll be fine:

bin/setenv.sh:

export CATALINA_OPTS="${CATALINA_OPTS} -Dapplication.suck=false"
export CATALINA_OPTS="${CATALINA_OPTS} -Djava.lang.gofast=true"

bin/startup.sh and you are ready to roll.

- -chris
-----BEGIN PGP SIGNATURE-----
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iEYEARECAAYFAlcsorYACgkQ9CaO5/Lv0PBXUACfS0uvMJaaZeWxpmgNUOIwMhrx
Qf4AmwTiO8LFANNzTJNLuy0xEX+8VkKP
=J+sJ
-----END PGP SIGNATURE-----

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


Re: setting jvm parameters to optimize production performance

Posted by Aurélien Terrestris <at...@gmail.com>.
Hi Stefan

I think that tuning should be considered for one application, not for
"production" or "development".

First, you need to check how your JVM is working with its memory
parameters. You can either learn its behaviour by checking the logs ( add
this to the setenv : -XX:+PrintGCDetails -XX:+PrintGCTimeStamps -verbose:gc
) or with the jstat command (example for 60 seconds checking jstat -gcutil
-h 60 31220 60s 60)

With that you know if it is garbaging often, and on which part of the JVM.
You can send us your results, I suppose we not have the same ideas here on
the mailing list.

Second, it is needed to know your application well. For example, does it
cache objects ? Or does it only calculates data and send it to the client ?

regards
A.T.






2016-05-06 14:11 GMT+02:00 Stefan Frei <st...@gmail.com>:

> Tomcat 8.0.33
> Debain jessie
> java 8
>
> Hello
>
> i cannot find any resources how to set configure the setenv.sh for a
> production environment.
>
> Does somebody have some tips?
>
> Best regards
>
> Stefan
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>