Return-Path: X-Original-To: apmail-tomcat-users-archive@www.apache.org Delivered-To: apmail-tomcat-users-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 2B24191F2 for ; Fri, 17 Feb 2012 15:04:17 +0000 (UTC) Received: (qmail 13595 invoked by uid 500); 17 Feb 2012 15:04:13 -0000 Delivered-To: apmail-tomcat-users-archive@tomcat.apache.org Received: (qmail 13552 invoked by uid 500); 17 Feb 2012 15:04:13 -0000 Mailing-List: contact users-help@tomcat.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "Tomcat Users List" Delivered-To: mailing list users@tomcat.apache.org Received: (qmail 13543 invoked by uid 99); 17 Feb 2012 15:04:13 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 17 Feb 2012 15:04:13 +0000 X-ASF-Spam-Status: No, hits=0.7 required=5.0 tests=RCVD_IN_DNSWL_NONE,SPF_NEUTRAL X-Spam-Check-By: apache.org Received-SPF: neutral (nike.apache.org: local policy) Received: from [76.96.62.56] (HELO qmta06.westchester.pa.mail.comcast.net) (76.96.62.56) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 17 Feb 2012 15:04:05 +0000 Received: from omta10.westchester.pa.mail.comcast.net ([76.96.62.28]) by qmta06.westchester.pa.mail.comcast.net with comcast id b2u51i0090cZkys5633kCw; Fri, 17 Feb 2012 15:03:44 +0000 Received: from Christophers-MacBook-Pro.local ([69.143.109.145]) by omta10.westchester.pa.mail.comcast.net with comcast id b33k1i00F38FjT13W33k3Y; Fri, 17 Feb 2012 15:03:44 +0000 Message-ID: <4F3E6C52.5030001@christopherschultz.net> Date: Fri, 17 Feb 2012 10:03:46 -0500 From: Christopher Schultz User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:10.0.1) Gecko/20120208 Thunderbird/10.0.1 MIME-Version: 1.0 To: Tomcat Users List Subject: Re: Free Memory vs. Total Memory vs. Max Memory References: <768FEA3F936926468F594E3CA7741FE803BD6031@ipa-vault.nvipa.com> <4F3E0FAF.60309@ice-sa.com> In-Reply-To: <4F3E0FAF.60309@ice-sa.com> X-Enigmail-Version: 1.3.5 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Virus-Checked: Checked by ClamAV on apache.org -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Eric, On 2/17/12 3:28 AM, André Warnier wrote: > Robinson, Eric wrote: >> What are the possible downsides of setting a low initial memory >> pool and a high max pool? If a tomcat app usually needs >> approximately 64MB of heap space, but sometimes as much as >> 300-400MB, would it cause any problems to set the initial pool to >> 16M and the max pool to 512M? >> > It depends... ;-) > > If you set different values to -Xms (at start) and -Xmx (maximum), > then the JVM will spend some amount of time allocating and > de-allocating Heap memory dynamically as needed, to stay within > these boundaries. If they are equal, then the JVM allocates it at > start, and never has to worry about it later. If your application > needs 64MB of Heap space and you allocate only -Xms16M, then right > at the start the JVM will have to increase the Heap to 64MB > (minimum); so why would you do that ? I'll add a bit to André's comments: I can see the lure of "only taking what you need" and allowing the JVM to automatically re-size the memory space: that way, you only take up a huge chunk of memory during peak load and not all the time. But why? If you are going to need, say, 512MiB at peak load, you're going to need that memory available whether or not it is allocated to the JVM itself at any given time. If that's the case, why not let the JVM have that memory all the time? Freeing the memory manager from having to re-size the heap (and that means re-sizing the various pools within the entire heap as well) will definitely improve your performance. Remember that "giving back" memory to the OS isn't as simple as just drawing a line at the top of the heap and chopping-off the empty top: each pool must be re-sized to its new size, moving objects around all over the place so that the top of the heap is empty and *then* releasing the memory. It used to be that the JVM would never release memory it had claimed, so if you have -Xmx512M and you hit that limit at peak load, then your heap would never go smaller than that. I don't know if it's the case any longer because I always set Xms=Xmx so that I don't have the memory manager wasting all that time. Hope that helps, - -chris -----BEGIN PGP SIGNATURE----- Version: GnuPG/MacGPG2 v2.0.17 (Darwin) Comment: GPGTools - http://gpgtools.org Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAk8+bFIACgkQ9CaO5/Lv0PBcegCgmE1OHDV2djU0MXY3vRggaNnZ YhMAn2prZeN9RjC5MTUfDC+KKS2aGCSz =EGpQ -----END PGP SIGNATURE----- --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org For additional commands, e-mail: users-help@tomcat.apache.org