<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<body link="#355491" alink="#4262a1" vlink="#355491" style="background: #e2e2e2; margin: 0; padding: 20px;">

<div>
        <table cellpadding="0" bgcolor="#FFFFFF" border="0" cellspacing="0" style="border: 1px solid #dadada; margin-bottom: 30px; width: 100%; -moz-border-radius: 6px; -webkit-border-radius: 6px;">
                <tbody>
                        <tr>

                                <td>

                                        <table border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF" style="border: solid 2px #ccc; background: #dadada; width: 100%; -moz-border-radius: 6px; -webkit-border-radius: 6px;">
                                                <tbody>
                                                        <tr>
                                                                <td bgcolor="#000000" valign="middle" height="58px" style="border-bottom: 1px solid #ccc; padding: 20px; -moz-border-radius-topleft: 3px; -moz-border-radius-topright: 3px; -webkit-border-top-right-radius: 5px; -webkit-border-top-left-radius: 5px;">
                                                                        <h1 style="color: #333333; font: bold 22px Arial, Helvetica, sans-serif; margin: 0; display: block !important;">
                                                                        <!-- To have a header image/logo replace the name below with your img tag -->
                                                                        <!-- Email clients will render the images when the message is read so any image -->
                                                                        <!-- must be made available on a public server, so that all recipients can load the image. -->
                                                                        <a href="http://community.jboss.org/index.jspa" style="text-decoration: none; color: #E1E1E1">JBoss Community</a></h1>
                                                                </td>

                                                        </tr>
                                                        <tr>
                                                                <td bgcolor="#FFFFFF" style="font: normal 12px Arial, Helvetica, sans-serif; color:#333333; padding: 20px;  -moz-border-radius-bottomleft: 4px; -moz-border-radius-bottomright: 4px; -webkit-border-bottom-right-radius: 5px; -webkit-border-bottom-left-radius: 5px;"><h3 style="margin: 10px 0 5px; font-size: 17px; font-weight: normal;">
    Full Garbage Collection every few seconds &ndash; GC frees very little memory (JBoss 4.2.3 with JDK 1.5.0 64-bit)
</h3>
<span style="margin-bottom: 10px;">
    created by <a href="http://community.jboss.org/people/kopin">Constantine Pinakoulakis</a> in <i>Performance Tuning</i> - <a href="http://community.jboss.org/message/571975#571975">View the full discussion</a>
</span>
<hr style="margin: 20px 0; border: none; background-color: #dadada; height: 1px;">

