You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Leo Donahue - PLANDEVX <Le...@mail.maricopa.gov> on 2010/01/11 20:29:54 UTC

Tomcat memory settings

Tomcat 6.0.20 zip (used service command to run as windows service)
Window 2003 Server 2.0GB RAM (1.3GB available)

My problem:

org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Servlet.service() for servlet "servlet name" threw exception
java.lang.OutOfMemoryError: Java heap space

I've read many previous posts and online articles about increasing the memory settings for Tomcat.  As it stands, I've modified the catalina.bat file and set the CATALINA_OPTS variable from what was nothing to the following:

:doStop
shift
set ACTION=stop
set CATALINA_OPTS=-Xms256m -Xmx512m
goto execCmd


I have restarted Tomcat.

1.  Was that the right way to increase the memory for Tomcat 6.0.20?
2.  Do I monitor the log files to see if this setting was enough?  I realize there could be many other things related to heap space errors.


Leo Donahue

RE: Tomcat memory settings

Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: Leo Donahue - PLANDEVX [mailto:LeoDonahue@mail.maricopa.gov]
> Subject: Tomcat memory settings
> 
> I've read many previous posts and online articles about increasing the
> memory settings for Tomcat.  As it stands, I've modified the
> catalina.bat file and set the CATALINA_OPTS variable from what was
> nothing to the following:

That does nothing for the service, which does not use the .bat scripts.  Use the bin/tomcat6w.exe program to manipulate the heap settings, which are on the Java tab of the GUI.  I'd recommend setting min and max heap sizes to the same value to avoid thrashing.

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


Re: Tomcat memory settings

Posted by Paul Campbell <pc...@gmail.com>.
http://www.theserverside.com/news/thread.tss?thread_id=48390


http://wiki.apache.org/tomcat/FAQ/Memory

Try googling

On 01/11/2010 11:29 AM, Leo Donahue - PLANDEVX wrote:
> Tomcat 6.0.20 zip (used service command to run as windows service)
> Window 2003 Server 2.0GB RAM (1.3GB available)
>
> My problem:
>
> org.apache.catalina.core.StandardWrapperValve invoke
> SEVERE: Servlet.service() for servlet "servlet name" threw exception
> java.lang.OutOfMemoryError: Java heap space
>
> I've read many previous posts and online articles about increasing the memory settings for Tomcat.  As it stands, I've modified the catalina.bat file and set the CATALINA_OPTS variable from what was nothing to the following:
>
> :doStop
> shift
> set ACTION=stop
> set CATALINA_OPTS=-Xms256m -Xmx512m
> goto execCmd
>
>
> I have restarted Tomcat.
>
> 1.  Was that the right way to increase the memory for Tomcat 6.0.20?
> 2.  Do I monitor the log files to see if this setting was enough?  I realize there could be many other things related to heap space errors.
>
>
> Leo Donahue
>
>    


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


RE: Tomcat memory settings

Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: Leo Donahue - PLANDEVX [mailto:LeoDonahue@mail.maricopa.gov]
> Subject: RE: Tomcat memory settings
> 
> I have both values set to 512MB.

That's actually kind of small for this day and age, even on a 32-bit system.

> Looking at the log files, the OOME appears in the logs after long
> periods of time.

Another indication (but not proof) that it's a memory leak in your webapp.

> somewhere in between there will be a OOME message in the logs.
> The webapp still works though.

It's unusual that things keep working after an OOME.  Try setting -XX:+HeapDumpOnOutOfMemoryError; this will produce a file that you can analyze with jhat (part of JDK6) or other tools to see just what's consuming the space.

You can also use JVisualVM (again part of JDK6) to take periodic snapshots of the heap and monitor the heap usage in real-time, without significant impact on the performance of the monitored system.  If you have the CPU headroom, you can also use a heap profiler to track activity; this will capture not only the objects in the heap, but also the call stacks at the time of object creation.

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


Re: Tomcat memory settings

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

Leo,

On 1/14/2010 11:48 AM, Leo Donahue - PLANDEVX wrote:
> Thank you for the feedback.  I followed Chuck's advice and set the
> initial and maximum memory pool using the tomcat6w.exe  I have both
> values set to 512MB.

