For 2023 - we are now fully retired from IT training.
We have made many, many friends over 25 years of teaching about Python, Tcl, Perl, PHP, Lua, Java, C and C++ - and MySQL, Linux and Solaris/SunOS too. Our training notes are now very much out of date, but due to upward compatability most of our examples remain operational and even relevant ad you are welcome to make us if them "as seen" and at your own risk.
Lisa and I (Graham) now live in what was our training centre in Melksham - happy to meet with former delegates here - but do check ahead before coming round. We are far from inactive - rather, enjoying the times that we are retired but still healthy enough in mind and body to be active!
I am also active in many other area and still look after a lot of web sites - you can find an index ((here))
Increasing Java Virtual Machine memory for Tomcat
Q. "How do I increase the memory that my Java Virtual Machine in Tomcat can use?"
A question asked - not for the first time - by a delegate on todays's Deploying Apache httpd and Tomcat
A. Set the JAVA_OPTS environment variable
. Longer answer:
If you're running on a Unix or Linux system, edit the setenv.sh file in Tomcat's bin directory to add in a line like:
export JAVA_OPTS="-Xms128m -Xmx512m"
or on a Windows system, add in to setenv.bat something like:
set JAVA_OPTS=-Xms128 -Xmx512
and restart the Tomcat server.
By default (out of the tar), Tomcat starts up with just 64 Mbytes allocated to the JVM, and that's also it's maximum. This is a very low figure, but it's a sensible default for a new install where the person setting the system up isn't into the tuning of the system.
The two extra parameters specified via JAVA_OPTS are as follows:
-Xms - the amount of memory that the JVM starts with.
-Xmx - the maximum memory that the JVM may have.
I have seen advise (but have no proof) that your should keep the -Xms figure rather lower than the -Xmx figure, since Tomcat uses more memory at startup than when it's running. The result (if you have them set to the same value) is a peak and unnecessary memory demand at startup which in an extreme case can cause a failure.
A couple of other tips:
a) You should consider using the -server
option too to run your JVM in server rather than (default) client mode (actually, they're two different but related VMs). The server that's selected with -server
is slower to load but is said to run faster.
b) We have customers who run multiple instances of Tomcat on the same box (but on different ports) - not a bad idea if you're sharing load between multiple processors. You can front them with httpd using mod-proxy-balance or mod-jk to distribute the requests, but at the same time to provide "sticky sessions" so that a series of requests made by an individual user will all be handled by the same instance. (written 2008-07-24, updated 2008-07-25)
Associated topics are indexed as below, or enter http://melksh.am/nnnn for individual articlesA912 - Web Application Deployment - Upgrading and tuning Tomcat 
Load Balancing with Apache mod_jk (httpd/Tomcat) - (2007-10-02) 
Java CLASSPATH explained - (2008-11-26) 
Database connection Pooling, SSL, and command line deployment - httpd and Tomcat - (2009-03-01) 
Jmeter - a first test case - (2009-03-14) 
Tuning Apache httpd and Tomcat to work well together - (2010-10-27)A901 - Replaced Page 
Apache Tomcat Performance Tuning - (2007-09-29) 
Java - Memory Allocation and garbage collection - (2009-03-14) 
Monitoring and loading tools for testing Apache Tomcat - (2009-07-07)A692 - Web Application Deployment - Monitoring and load testing your server 
Using ApacheBench and jconsole to test and monitor Tomcat - (2009-03-14) 
Logging the performance of the Apache httpd web server - (2010-10-25) 
Apache httpd Server Status - monitoring your server - (2010-10-28) 
Server logs - drawing a graph of gathered data - (2010-11-03)A656 - Web Application Deployment - More Tomcat Configuration 
Short weekend - (2005-04-17) 
Separating 'per instance' data from binaries and web sites - (2005-10-16) 
Virtual Hosting under Tomcat - an example - (2008-11-22)A506 - Web Application Deployment - Java - Installing and Deploying optional Technologies 
Connecting jconsole remotely - the principles - (2009-03-14) 
Gathering information - logging - with log4j. First steps. - (2010-11-12)
Some other Articles
PHP examples - source code and try it out tooPerl 6 - When will we have a production release?Some Ruby lesser used functionsA special day - last Friday in JulyIncreasing Java Virtual Machine memory for TomcatQ - Should I use Perl or Python?Larger applications in PHPPictures from South HampshireHillier Gardens, HampshireWays to accept credit cards - or not!
4759 posts, page by page
Link to page ... 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96 at 50 posts per page
This is a page archived from The Horse's Mouth at
the diary and writings of Graham Ellis.
Every attempt was made to provide current information at the time the
page was written, but things do move forward in our business - new software
releases, price changes, new techniques. Please check back via
our main site for current courses,
prices, versions, etc - any mention of a price in "The Horse's Mouth"
cannot be taken as an offer to supply at that price.
Link to Ezine home page (for reading).
Link to Blogging home page (to add comments).