When you set the TOMCAT_HOME and JAVA_HOME variables, also set a third 
variable called TOMCAT_OPTS with the value -Xms256m to up your initial heap 
size.  This sets your initial memory allocation for the JVM that Tomcat 
runs from.  I'm running a system with almost identical specs to yours and 
have "TOMCAT_OPTS=-server -Xms64m -Xmx192m".  This swaps the JVM for the 
server version of HotSpot (which is said to be more appropriate for 
persistent applications which don't require an optimized startup), sets the 
base memory allocation to 64Mb, and the maximum memory allocation to 
192Mb.  Oracle uses a huge amount of memory, so you probably don't want to 
set your initial heap size too high.

Also check out http://java.sun.com/docs/hotspot/VMOptions.html to see the 
full set of options you have available for tweaking your virtual machines.

Shaun

At 01:00 PM 8/25/2001 +1000, you wrote:
>I run Linux/Apache/Tomcat plus Oracle on a server with 512Mb of memory. I
>have successfully implemented a couple of Internet applications using JSP,
>Servlets (plus Oracle) etc.
>
>For each application (and client) I start a new Tomcat session, using a
>custom server.xml for each one. All was ok, until I tried increasing Tomcat
>sessions from 6 to 7, then I received the java.lang.OutOfMemoryError when
>starting the Tomcat sessions.
>
>I've read through many of the posts on this subject, some of which suggest
>to increase the "heap" size. Unfortunately, I'm a newbie to Java (and Linux
>and JSP and Oracle <g>) so I don't know how to either check this heap size,
>nor how to permanently set it to a value via a script using a switch
>like -Xms256m.
>
>The script I use to start Tomcat follows, plus the console output. Could
>anyone advise how to set the heap please?
>
>
>Many thanks,
>
>Max Hugen   [EMAIL PROTECTED]
>Hugen Enterprises Pty Ltd, Sydney, Australia
>www.hugen.com.au
>Internet Application Developers
>
> >>>>>>>>>Script Start>>>>>>>>
>echo "~~~~~~~~Tomcat Startup ~~~~~~~~~~~~~"
>echo "Start an instance of Tomcat for hugen"
>/usr/local/tomcat/bin/startup.sh -f /usr/local/tomcat/conf/server_he.xml
>echo "Start an instance of Tomcat for yass3i"
>/usr/local/tomcat/bin/startup.sh -f /usr/local/tomcat/conf/server_yass3i.xml
>echo "Start an instance of Tomcat for isp"
>/usr/local/tomcat/bin/startup.sh -f /usr/local/tomcat/conf/server_isp.xml
>echo "Start an instance of Tomcat for im2000i"
>/usr/local/tomcat/bin/startup.sh -f
>/usr/local/tomcat/conf/server_im2000i.xml
>echo "Start an instance of Tomcat for secure"
>/usr/local/tomcat/bin/startup.sh -f /usr/local/tomcat/conf/server_secure.xml
>echo "Start an instance of Tomcat for aedo"
>/usr/local/tomcat/bin/startup.sh -f /usr/local/tomcat/conf/server_aedo.xml
>echo "Start an instance of Tomcat for ncap"
>/usr/local/tomcat/bin/startup.sh -f /usr/local/tomcat/conf/server_ncap.xml
># Give Tomcat time to start before restarting Apache.
>echo "Waiting 45 secs..."
>sleep 45
># Restart Apache to register Tomcat properly.
>echo "Restart Apache"
>/etc/rc.d/init.d/httpd stop
>/etc/rc.d/init.d/httpd start
>sleep 2
>echo "Ok, we should be in business!"
> >>>>>>>>>Script End>>>>>>>>
>
> >>>>>>>>>Console Output Start>>>>>>>>
>Starting tomcat. Check logs/tomcat.log for error messages
>Starting tomcat. Check logs/tomcat.log for error messages
>Starting tomcat. Check logs/tomcat.log for error messages
>Starting tomcat. Check logs/tomcat.log for error messages
>Starting tomcat. Check logs/tomcat.log for error messages
>Starting tomcat. Check logs/tomcat.log for error messages
>Starting tomcat. Check logs/tomcat.log for error messages
>
>Restart Apache
>
>Exception in thread "main" java.lang.OutOfMemoryError: unable to create new
>native thread
>         at java.lang.Thread.start(Native Method)
>         at
>org.apache.tomcat.util.ThreadPool$ControlRunnable.<init>(ThreadPool.java:465
>)
>         at
>org.apache.tomcat.util.ThreadPool.openThreads(ThreadPool.java:360)
>         at org.apache.tomcat.util.ThreadPool.start(ThreadPool.java:148)
>         at
>org.apache.tomcat.service.PoolTcpEndpoint.startEndpoint(PoolTcpEndpoint.java
>:245)
>         at
>org.apache.tomcat.service.PoolTcpConnector.start(PoolTcpConnector.java:188)
>         at
>org.apache.tomcat.core.ContextManager.start(ContextManager.java:527)
>         at org.apache.tomcat.startup.Tomcat.execute(Tomcat.java:202)
>         at org.apache.tomcat.startup.Tomcat.main(Tomcat.java:235)
>
>Exception in thread "main" java.lang.OutOfMemoryError: unable to create new
>native thread
>         at java.lang.Thread.start(Native Method)
>         at
>org.apache.tomcat.util.ThreadPool$MonitorRunnable.<init>(ThreadPool.java:382
>)
>         at org.apache.tomcat.util.ThreadPool.start(ThreadPool.java:149)
>         at
>org.apache.tomcat.service.PoolTcpEndpoint.startEndpoint(PoolTcpEndpoint.java
>:245)
>         at
>org.apache.tomcat.service.PoolTcpConnector.start(PoolTcpConnector.java:188)
>         at
>org.apache.tomcat.core.ContextManager.start(ContextManager.java:527)
>         at org.apache.tomcat.startup.Tomcat.execute(Tomcat.java:202)
>         at org.apache.tomcat.startup.Tomcat.main(Tomcat.java:235)
>
>Shutting down Web Service: httpd
>
>/etc/rc.d/init.d/httpd: fork: Resource temporarily unavailable
>  Web Service: /usr/sbin/httpd
>
> >>>>>>>>>Console Output End>>>>>>>>

Reply via email to