As Chuck suggests, that's a bit small, especially if you are
manipulating large data sets. I suspect that a GIS data set is quite
large, though with an 87MiB heap size after initialization, I would
guess that you don't need it all.

(Chuck: we use a 196MiB heap for our "big" webapp and it's working fine! :)

> Windows Server 2003 Standard SP2 32-bit
> Tomcat 6.0.20
> The Java Virtual Machine:  C:\Program Files\Java\jdk1.6.0_14\jre\bin\server\jvm.dll
> 
> Looking at the log files, the OOME appears in the logs after long
> periods of time.  Yesterday the message did not appear in the logs
> until 1:50 AM.

What time did you start it? :)

> When Tomcat starts, it is consuming around 87MB of memory and by
> tomorrow it will grow to around 118MB and somewhere in between there
> will be a OOME message in the logs.  The webapp still works though.

Okay, I'll bet I know what's happening. Since your webapp works properly
after the OOME, and the heap is still relatively small (118MiB heap size
while the maximum is 512MiB). I think what's happening is that your
webapp, during one request, is trying to allocate a whole bunch of
memory all at once: it's probably trying to load a ton of GIS data from
a larger database, or maybe trying to do something with an image that
ends up being rather large. The allocation fails, the OOME is thrown,
but neither the application nor the JVM suffers: subsequent requests are
properly handled... it's just that one request that fell on its face.

I'm not sure if you can trigger a thread dump on OOME, but that would be
very interesting: if one thread always says that it's running a method
called allocateHugeArray() or something, that may be your culprit.

Do the ArcIMS folks recommend a particular heap size for use with their
API / database? You might want to consult with them about an
appropriately-sized heap for your needs.

Was ArcIMS designed to be used in a multi-user environment? It's
possible that you can't get decent performance with multiple
simultaneous queries against their database. In that case, all is not
lost: you can write your own wrapper around the ArcIMS API that will
limit the number of simultaneous requests to something more manageable.

> I realize that my issue is now probably not related so much to Tomcat
> but probably the design of the webapp.

This is usually the case, although Tomcat bugs /have/ been found in the
past.

>>> Do you keep a lot of information in users' sessions?
> I don't know, I'm only keeping one string value which is what the
> user enters into the query text field.  The session timeout is set to
> 5 minutes.

If you're talking about the search string from below ("211-52-011A"),
then this is what we call "nothing". Don't worry about this. The memory
allocated for management of the session itself (very small) outweighs
this trivial amount of memory to store that string. Unless you don't
limit the length of the string you're willing to accept via the web
interface and/or store in the session. You might want to check that.

>>> How about in the application context?
> I'm not using any init params, if that is what you mean.

No, that's not what I mean. Many applications do some preliminary work
when they start up, maybe by loading static data from a database and
caching it in what's called the "application scope" which is represented
by a ServletContext object.

You can get a lot of information about what is where using a utility I
wrote called the SessionSnooper. You can find it here under "JSP
Utilities": http://christopherschultz.net/projects/java/

You can see what is being stored where in your web application
(application, session, and request scopes). You can also get JVM memory
information, too. This might help you see what is being stored in there,
although it doesn't do anything cool like try to calculate the "size" of
anything. It just tells you the hash keys (which are string values) and
allows you to print the result of toString() called on each item.

>>> Does your webapp do anything that you expect to require very
>>> heavy memory consumption (image manipulation, in-memory
>>> representations of large datasets, etc.)?
> 
> For each request, if the value is found in the datasource, up to 40
> other beans are instantiated and compared to the result of the
> request.  There is also one image that is returned in the process.
> You can view it here: http://planning.maricopa.gov/plannetquickinfo

Depending on the size of these beans, you might have a situation where a
lot of memory is allocated all at once due to one of these requests. If
it comes down to it, you might have to use a debugger to see what is
happening.

Definitely enable some kind of access logging. You might even want to
add some debugging logging to your webapp that prints information like
what requests are being made to the ArcIMS API, including all the
parameters that are being sent. If you can figure out how to reproduce
your OOME, you can figure out why it's happening and how to prevent it.

