Admin: Memory

From Resin 3.0

(Difference between revisions)
Jump to: navigation, search
(Memory Meters)
 
(5 intermediate revisions by one user not shown)
Line 1: Line 1:
 
[[Category: Admin]]
 
[[Category: Admin]]
 +
 +
= Memory Meters =
 +
 +
To show the memory usage over time, Resin memory meters gather the JMX statistics for the heap every minute.
 +
 +
You can use the memory graphs for capacity planning or for postmortem analysis. If the memory usage varies considerably, you might be spending more time in garbage collection than necessary. If the memory is consistently low, or is low for an extended period of time, you might have a memory leak. The graphs will give you a starting point to determine what's happening in your system.
 +
 +
[[Image: Memory-free.png]]
  
 
= Memory Pools =
 
= Memory Pools =
  
 
Java organizes its memory into pools, depending on the memory use. The main long-term heap memory is the Tenured memory.
 
Java organizes its memory into pools, depending on the memory use. The main long-term heap memory is the Tenured memory.
Other memory are optimizations of the Tenured memory. Eden is new, short-term memory. Survivor is long-lived memory.
+
Other memory are optimizations of the Tenured memory. Eden is new, short-term memory. Survivor new memory that has survived a
 +
short garbage collection.
  
 
== CodeCache ==
 
== CodeCache ==
Line 12: Line 21:
 
== Eden ==
 
== Eden ==
  
The Eden memory pool is used by the JVM for new, short-lived memory. Free memory in the Eden can be collected in fast garbage collections.
+
The Eden memory pool is used by the JVM for new, short-lived memory. Free memory in the Eden can be collected in fast garbage collections. If an object survives a short GC from the Eden space, it moves to the Survivor pool.
 +
 
 +
Typically, objects specific to a single HTTP request will be in the Eden pool and will freed on the first garbage collection after the request completes.
  
 
The Eden memory size is configured with -Xmn128m. In general, the JVM's defaults are fine.
 
The Eden memory size is configured with -Xmn128m. In general, the JVM's defaults are fine.
 +
 +
== PermGen ==
 +
 +
The PermGen pool is an important memory heap pool used for classes and other permanent memory. If an application has a lot of classes, it's possible for this memory to be used up.
 +
 +
For restarts, the PermGen can have important memory leaks, where a restarted [[WebApp]] might not release its classes and the PermGen memory can increase. The PermGen leaks tend to be application or framework errors where a class is either stored in an incorrect environment, like saving a servlet class in a ThreadLocal or in a system object.
 +
 +
== Survivor ==
 +
 +
The Survivor pool contains objects that are older than Eden objects, but have survived a short GC. It's a medium pool between Eden and Tenured. If the Survivor objects survive further garbage collections, they are moved to the Tenured space.
 +
 +
== Tenured ==
 +
 +
The Tenured pool is the main memory heap for long-lived objects. For a servlet container, the tenured pool contains long-lived objects like Servlets, Application-scoped CDI beans, and Sessions.
 +
 +
If a memory leak exists, the tenured memory will gradually be used up until the JDK runs out of memory.
 +
 +
= Memory Usage =
 +
 +
In the Admin display, the state of a memory pool is broken into three main groups: free, used and max.
 +
 +
== free ==
 +
 +
The free memory is the amount of memory in a pool available for new allocations. In general, this is the most critical number, because
 +
when it goes to 0, you have run out of memory.
 +
 +
Small values of free memory will cause the garbage collector to run steadily, so you will generally want to have a solid buffer of free memory.
 +
 +
== used ==
 +
 +
The used memory for a pool is the amount of memory actually being used.
 +
 +
== max ==
 +
 +
The maximum memory for the pool is the total amount of memory allocated to that pool. Note, this number does not always match up with the
 +
configured maximum.

Latest revision as of 00:24, 15 October 2010


Contents

[edit] Memory Meters

To show the memory usage over time, Resin memory meters gather the JMX statistics for the heap every minute.

You can use the memory graphs for capacity planning or for postmortem analysis. If the memory usage varies considerably, you might be spending more time in garbage collection than necessary. If the memory is consistently low, or is low for an extended period of time, you might have a memory leak. The graphs will give you a starting point to determine what's happening in your system.

Memory-free.png

[edit] Memory Pools

Java organizes its memory into pools, depending on the memory use. The main long-term heap memory is the Tenured memory. Other memory are optimizations of the Tenured memory. Eden is new, short-term memory. Survivor new memory that has survived a short garbage collection.

[edit] CodeCache

The CodeCache is the JVM's non-heap memory pool containing the JNI compiled Java class code.

[edit] Eden

The Eden memory pool is used by the JVM for new, short-lived memory. Free memory in the Eden can be collected in fast garbage collections. If an object survives a short GC from the Eden space, it moves to the Survivor pool.

Typically, objects specific to a single HTTP request will be in the Eden pool and will freed on the first garbage collection after the request completes.

The Eden memory size is configured with -Xmn128m. In general, the JVM's defaults are fine.

[edit] PermGen

The PermGen pool is an important memory heap pool used for classes and other permanent memory. If an application has a lot of classes, it's possible for this memory to be used up.

For restarts, the PermGen can have important memory leaks, where a restarted WebApp might not release its classes and the PermGen memory can increase. The PermGen leaks tend to be application or framework errors where a class is either stored in an incorrect environment, like saving a servlet class in a ThreadLocal or in a system object.

[edit] Survivor

The Survivor pool contains objects that are older than Eden objects, but have survived a short GC. It's a medium pool between Eden and Tenured. If the Survivor objects survive further garbage collections, they are moved to the Tenured space.

[edit] Tenured

The Tenured pool is the main memory heap for long-lived objects. For a servlet container, the tenured pool contains long-lived objects like Servlets, Application-scoped CDI beans, and Sessions.

If a memory leak exists, the tenured memory will gradually be used up until the JDK runs out of memory.

[edit] Memory Usage

In the Admin display, the state of a memory pool is broken into three main groups: free, used and max.

[edit] free

The free memory is the amount of memory in a pool available for new allocations. In general, this is the most critical number, because when it goes to 0, you have run out of memory.

Small values of free memory will cause the garbage collector to run steadily, so you will generally want to have a solid buffer of free memory.

[edit] used

The used memory for a pool is the amount of memory actually being used.

[edit] max

The maximum memory for the pool is the total amount of memory allocated to that pool. Note, this number does not always match up with the configured maximum.

Personal tools