From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 406 invoked by alias); 24 Jan 2011 18:45:40 -0000 Received: (qmail 395 invoked by uid 22791); 24 Jan 2011 18:45:39 -0000 X-SWARE-Spam-Status: No, hits=-1.9 required=5.0 tests=AWL,BAYES_00,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from g6t0185.atlanta.hp.com (HELO g6t0185.atlanta.hp.com) (15.193.32.62) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 24 Jan 2011 18:45:34 +0000 Received: from g5t0012.atlanta.hp.com (g5t0012.atlanta.hp.com [15.192.0.49]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by g6t0185.atlanta.hp.com (Postfix) with ESMTPS id DBBF524086; Mon, 24 Jan 2011 18:45:32 +0000 (UTC) Received: from BOEHM1 (m208-135.dsl.rawbw.com [198.144.208.135]) by g5t0012.atlanta.hp.com (Postfix) with ESMTPSA id 9D75910006; Mon, 24 Jan 2011 18:45:31 +0000 (UTC) Date: Mon, 24 Jan 2011 18:45:00 -0000 From: Hans Boehm To: Ben Keppler cc: David Daney , Florian Weimer , "java@gcc.gnu.org" Subject: RE: FW: Garbage collection issues in GCJ In-Reply-To: <3C7F46E08E936B478463BFFA776CDAD3016E67AD@tmsmail.domain2.local> Message-ID: References: <3C7F46E08E936B478463BFFA776CDAD30168E7F7@tmsmail.domain2.local> <4D347D2D.4010101@caviumnetworks.com> <3C7F46E08E936B478463BFFA776CDAD30168E8CA@tmsmail.domain2.local> <87pqro7ghi.fsf@mid.deneb.enyo.de> <4D3DBA9D.5020905@caviumnetworks.com> <3C7F46E08E936B478463BFFA776CDAD3016E67AD@tmsmail.domain2.local> User-Agent: Alpine 2.00 (DEB 1167 2008-08-23) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Mailing-List: contact java-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: java-owner@gcc.gnu.org X-SW-Source: 2011-01/txt/msg00019.txt.bz2 The major mechanism for limiting GC pauses is incremental GC. I suspect that the GC used in GCJ generally supports that. But it requires the client code to follow some rules, and I think that part was never fully debugged for GCJ. The main issue here is that the collector tracks modified pages by catching write faults, but operating systems like Linux don't make this possible if the fault occurs inside a system call. Thus we need to make sure that system calls don't write to parts of the heap that the GC must track. Depending on the heap size, it may sometimes be possible to keep GC pauses acceptable by just making the GC faaster, e.g. by making more of the heap pointer-free. GC pauses are often not that sensitive to the overall heap size, since the sweep phase of the collector always runs incrementally, and the cost of the mark phase depends mostly on the amount of live data. I would be surprised if limiting the heap size solved the problem. The collector itself does support abortable collections, i.e. a mechanism for aborting a collection if the application finds that it needs to get control back. But that essentially discards the work done so far, and I think not too many people have found it useful. This does not currently have GCJ support, but that might be relatively eaasy to add. Hans On Mon, 24 Jan 2011, Ben Keppler wrote: > Hi David, > > I understood your meaning to be what you reiterated in response to > Florian. In fact, in our testing with the Sun JVM, we obtained the > performance characteristics we wanted by turning on the incremental GC > and limiting the size of the eden space so that garbage collections take > as little time as possible. Because we are on a single-core system > without hyperthreading, even non-world-stopping garbage collections must > be limited in duration. > > As far as I can tell, the only possible option with GCJ and the Boehm GC > is limiting the total size of the heap to reduce the pause. However, I > don't think even that is going to be adequate. If GCJ were up on the > latest version of Boehm GC and the incremental mode worked, that might > solve our problem. At this point I think we may be forced into using > the JVM. > > Ben Keppler, Software Engineer > Trident Micro Systems > E-mail: bkeppler@tridentms.com * Voice: 828.684.7474 * Fax: > 8282.684.7874 > > -----Original Message----- > From: David Daney [mailto:ddaney@caviumnetworks.com] > Sent: Monday, January 24, 2011 12:45 PM > To: Florian Weimer > Cc: Ben Keppler; java@gcc.gnu.org > Subject: Re: FW: Garbage collection issues in GCJ > > On 01/22/2011 01:53 PM, Florian Weimer wrote: >> * Ben Keppler: >> >>> Thanks for your response. We have been unable to find documentation >>> detailing how to change the GC configuration including knobs for > setting >>> the max heap size. >> >> GCJ allocates as much memory as your application needs. I think what >> David meant was that you should change your application to put less >> data into the Java heap (either by using the C heap, or by splitting >> it into multiple processes). >> > > No, that is not what I meant at all. > > At some point in any non-trivial program's execution, there will be a > memory allocation request that cannot be met from the existing pools of > free memory. At this point the runtime memory allocator must make a > decision. Should it run a garbage collection cycle to try to free up > some existing memory, or should it get more memory from the operating > system. > > My suggestion was to adjust the policy parameters such that it chooses > the garbage collection option more often. This results in a smaller > total memory footprint, and thus faster garbage collection cycles. The > trade off is that you end up doing more garbage collection and less real > > work. This may be acceptable though, if latency is important. > > David Daney >