Good luck,
- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAktQgqkACgkQ9CaO5/Lv0PBR8QCggykevkEhbEWfXxrTWza1EeW7
cvwAoJ1nhRlcfHWNHGggu4n/R+aJbY6Z
=O2AB
-----END PGP SIGNATURE-----

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


RE: Tomcat memory settings

Posted by Leo Donahue - PLANDEVX <Le...@mail.maricopa.gov>.
>> Where does the image come from and how is it handled?  Sometimes image generation can be a problem.
The image is generated by software called ArcIMS.  ArcIMS uses a xml file called a map configuration file that has "pointers" to all of the GIS data layers and images.  The map configuration file is held in memory.  The ArcIMS API handles the image generation and provides the mechanism for connecting to the server, data layers, and making spatial queries against the geometry of the parcel the user enters.  Images are generated on the server and placed in an output directory accessible via a URL.  Essentially, the ArcIMS API has methods to get the geometry of the parcel the user enters, create a polygon, uses that polygon to compare whether any of the other 40+ layers possibly intersect the polygon, get each GIS layer recordset that intersects, and the map image associated with the map extent - which is a buffer of the geometry of the parcel by a distance of 500'.

Each of the 40+ layers have their own bean for place holders for the GIS layer recordsets and I use h:dataTable to iterate over those records.  Each bean is an array of arrays since it is possible that more than one attribute of a layer intersects the given parcel.  

>> Have you had to write any code to make the app work?
All of it.  It was just an idea I had to try to offer a non-map-interactive query tool for the user.  I didn't create the ArcIMS API, I'm just working with it.

I suspect that my problem is design and I'm sure it relates to having a session.  When is the right time to close a data connection during a session?    It seems like I need to have some code that determines the age of the session and then does some object cleanup?  The only reason I have a session at all is to make a round trip to the server to enable the search button and display a message when a parcel is not found.  What I thought was going to be an easy webapp has burgeoned into something much larger.

I'm sorry if I've turned this thread into a non-Tomcat issue.  But I really appreciate the feedback.

Leo

-----Original Message-----
From: Pid [mailto:pid@pidster.com] 
Sent: Thursday, January 14, 2010 10:49 AM
To: users@tomcat.apache.org
Subject: Re: Tomcat memory settings

On 14/01/2010 16:48, Leo Donahue - PLANDEVX wrote:
> Chris,
>
> Thank you for the feedback.  I followed Chuck's advice and set the initial and maximum memory pool using the tomcat6w.exe  I have both values set to 512MB.
>
> Windows Server 2003 Standard SP2 32-bit Tomcat 6.0.20 The Java Virtual 
> Machine:  C:\Program Files\Java\jdk1.6.0_14\jre\bin\server\jvm.dll
>
> Looking at the log files, the OOME appears in the logs after long periods of time.  Yesterday the message did not appear in the logs until 1:50 AM.
>
> When Tomcat starts, it is consuming around 87MB of memory and by tomorrow it will grow to around 118MB and somewhere in between there will be a OOME message in the logs.  The webapp still works though.
>
> I hope I can answer the following but I'll admit to you now, I'm not 100% sure I know what I'm doing.  Hopefully you will keep the laughter to a minimum as a courtesy?
>
> I realize that my issue is now probably not related so much to Tomcat but probably the design of the webapp.
>
>>> Do you keep a lot of information in users' sessions?
> I don't know, I'm only keeping one string value which is what the user enters into the query text field.  The session timeout is set to 5 minutes.

If the string value is short, probably not then.

>>> How about in the application context?
> I'm not using any init params, if that is what you mean.

Sort of.

>>> Does your webapp cache a lot of information?
> I don't know.

OK.

>>> Do you use a database connection pool? If so, which one? What is the configuration?
> No.  I am using a vendor API that makes a connection to their datasource.  The user enters a value in the JSF page, the action event is tied to a method that looks up the value in the datasource, if the value was found then page navigation ocurrs and displays results, if the value was not found a message is displayed on the JSF page indicating the value was not found, using the messages tag.

