Return-Path: Delivered-To: apmail-cocoon-users-archive@www.apache.org Received: (qmail 15543 invoked from network); 3 Apr 2008 05:57:45 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 3 Apr 2008 05:57:45 -0000 Received: (qmail 91974 invoked by uid 500); 3 Apr 2008 05:57:39 -0000 Delivered-To: apmail-cocoon-users-archive@cocoon.apache.org Received: (qmail 91888 invoked by uid 500); 3 Apr 2008 05:57:39 -0000 Mailing-List: contact users-help@cocoon.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: Reply-To: users@cocoon.apache.org List-Id: Delivered-To: mailing list users@cocoon.apache.org Received: (qmail 91877 invoked by uid 99); 3 Apr 2008 05:57:39 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 02 Apr 2008 22:57:39 -0700 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of joerg.heinicke@gmx.de designates 213.165.64.20 as permitted sender) Received: from [213.165.64.20] (HELO mail.gmx.net) (213.165.64.20) by apache.org (qpsmtpd/0.29) with SMTP; Thu, 03 Apr 2008 05:56:47 +0000 Received: (qmail invoked by alias); 03 Apr 2008 05:57:07 -0000 Received: from c-76-116-243-84.hsd1.pa.comcast.net (EHLO c-76-116-243-84.hsd1.pa.comcast.net) [76.116.243.84] by mail.gmx.net (mp025) with SMTP; 03 Apr 2008 07:57:07 +0200 X-Authenticated: #3483660 X-Provags-ID: V01U2FsdGVkX1++KrMSbv++DqvkS2HZk+zAnzDvWljYugoSJMIMx7 b810Gm93iQVAXQ Message-ID: <47F471B2.1000705@gmx.de> Date: Thu, 03 Apr 2008 01:57:06 -0400 From: Joerg Heinicke User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X; en-US; rv:1.8.1.12) Gecko/20080201 SeaMonkey/1.1.8 MIME-Version: 1.0 To: users@cocoon.apache.org Subject: Re: Javaflow - major memory issue References: <831896.77234.qm@web57911.mail.re3.yahoo.com> In-Reply-To: <831896.77234.qm@web57911.mail.re3.yahoo.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Y-GMX-Trusted: 0 X-Virus-Checked: Checked by ClamAV on apache.org On 02.04.2008 12:24, footh wrote: > Yes, I only applied 642694 as it was the only the link in your previous post. I altered the three > files: > > AbstractContinuable.java > Continuation.java > ContinuationContext.java > > to the files in the links and rebuilt Cocoon, only switching out the javaflow library on my test > instance. Nothing else changed in my test environment from the calculable results I got last > time. I'm using YourKit profiler and the Apache JMeter testing tool with debugging turned off. > > Should I have applied all the fixes you described below? 642694 was supposed to give you the first improvements by limiting the continuation's memory footprint. 642756 is a better fix for the same problem cleaning up even more. In the latter revision I reverted the changes to AbstractContinuable and ContinuationContext and made new changes to Continuation and JavaInterpreter (as outlined below in more details). The other fixes are not necessary and I don't know if you would see improvements from them. BUT your version of the ContinuationsManagerImpl has serious threading issues. Depending on your tests it might happen that you shoot the "expired continuations clean up" thread by creating new continuation at the same time (leads to ConcurrentModificationException). Again for more details read below. COCOON-2109 solves another problem with cleaning up the expired continuations. If this one has effects depends on your actual tests. And again for more details read below :) The best is to have all fixes, yes. Otherwise a certain test run could just have "bad luck" and does not show the improvements. Also do you wait exactly 10 minutes? That's only the time when the first continuations get invalidated, so the clean up thread had hardly any chance to jump in. Do you have better results waiting let's say 15 or 20 minutes? Joerg > --- Joerg Heinicke wrote: > >> On 01.04.2008 18:52, footh wrote: >> >>> Just ran a very simple test using the changes from revision 642694 and had unusual results. >>> >>> Byte arrays, and consequently the BufferedOutputStream still took up large amounts of retained >>> space in the total memory usage. So, this didn't change. >>> >>> However, the memory did not clean up neatly like it did before...after about 10 minutes. >> Before, >>> I would do, say 1000 samples, and total Tomcat memory would balloon to a point. Then I'd wait >> 10 >>> minutes and would observe the byte array data cleaning up in the profiler with total Tomcat >> memory >>> staying the same. After that, I'd run another 1000 samples and the total Tomcat memory would >> not >>> increase again until hitting around the 1000th sample and the cycle would repeat. >>> >>> With these new changes, the memory cleaned up a little bit, but not nearly as much as before. >> And >>> the total memory would start increasing before I hit the control sample size. >>> >>> The BufferedOutputStream path appears to be the same as well - flowing up to >>> ContinuationsManagerImpl. Perhaps I'm doing something wrong? I did make this changes to >> version >>> 2.1.10 NOT 2.1.11 since I haven't upgraded my site to the new version yet. >> That's no good news :( And I can't see how this should be possible. >> >> Which changes exactly did you apply? Only rev 642694 [1]? The actual two >> files changed are ContinuationContext (added method onSuspend()) and >> AbstractContinuable (calling context.onSuspend() right before >> Continuation.suspend()). The method only nulls out some values, so I >> can't see how this should have worsen the situation. Both files had not >> changed between 2.1.10 and 2.1.11, so this can neither be a reason. >> >> Second, this was only the first approach. After Torsten's review I did a >> more "brave" approach setting the complete context to null before the >> continuation gets suspended [2]. Here I reverted the above 2 changes to >> AbstractContiuable and ContinuationsContext. The fix went into >> Continuation (storing functionName and setting context to null in >> suspend()) and JavaInterpreter (instantiating Continuation with >> functionName and retrieving it from there later on). Again I can't see >> how this should have worsen the situation. Both files had again not >> changed since 2.1.10. >> >> Then in order to fix COCOON-2109 [3] I applied another fix [4]. If that >> one helps you at all pretty much depends on whether you access old >> continuations or not (when using a wizard you not only go forward along >> the expected path (page 1, page 2, etc.) but also go back). >> >> The last important fix is for synchronization issues in >> ContinuationsManagerImpl [5]. This definitely has some impact, it's >> usually unlikely that fixing synchronization improves performance. If >> you don't have this fix I can imagine that the situation is as bad as >> you describe it for the following reasons: If something creates a new >> continuation while the clean up thread for removing expired >> continuations is active it kicks the latter one with a >> ConcurrentModificationException - and the clean up just stops. This >> would mean though that it was just bad luck in your new test. >> >> I don't know how exactly you profiled your system. You should definitely >> NOT run on debug log level. I fixed the synchronization issues in favor >> of the debug log level: There are no longer two sets maintained but the >> second set (which was for debugging purposes only) gets recreated "on >> demand", i.e. debug log level, which locks the manager for that time. >> But it should improve the overall situation though. >> >> Joerg >> >> [1] http://svn.apache.org/viewvc?view=rev&revision=642694 >> [2] http://svn.apache.org/viewvc?view=rev&revision=642756 >> [3] https://issues.apache.org/jira/browse/COCOON-2109 >> [4] http://svn.apache.org/viewvc?view=rev&revision=642843 >> [5] http://svn.apache.org/viewvc?view=rev&revision=643295 --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org For additional commands, e-mail: users-help@cocoon.apache.org