Return-Path: Delivered-To: apmail-incubator-esme-dev-archive@minotaur.apache.org Received: (qmail 52219 invoked from network); 30 Nov 2009 22:51:50 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 30 Nov 2009 22:51:50 -0000 Received: (qmail 60485 invoked by uid 500); 30 Nov 2009 22:51:50 -0000 Delivered-To: apmail-incubator-esme-dev-archive@incubator.apache.org Received: (qmail 60423 invoked by uid 500); 30 Nov 2009 22:51:50 -0000 Mailing-List: contact esme-dev-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: esme-dev@incubator.apache.org Delivered-To: mailing list esme-dev@incubator.apache.org Received: (qmail 60413 invoked by uid 99); 30 Nov 2009 22:51:50 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 30 Nov 2009 22:51:50 +0000 X-ASF-Spam-Status: No, hits=2.2 required=10.0 tests=HTML_MESSAGE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of markus.kohler@gmail.com designates 209.85.217.225 as permitted sender) Received: from [209.85.217.225] (HELO mail-gx0-f225.google.com) (209.85.217.225) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 30 Nov 2009 22:51:41 +0000 Received: by gxk25 with SMTP id 25so1149997gxk.0 for ; Mon, 30 Nov 2009 14:51:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:date:message-id:subject :from:to:content-type; bh=qechfqQP9n1qzgUnPKWBIOEecj33XlpRU/HimfJKvL0=; b=cksr+G+KTHnRP73rOH5IltgKBgM50uMPuuJnMagZvQ0LfGhY86rK6hJaIqOAW3EGMc WtbdOwhsyu2rSnhM00WVjgsNSV/d5UAfs6K0TjwT3g7Lm3hQXHJWgbaXiHGMyTq8MJZq RN+hVZHCHD0OT97Cm8sKTZJUuhJ/xSrr18J1o= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type; b=CZ15ey9yWCjKAz6LlpuHEThlUIj6jR6IZGgLYwugh5PAqZvX0MyR1Ky6i0LzH5qQmI 1M9wfBNRq6g+IIBvcfwztqBuOffDqw1YMSSKwRz7OY49Wq0uNJKK401vuEBRM4uPCxgq 2hbAvYw9MpXZIgR44RIo/Iozw9yK551J4RZCQ= MIME-Version: 1.0 Received: by 10.91.74.11 with SMTP id b11mr7209143agl.39.1259621480689; Mon, 30 Nov 2009 14:51:20 -0800 (PST) Date: Mon, 30 Nov 2009 23:51:20 +0100 Message-ID: <771905290911301451o7c81ac97pc3ca4d62fe1ca722@mail.gmail.com> Subject: Memory allocation analysis Episode II (details) From: Markus Kohler To: esme-dev@incubator.apache.org Content-Type: multipart/alternative; boundary=0016e644c6eae8752b04799e7a62 X-Virus-Checked: Checked by ClamAV on apache.org --0016e644c6eae8752b04799e7a62 Content-Type: text/plain; charset=ISO-8859-1 Hi all, Here come some details about my memory allocation analysis done after Vassil fixed the most important issue. -we are at 4,93Mbyte temporary allocated for one message send - 2,7Mbyte alone are allocated for char[]. There's seems to be some easy optimization possible, because 1,5Mbyte is allocated in StringBuilder.expandCapacity. This is caused by scala not preallocating the StringBuilder with the correct size in List.mkString. The reason for this behaviour is that mkString is not implemented in List but in the more abstract Iterator. Iterator doesn't have a length (for a good reason) and therefore mkString has no idea how large the StringBuilder has to be at the end. I believe (without looking at the Scala source code so far) that mkString should be reimplemented in List. We can probably go around this issue somehow, until some does implement a better List.mkString in scala (have to check the scala sources, whether that's possible at all). I think as soon as we fixed this, we should maybe stop with the memory allocation optimizations, because we are already very good, and we should do more tests before we put more effort into this topic. The rest of the allocations are pretty minor. It's interesting the ListBuffer is used not sure whether that is the best choice here. I will provide an profiler report, for those how want to look into this. I will send the corresponding profiling reports to Dick. - I haven't done a heap dump yet. I want to do 2 of them to compute the amount of memory for one user. Regards, Markus "The best way to predict the future is to invent it" -- Alan Kay On Fri, Nov 27, 2009 at 5:28 PM, Markus Kohler wrote: > Hi all, > In short, We are down from 90Mbyte to *19Mbyte* for sending one message > and I believe it should be possible to get under 10Mbyte without too much > effort. With 10 Mbyte we would comply to the performance standard of some > major ERP vendor, but honestly I believe we should be able to do even better > ;-) > > Out of the 19Mbyte(maybe even only 11, it's bit hard to get reproducible > results) 9,9 are consumed by scala.xml.XML$.loadString(java.lang.String) > mainly because every time the routine is called, a new Parser is > instantiated. In addition javax.xml.parsers.SAXParserFactory.newInstance() > is called, which hits (unless that has changed in recent JDK's) the file > system to find out which XML parser is configured. *I think ideally this > should be fixed in the Scala sources. * > > The issue with the message formatted 300 times when all users are logged on > still seems to be there, at least the GC log suggests that, but I guess > David will attack that soon. I will send around the profiling reports later > on. > > Regards, > Markus > > > "The best way to predict the future is to invent it" -- Alan Kay > --0016e644c6eae8752b04799e7a62--