<div class="jive-rendered-content"><p class="MsoNormal"><span style="text-decoration: underline;">Setup</span></p><p class="MsoNormal">8-core Xeon / 10 GB RAM</p><p class="MsoNormal">RedHat EL 5.3 (64-bit)</p><p class="MsoNormal">JDK 1.5.0._22 (64-bit)</p><p class="MsoNormal">JBoss AS 4.2.3.GA with JBoss Messaging installed</p><p class="MsoNormal">JAVA_OPTS=&#8221;-server -Xrs -Xms2048m -Xmx2048m -XX:MaxPermSize=512m -XX:NewRatio=1 -XX:ThreadStackSize=160 -XX:+UseParallelGC -Djava.awt.headless=true -Djava.library.path=$JBOSS_NATIVE_DIR -Dsun.rmi.dgc.client.gcInterval=3600000 -Dsun.rmi.dgc.server.gcInterval=3600000&#8221;</p><p class="MsoNormal" style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p class="MsoNormal"><span style="text-decoration: underline;">Description</span></p><p class="MsoNormal">We are running an EE web application on JBoss with an Apache httpd as a reverse proxy (using mod_jk) on another machine.&#160; Our stress tests have shown that the server can handle up to 400 concurrent requests, and we have therefore set the Tomcat AJP pool to that size.</p><p class="MsoNormal" style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p class="MsoNormal">When usage is normal, we can see about 40 active threads out of 400 being used, and the server works fine.&#160; Sometimes (we have not been able to discover a pattern &ndash; it may happen anytime from every couple of days to every couple of weeks) the number of active AJP threads reaches the maximum (400) and from that time onwards, server performance degrades significantly and does not get back to normal, even after the active AJP thread count has fallen to 10-20.&#160; Eventually, performance reaches unacceptable levels and we have to restart JBoss.</p><p class="MsoNormal" style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p class="MsoNormal">We have observed that when the problem occurs, the garbage collector behaves like this (and never recovers) :</p><p class="MsoNormal" style="margin-bottom: 0.0001pt;"><span style="font-family: courier new,courier;">/usr/java/jdk_5_64/jdk1.5.0_22/bin/jstat -gcutil 21801 5000 10</span></p><p class="MsoNormal" style="margin-bottom: 0.0001pt;"><span style="font-family: courier new,courier;">&#160; S0&#160;&#160;&#160;&#160; S1&#160;&#160;&#160;&#160; E&#160;&#160;&#160;&#160;&#160; O&#160;&#160;&#160;&#160;&#160; P&#160;&#160;&#160;&#160; YGC&#160;&#160;&#160;&#160; YGCT&#160;&#160;&#160; FGC&#160;&#160;&#160; FGCT&#160;&#160;&#160;&#160; GCT</span></p><p class="MsoNormal" style="margin-bottom: 0.0001pt;"><span style="font-family: courier new,courier;">&#160; 0.00&#160;&#160; 0.00&#160; 46.39&#160; 99.81&#160; 99.97&#160; 43111&#160; 839.352 14271 38382.902 39222.254</span></p><p class="MsoNormal" style="margin-bottom: 0.0001pt;"><span style="font-family: courier new,courier;">&#160; 0.00&#160;&#160; 0.00&#160; 99.81&#160; 99.78&#160; 99.97&#160; 43111&#160; 839.352 14273 38385.821 39225.173</span></p><p class="MsoNormal" style="margin-bottom: 0.0001pt;"><span style="font-family: courier new,courier;">&#160; 0.00&#160;&#160; 0.00&#160; 99.98&#160; 99.78&#160; 99.99&#160; 43111&#160; 839.352 14274 38388.653 39228.005</span></p><p class="MsoNormal" style="margin-bottom: 0.0001pt;"><span style="font-family: courier new,courier;">&#160; 0.00&#160;&#160; 0.00&#160; 99.96&#160; 99.78&#160; 99.98&#160; 43111&#160; 839.352 14276 38394.327 39233.679</span></p><p class="MsoNormal" style="margin-bottom: 0.0001pt;"><span style="font-family: courier new,courier;">&#160; 0.00&#160;&#160; 0.00&#160; 99.80&#160; 99.75&#160; 99.97&#160; 43111&#160; 839.352 14277 38397.220 39236.572</span></p><p class="MsoNormal" style="margin-bottom: 0.0001pt;"><span style="font-family: courier new,courier;">&#160; 0.00&#160;&#160; 0.00&#160; 29.83&#160; 99.75&#160; 99.96&#160; 43111&#160; 839.352 14278 38402.896 39242.249</span></p><p class="MsoNormal" style="margin-bottom: 0.0001pt;"><span style="font-family: courier new,courier;">&#160; 0.00&#160;&#160; 0.00&#160; 99.09&#160; 99.75&#160; 99.98&#160; 43111&#160; 839.352 14280 38405.740 39245.093</span></p><p class="MsoNormal" style="margin-bottom: 0.0001pt;"><span style="font-family: courier new,courier;">&#160; 0.00&#160;&#160; 0.00&#160; 99.80&#160; 99.70&#160; 99.97&#160; 43111&#160; 839.352 14281 38408.664 39248.016</span></p><p class="MsoNormal" style="margin-bottom: 0.0001pt;"><span style="font-family: courier new,courier;">&#160; 0.00&#160;&#160; 0.00&#160; 99.41&#160; 99.70&#160; 99.77&#160; 43111&#160; 839.352 14283 38414.305 39253.657</span></p><p class="MsoNormal"><span style="font-family: courier new,courier;">&#160; 0.00&#160;&#160; 0.00&#160; 99.82&#160; 99.70&#160; 99.79&#160; 43111&#160; 839.352 14284 38417.120 39256.473</span></p><p class="MsoNormal" style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p class="MsoNormal">When all is normal, its behaviour is much better :</p><p class="MsoNormal" style="margin-bottom: 0.0001pt;"><span style="font-family: courier new,courier;">/usr/java/jdk_5_64/jdk1.5.0_22/bin/jstat -gcutil 28174&#160; 5000 10</span></p><p class="MsoNormal" style="margin-bottom: 0.0001pt;"><span style="font-family: courier new,courier;">&#160; S0&#160;&#160;&#160;&#160; S1&#160;&#160;&#160;&#160; E&#160;&#160;&#160;&#160;&#160; O&#160;&#160;&#160;&#160;&#160; P&#160;&#160;&#160;&#160; YGC&#160;&#160;&#160;&#160; YGCT&#160;&#160;&#160; FGC&#160;&#160;&#160; FGCT&#160;&#160;&#160;&#160; GCT</span></p><p class="MsoNormal" style="margin-bottom: 0.0001pt;"><span style="font-family: courier new,courier;">&#160; 0.00&#160; 96.31&#160; 17.02&#160; 50.89&#160; 99.06&#160; 28939&#160; 522.830&#160; 1777 3073.229 3596.059</span></p><p class="MsoNormal" style="margin-bottom: 0.0001pt;"><span style="font-family: courier new,courier;"> 97.80&#160;&#160; 0.00&#160; 11.21&#160; 51.04&#160; 99.06&#160; 28942&#160; 522.874&#160; 1777 3073.229 3596.103</span></p><p class="MsoNormal" style="margin-bottom: 0.0001pt;"><span style="font-family: courier new,courier;"> 90.52&#160;&#160; 0.00&#160; 87.36&#160; 51.19&#160; 99.06&#160; 28944&#160; 522.904&#160; 1777 3073.229 3596.133</span></p><p class="MsoNormal" style="margin-bottom: 0.0001pt;"><span style="font-family: courier new,courier;">&#160; 0.00&#160; 99.05&#160; 43.58&#160; 51.35&#160; 99.06&#160; 28947&#160; 522.951&#160; 1777 3073.229 3596.180</span></p><p class="MsoNormal" style="margin-bottom: 0.0001pt;"><span style="font-family: courier new,courier;">&#160; 0.00&#160; 97.12&#160; 95.89&#160; 51.47&#160; 99.06&#160; 28949&#160; 522.983&#160; 1777 3073.229 3596.211</span></p><p class="MsoNormal" style="margin-bottom: 0.0001pt;"><span style="font-family: courier new,courier;">&#160; 0.00&#160; 84.73&#160; 47.50&#160; 51.72&#160; 99.06&#160; 28953&#160; 523.045&#160; 1777 3073.229 3596.274</span></p><p class="MsoNormal" style="margin-bottom: 0.0001pt;"><span style="font-family: courier new,courier;">&#160; 0.00&#160; 98.39&#160; 68.94&#160; 51.87&#160; 99.06&#160; 28955&#160; 523.078&#160; 1777 3073.229 3596.307</span></p><p class="MsoNormal" style="margin-bottom: 0.0001pt;"><span style="font-family: courier new,courier;">&#160; 0.00&#160; 97.86&#160; 56.04&#160; 52.01&#160; 99.07&#160; 28957&#160; 523.111&#160; 1777 3073.229 3596.340</span></p><p class="MsoNormal" style="margin-bottom: 0.0001pt;"><span style="font-family: courier new,courier;">&#160; 0.00&#160; 99.08&#160; 63.76&#160; 52.15&#160; 99.07&#160; 28959&#160; 523.141&#160; 1777 3073.229 3596.370</span></p><p class="MsoNormal" style="margin-bottom: 0.0001pt;"><span style="font-family: courier new,courier;">&#160; 0.00&#160; 96.79&#160;&#160; 1.02&#160; 52.29&#160; 99.07&#160; 28961&#160; 523.171&#160; 1777 3073.229 3596.400</span></p><p class="MsoNormal" style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p class="MsoNormal">The whole Java heap space is all in RAM, i.e. the OS swap file is not used at all.&#160; We suspected a memory leak in the application, since the old generation space becomes almost full, but the JVM does not throw an OutOfMemory error; instead, it seems to free very little memory each time, resulting in a full GC.</p><p class="MsoNormal" style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p class="MsoNormal">Any ideas?</p><p class="MsoNormal" style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p class="MsoNormal">Thanks.</p><p class="MsoNormal">Constantine</p></div>

<div style="background-color: #f4f4f4; padding: 10px; margin-top: 20px;">
    <p style="margin: 0;">Reply to this message by <a href="http://community.jboss.org/message/571975#571975">going to Community</a></p>
        <p style="margin: 0;">Start a new discussion in Performance Tuning at <a href="http://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2078">Community</a></p>
</div></td>
                        </tr>
                    </tbody>
                </table>


                </td>
            </tr>
        </tbody>
    </table>

</div>

</body>
</html>