A resource leak is when, for example, a database connection is opened but not properly closed.  Each time it's opened it's using a bit of memory that isn't returned, because the connection is not closed.

It can be hard, but not impossible, to track down the source of this type of problem.

>>>   Does your webapp do anything that you expect to require very heavy memory consumption (image manipulation, in-memory representations of large datasets, etc.)?
>
> For each request, if the value is found in the datasource, up to 40 
> other beans are instantiated and compared to the result of the 
> request.  There is also one image that is returned in the process.  
> You can view it here: http://planning.maricopa.gov/plannetquickinfo
>
> You can use parcel: 211-52-011A as an example search.

Where does the image come from and how is it handled?  Sometimes image generation can be a problem.

Have you had to write any code to make the app work?


p


> -----Original Message-----
> From: Christopher Schultz [mailto:chris@christopherschultz.net]
> Sent: Wednesday, January 13, 2010 2:03 PM
> To: Tomcat Users List
> Subject: Re: Tomcat memory settings
>
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Leo,
>
> On 1/11/2010 2:29 PM, Leo Donahue - PLANDEVX wrote:
>> org.apache.catalina.core.StandardWrapperValve invoke
>> SEVERE: Servlet.service() for servlet "servlet name" threw exception
>> java.lang.OutOfMemoryError: Java heap space
>
> To add to what others have said, getting an OOME can mean one of two things:
>
> 1. Your webapp simply needs more memory than you are allocating 2. You 
> have a resource leak
>
> Most often, #2 is the culprit.
>
> Under what conditions are you getting the OOME? Lots of users after a short period of uptime, or all by yourself on your development environment after a long period of time?
>
> Do you keep a lot of information in users' sessions? How about in the application context? Does your webapp cache a lot of information? Do you use a database connection pool? If so, which one? What is the configuration?
>
> Does your webapp do anything that you expect to require very heavy memory consumption (image manipulation, in-memory representations of large datasets, etc.)? If so, you may simply need more memory to properly run your webapp.
>
> Finally, with a 32-bit JVM (you didn't say which you were using), you'll top-out around 2GiB for your heap no matter how much physical RAM you have. If you need more than 2GiB of heap, you'll need to go with a 64-bit environment.
>
> - -chris
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.10 (MingW32)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
>
> iEYEARECAAYFAktONOkACgkQ9CaO5/Lv0PAEMACfaS7G/FPgvCkEG1j4tS7mQkrC
> PkgAn3CYEh4D8eEa4FJdlLAIp7VmOIWZ
> =/cyT
> -----END PGP SIGNATURE-----
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>


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


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


Re: Tomcat memory settings

Posted by Pid <pi...@pidster.com>.
On 14/01/2010 16:48, Leo Donahue - PLANDEVX wrote:
> Chris,
>
> Thank you for the feedback.  I followed Chuck's advice and set the initial and maximum memory pool using the tomcat6w.exe  I have both values set to 512MB.
>
> Windows Server 2003 Standard SP2 32-bit
> Tomcat 6.0.20
> The Java Virtual Machine:  C:\Program Files\Java\jdk1.6.0_14\jre\bin\server\jvm.dll
>
> Looking at the log files, the OOME appears in the logs after long periods of time.  Yesterday the message did not appear in the logs until 1:50 AM.
>
> When Tomcat starts, it is consuming around 87MB of memory and by tomorrow it will grow to around 118MB and somewhere in between there will be a OOME message in the logs.  The webapp still works though.
>
> I hope I can answer the following but I'll admit to you now, I'm not 100% sure I know what I'm doing.  Hopefully you will keep the laughter to a minimum as a courtesy?
>
> I realize that my issue is now probably not related so much to Tomcat but probably the design of the webapp.
>
>>> Do you keep a lot of information in users' sessions?
> I don't know, I'm only keeping one string value which is what the user enters into the query text field.  The session timeout is set to 5 minutes.

If the string value is short, probably not then.

>>> How about in the application context?
> I'm not using any init params, if that is what you mean.

Sort of.

>>> Does your webapp cache a lot of information?
> I don't know.

OK.

>>> Do you use a database connection pool? If so, which one? What is the configuration?
> No.  I am using a vendor API that makes a connection to their datasource.  The user enters a value in the JSF page, the action event is tied to a method that looks up the value in the datasource, if the value was found then page navigation ocurrs and displays results, if the value was not found a message is displayed on the JSF page indicating the value was not found, using the messages tag.

A resource leak is when, for example, a database connection is opened 
but not properly closed.  Each time it's opened it's using a bit of 
memory that isn't returned, because the connection is not closed.

It can be hard, but not impossible, to track down the source of this 
type of problem.

>>>   Does your webapp do anything that you expect to require very heavy memory consumption (image manipulation, in-memory representations of large datasets, etc.)?
>
> For each request, if the value is found in the datasource, up to 40 other beans are instantiated and compared to the result of the request.  There is also one image that is returned in the process.  You can view it here: http://planning.maricopa.gov/plannetquickinfo
>
> You can use parcel: 211-52-011A as an example search.

Where does the image come from and how is it handled?  Sometimes image 
generation can be a problem.

Have you had to write any code to make the app work?


p


> -----Original Message-----
> From: Christopher Schultz [mailto:chris@christopherschultz.net]
> Sent: Wednesday, January 13, 2010 2:03 PM
> To: Tomcat Users List
> Subject: Re: Tomcat memory settings
>
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Leo,
>
> On 1/11/2010 2:29 PM, Leo Donahue - PLANDEVX wrote:
>> org.apache.catalina.core.StandardWrapperValve invoke
>> SEVERE: Servlet.service() for servlet "servlet name" threw exception
>> java.lang.OutOfMemoryError: Java heap space
>
> To add to what others have said, getting an OOME can mean one of two things:
>
> 1. Your webapp simply needs more memory than you are allocating 2. You have a resource leak
>
> Most often, #2 is the culprit.
>
> Under what conditions are you getting the OOME? Lots of users after a short period of uptime, or all by yourself on your development environment after a long period of time?
>
> Do you keep a lot of information in users' sessions? How about in the application context? Does your webapp cache a lot of information? Do you use a database connection pool? If so, which one? What is the configuration?
>
> Does your webapp do anything that you expect to require very heavy memory consumption (image manipulation, in-memory representations of large datasets, etc.)? If so, you may simply need more memory to properly run your webapp.
>
> Finally, with a 32-bit JVM (you didn't say which you were using), you'll top-out around 2GiB for your heap no matter how much physical RAM you have. If you need more than 2GiB of heap, you'll need to go with a 64-bit environment.
>
> - -chris
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.10 (MingW32)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
>
> iEYEARECAAYFAktONOkACgkQ9CaO5/Lv0PAEMACfaS7G/FPgvCkEG1j4tS7mQkrC
> PkgAn3CYEh4D8eEa4FJdlLAIp7VmOIWZ
> =/cyT
> -----END PGP SIGNATURE-----
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>


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


RE: Tomcat memory settings

Posted by Leo Donahue - PLANDEVX <Le...@mail.maricopa.gov>.
Chris,

Thank you for the feedback.  I followed Chuck's advice and set the initial and maximum memory pool using the tomcat6w.exe  I have both values set to 512MB.

Windows Server 2003 Standard SP2 32-bit
Tomcat 6.0.20
The Java Virtual Machine:  C:\Program Files\Java\jdk1.6.0_14\jre\bin\server\jvm.dll

Looking at the log files, the OOME appears in the logs after long periods of time.  Yesterday the message did not appear in the logs until 1:50 AM.

When Tomcat starts, it is consuming around 87MB of memory and by tomorrow it will grow to around 118MB and somewhere in between there will be a OOME message in the logs.  The webapp still works though.

I hope I can answer the following but I'll admit to you now, I'm not 100% sure I know what I'm doing.  Hopefully you will keep the laughter to a minimum as a courtesy?

I realize that my issue is now probably not related so much to Tomcat but probably the design of the webapp.

>> Do you keep a lot of information in users' sessions?
I don't know, I'm only keeping one string value which is what the user enters into the query text field.  The session timeout is set to 5 minutes.

>> How about in the application context?
I'm not using any init params, if that is what you mean.

>> Does your webapp cache a lot of information?
I don't know.

>> Do you use a database connection pool? If so, which one? What is the configuration?
No.  I am using a vendor API that makes a connection to their datasource.  The user enters a value in the JSF page, the action event is tied to a method that looks up the value in the datasource, if the value was found then page navigation ocurrs and displays results, if the value was not found a message is displayed on the JSF page indicating the value was not found, using the messages tag.

>>  Does your webapp do anything that you expect to require very heavy memory consumption (image manipulation, in-memory representations of large datasets, etc.)?

For each request, if the value is found in the datasource, up to 40 other beans are instantiated and compared to the result of the request.  There is also one image that is returned in the process.  You can view it here: http://planning.maricopa.gov/plannetquickinfo  

You can use parcel: 211-52-011A as an example search.


-----Original Message-----
From: Christopher Schultz [mailto:chris@christopherschultz.net] 
Sent: Wednesday, January 13, 2010 2:03 PM
To: Tomcat Users List
Subject: Re: Tomcat memory settings

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Leo,

On 1/11/2010 2:29 PM, Leo Donahue - PLANDEVX wrote:
> org.apache.catalina.core.StandardWrapperValve invoke
> SEVERE: Servlet.service() for servlet "servlet name" threw exception
> java.lang.OutOfMemoryError: Java heap space

To add to what others have said, getting an OOME can mean one of two things:

1. Your webapp simply needs more memory than you are allocating 2. You have a resource leak

Most often, #2 is the culprit.

Under what conditions are you getting the OOME? Lots of users after a short period of uptime, or all by yourself on your development environment after a long period of time?

Do you keep a lot of information in users' sessions? How about in the application context? Does your webapp cache a lot of information? Do you use a database connection pool? If so, which one? What is the configuration?

Does your webapp do anything that you expect to require very heavy memory consumption (image manipulation, in-memory representations of large datasets, etc.)? If so, you may simply need more memory to properly run your webapp.

Finally, with a 32-bit JVM (you didn't say which you were using), you'll top-out around 2GiB for your heap no matter how much physical RAM you have. If you need more than 2GiB of heap, you'll need to go with a 64-bit environment.

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAktONOkACgkQ9CaO5/Lv0PAEMACfaS7G/FPgvCkEG1j4tS7mQkrC
PkgAn3CYEh4D8eEa4FJdlLAIp7VmOIWZ
=/cyT
-----END PGP SIGNATURE-----

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


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


Re: Tomcat memory settings

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

Leo,

On 1/11/2010 2:29 PM, Leo Donahue - PLANDEVX wrote:
> org.apache.catalina.core.StandardWrapperValve invoke
> SEVERE: Servlet.service() for servlet "servlet name" threw exception
> java.lang.OutOfMemoryError: Java heap space

To add to what others have said, getting an OOME can mean one of two things:

1. Your webapp simply needs more memory than you are allocating
2. You have a resource leak

Most often, #2 is the culprit.

Under what conditions are you getting the OOME? Lots of users after a
short period of uptime, or all by yourself on your development
environment after a long period of time?

Do you keep a lot of information in users' sessions? How about in the
application context? Does your webapp cache a lot of information? Do you
use a database connection pool? If so, which one? What is the configuration?

Does your webapp do anything that you expect to require very heavy
memory consumption (image manipulation, in-memory representations of
large datasets, etc.)? If so, you may simply need more memory to
properly run your webapp.

Finally, with a 32-bit JVM (you didn't say which you were using), you'll
top-out around 2GiB for your heap no matter how much physical RAM you
have. If you need more than 2GiB of heap, you'll need to go with a
64-bit environment.

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAktONOkACgkQ9CaO5/Lv0PAEMACfaS7G/FPgvCkEG1j4tS7mQkrC
PkgAn3CYEh4D8eEa4FJdlLAIp7VmOIWZ
=/cyT
-----END PGP SIGNATURE-----

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