You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Matt Burkhardt <ml...@imparisystems.com> on 2008/07/23 23:00:54 UTC

Memory question

Okay - I've gone ahead, uninstalled the distro from Ubuntu, installed
Tomcat 6.0.16 and I'm having problems running out of memory.  My
catalina.out file contains the lines

        at
org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)
        at
org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)
Caused by: java.lang.OutOfMemoryError: Java heap space
 
and the application says it needs 512MB, I have 1GB on the server and it
says that you can use up to 70% of the memory before it gets starved.
So I edited the /etc/environment contents and ended up with this

more /etc/environment
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games"
ANT_HOME="/usr/share/ant"
JAVA_HOME="/usr/lib/jvm/java-6-sun"
JAVA_OPTS="${JAVA_OPTS} -Djava.awt.headless=true -Xms512M -Xmx512M
-XX:PermSize=256M -XX:MaxPermSize=256M

and I rebooted the machine, but I'm still getting the error.  I don't
know how to check and see if it took the arguments correctly, but when I
look at http://myserver:8080/manager/status I see

JVM

Free memory: 23.34 MB Total memory: 63.56 MB Max memory: 63.56 MB

What am I doing wrong?


Matt Burkhardt, MSTM
President
Impari Systems, Inc.
401 Rosemont Avenue
Frederick, MD  21701
mlb@imparisystems.com
www.imparisystems.com
(301) 644-3911



RE: Memory question

Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: Matt Burkhardt [mailto:mlb@imparisystems.com]
> Subject: Memory question
>
> JAVA_OPTS="${JAVA_OPTS} -Djava.awt.headless=true -Xms512M -Xmx512M
> -XX:PermSize=256M -XX:MaxPermSize=256M

It's a bad idea to set JAVA_OPTS globally, since you have no idea who's going to be looking at it.  Also, you're missing the closing quote.

> Free memory: 23.34 MB Total memory: 63.56 MB Max memory: 63.56 MB

Obviously, the JAVA_OPTS didn't make it into the Tomcat process.  Do you see the JAVA_OPTS variable from a regular terminal session?  Why not set JAVA_OPTS in just the process that kicks off the Tomcat startup script?

 - 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 start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


RE: Memory question

Posted by Matt Burkhardt <ml...@imparisystems.com>.
Thank you all!  I set JAVA_OPTS in the tomcat startup and it works!

Now to figure out the next problem, but that's an issue with the
application I'm running and not Tomcat.

On Wed, 2008-07-23 at 20:00 -0500, Caldarale, Charles R wrote:

> > From: David Smith [mailto:dns4@cornell.edu]
> > Subject: Re: Memory question
> >
> > I believe the startup script accepts extra parameters and just
> > passes them on to the JVM for startup.  You should be able to do:
> >
> > startup.sh -Xmx512m
> 
> Unfortunately not, although it certainly would be convenient.  The extra parameters are passed to Tomcat's Bootstrap class, not the JVM.  You really do have to use CATALINA_OPTS or JAVA_OPTS.
> 
>  - 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 start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
> 

Matt Burkhardt, MSTM
President
Impari Systems, Inc.
401 Rosemont Avenue
Frederick, MD  21701
mlb@imparisystems.com
www.imparisystems.com
(301) 644-3911



Re: Memory question

Posted by David Smith <dn...@cornell.edu>.
Ooops.  It's been a long time since I've taken a look at catalina.sh.  
Just saw the startup.sh pass parameters along.

--David

Caldarale, Charles R wrote:
>> From: David Smith [mailto:dns4@cornell.edu]
>> Subject: Re: Memory question
>>
>> I believe the startup script accepts extra parameters and just
>> passes them on to the JVM for startup.  You should be able to do:
>>
>> startup.sh -Xmx512m
>>     
>
> Unfortunately not, although it certainly would be convenient.  The extra parameters are passed to Tomcat's Bootstrap class, not the JVM.  You really do have to use CATALINA_OPTS or JAVA_OPTS.
>
>  - 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 start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>   


-- 
David Smith
Programmer/Analyst
College of Agriculture and Life Sciences
Cornell University
B32 Morrison Hall
Ithaca, NY 14853
Phone: (607) 255-4521


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


RE: Memory question

Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: David Smith [mailto:dns4@cornell.edu]
> Subject: Re: Memory question
>
> I believe the startup script accepts extra parameters and just
> passes them on to the JVM for startup.  You should be able to do:
>
> startup.sh -Xmx512m

Unfortunately not, although it certainly would be convenient.  The extra parameters are passed to Tomcat's Bootstrap class, not the JVM.  You really do have to use CATALINA_OPTS or JAVA_OPTS.

 - 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 start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Memory question

Posted by David Smith <dn...@cornell.edu>.
If you login to tomcat's manager webapp, you can see the memory settings 
and usage on the running system.  Regarding setting the memory, etc., 
... I believe the startup script accepts extra parameters and just 
passes them on to the JVM for startup.  You should be able to do:

startup.sh -Xmx512m

Then you don't end up giving every java program running on the system 
half your system memory, killing hard drives on page swaps.

--David

Matt Burkhardt wrote:
> Okay - I've gone ahead, uninstalled the distro from Ubuntu, installed
> Tomcat 6.0.16 and I'm having problems running out of memory.  My
> catalina.out file contains the lines
>
>         at
> org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)
>         at
> org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)
> Caused by: java.lang.OutOfMemoryError: Java heap space
>  
> and the application says it needs 512MB, I have 1GB on the server and it
> says that you can use up to 70% of the memory before it gets starved.
> So I edited the /etc/environment contents and ended up with this
>
> more /etc/environment
> PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games"
> ANT_HOME="/usr/share/ant"
> JAVA_HOME="/usr/lib/jvm/java-6-sun"
> JAVA_OPTS="${JAVA_OPTS} -Djava.awt.headless=true -Xms512M -Xmx512M
> -XX:PermSize=256M -XX:MaxPermSize=256M
>
> and I rebooted the machine, but I'm still getting the error.  I don't
> know how to check and see if it took the arguments correctly, but when I
> look at http://myserver:8080/manager/status I see
>
> JVM
>
> Free memory: 23.34 MB Total memory: 63.56 MB Max memory: 63.56 MB
>
> What am I doing wrong?
>
>
> Matt Burkhardt, MSTM
> President
> Impari Systems, Inc.
> 401 Rosemont Avenue
> Frederick, MD  21701
> mlb@imparisystems.com
> www.imparisystems.com
> (301) 644-3911
>
>   


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