tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Apache Wiki <wikidi...@apache.org>
Subject [Tomcat Wiki] Update of "HowTo" by KonstantinKolinko
Date Sat, 02 Feb 2013 22:22:43 GMT
Dear Wiki user,

You have subscribed to a wiki page or wiki category on "Tomcat Wiki" for change notification.

The "HowTo" page has been changed by KonstantinKolinko:
http://wiki.apache.org/tomcat/HowTo?action=diff&rev1=126&rev2=127

Comment:
Rewrite the recipe on Tomcat memory configuration. Use CATALINA_OPTS instead of JAVA_OPTS.

  ADS insists that the CN of every group be unique, but the Manager app. always uses the group
CN=manager.  The default can be changed, but it's hard to find and you have to do it over
every time you upgrade.  Instead, pick an attribute other than the common name -- for example,
"description" -- that doesn't have to be unique, name it as the `RoleName` attribute of the
`Realm` (in server.xml, which you'll be editing anyway), and set that  attribute to "manager"
in each group you create.  Create an OU for each Tomcat instance's groups and give that OU's
DN as the `RoleBase` in that instance's server.xml.  Create a uniquely-named group in each
instance's OU with the chosen attribute ("description" for example) set to "manager".
  
  == Where and how do I set memory related settings to improve Tomcat performance? ==
- When your web application is using large memory as this memory size default setting can
be too small, 64MB by default,thus the application becomes slower because the garbage collector
is invoked more often, and it can even run out of memory (outofmemory / heap space error ).
One way to address this problem is to set a larger heap size . In Windows system, this can
be done by editing / adding JAVA_OPTS variable (should be early in the file) in CATALINA_HOME/bin/catalina.bat
or catalina.sh for Linux/Unix systems.Parameters to be added are , let say you want to increase
it to 256 MB (as you required but make sure you have enough amount of physical memory/RAM
and for 32bit system , use no more than 1-1.1 GB heap space size ) , use '-Xms256m -Xmx256m'
.In some cases , it is better to set slightly lower size for -Xms . There are other parameters
can be added , some of them :{{{'-XX:MaxNewSize -XX:NewSize -XX:MaxPermSize'}}} , depending
on your application and requirements .
+ When your web application is using large memory as this memory size default setting can
be too small. One way to address this problem is to set a larger heap size.
  
- For catalina.bat there now should be a line in the file that looks like this:  {{{ set JAVA_OPTS=-Xms256m
-Xmx256m }}}
+ If you start Tomcat by using the standard '''script files''' (such as `CATALINA_HOME/bin/catalina.bat`
or `catalina.sh`), this can be done by setting `CATALINA_OPTS` environment variable. The recommended
way to do so is to create a `setenv.bat` or `setenv.sh` file, &mdash; read [[http://tomcat.apache.org/tomcat-7.0-doc/RUNNING.txt|RUNNING.txt]]
for details.
  
- For catalina.sh:  {{{ JAVA_OPTS='-Xms256m -Xmx256m' }}}
+ Let say you want to increase it to 256 MB (as you required but make sure you have enough
amount of physical memory/RAM and for 32bit system, use no more than 1.0-1.1 GB heap space
size ). Set the `CATALINA_OPTS` to the value of {{{-Xms256m -Xmx256m}}}. In some cases it
is better to set slightly lower size for `-Xms`.
  
- For other parameters , go to * http://wiki.apache.org/tomcat/FAQ/Memory * http://wiki.apache.org/tomcat/OutOfMemory
+ For `setenv.bat` use the following line:  {{{ set CATALINA_OPTS=-Xms256m -Xmx256m }}} <<BR>>
+ For `setenv.sh` use the following:  {{{ CATALINA_OPTS='-Xms256m -Xmx256m' }}}
  
- and Google and Yahoo are your friends.
+ There are other parameters that can be added, depending on your application and requirements,
e.g: {{{'-XX:MaxPermSize'}}}.
+ 
+ For other parameters, look at the following pages:
+ 
+  * [[FAQ/Memory]]
+  * [[OutOfMemory]]
+ 
+ If you are running Tomcat as a '''Windows service''', then environment variables and `setenv.bat`
script have no effect. The relevant settings for the service wrapper application are stored
in the Windows registry. They can be edited via Configuration application (`tomcat<N>w.exe`).
See "Java" tab in the configuration dialog. The`-Xms` and `-Xmx` options are configured in
fields named "Initial memory pool" and "Maximum memory pool". Other options can be added to
"Java Options" field as if they were specified on the command line of java executable.
  
  == How do I make my web application be the Tomcat default application? ==
  Congratulations.  You have created and tested a first web application (traditionally called
"mywebapp"), users can access it via the URL "http://myhost.company.com/mywebapp".  You are
very proud and satisfied.   But now, how do you change the setup, so that "mywebapp" gets
called when the user enters the URL "http://myhost.company.com" ?

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


Mime
View raw message