Return-Path: Delivered-To: apmail-jakarta-tomcat-user-archive@apache.org Received: (qmail 74085 invoked from network); 8 Nov 2002 07:58:08 -0000 Received: from unknown (HELO nagoya.betaversion.org) (192.18.49.131) by daedalus.apache.org with SMTP; 8 Nov 2002 07:58:08 -0000 Received: (qmail 23872 invoked by uid 97); 8 Nov 2002 07:58:25 -0000 Delivered-To: qmlist-jakarta-archive-tomcat-user@jakarta.apache.org Received: (qmail 23825 invoked by uid 97); 8 Nov 2002 07:58:24 -0000 Mailing-List: contact tomcat-user-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Tomcat Users List" Reply-To: "Tomcat Users List" Delivered-To: mailing list tomcat-user@jakarta.apache.org Received: (qmail 23810 invoked by uid 98); 8 Nov 2002 07:58:23 -0000 X-Antivirus: nagoya (v4218 created Aug 14 2002) Message-ID: <3DCB6E5C.5080301@convio.com> Date: Fri, 08 Nov 2002 01:57:16 -0600 From: David Crooke User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.1) Gecko/20020826 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Tomcat Users List Subject: Re: How to allocate memory to JVM References: <4053EFFD.E306C830@saysit.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N Ob.Note: This is a JVM and Linux question, not a Tomcat question - there are more suitable lists. Briefly, use the JVM parameters -ms and -mx to control the initial and maximum Java heap size. A busy JVM will take a total OS-level memory footprint (as shown by RSS in /usr/bin/top) of about 50-75Mb more than this (JVM executable, stack etc.). Memory pages are only allocated when used, irrespective of -ms value. For performance tuning a dedicated Java appserver, set -mx to as much memory as you can comfortably allocate to heap while making sure the JVM process will NEVER get paged or swapped, and that you leave enough memory for other functions such as disk cacheing. If you're running Apache on the same box (we're not) then save a bit of RAM for it, etc. A Java web application doesn't like being paged by most OS kernels; locality of memory references is not congruent, this ain't FORTRAN. Set -ms to the same as -mx and make sure the hotspot compiler etc. is on. Be wary of giant heap sizes on Java 1.2 and older as large garbage collections can stall the VM for long periods. Linux gives strong (in fact I think absolute) preference to process memory pages over disk buffer cache pages, so the JVM *will* get the physical RAM if it's there, if -mx is set apporpriately and if the JVM does not have to compete with other processes. If -ms is less than -mx, the VM will try to garbage collect before extending the heap, and will extend it in little bits (e.g. 8Mb at a time) which is just messy. If your app has agressive cacheing, use a background thread to proactively manage your own cache unloading (weak references are, well, weak) and kick the GC up the butt every now and then. Some real numbers: we run Sun JDK 1.2.2 with green threads, and run two JVM's on each box (dual Pentium 3, Linux 2.2). The boxes have 2Gb of physical RAM each, and we run the VM heaps with -mx of 768Mb each (total 1.5Gb) leaving 512Mb for the OS, two JVM images / working areas, a couple of side processes such as sendmail, and that leaves about 150Mb of buffer cache. We did not ever find any of the 1.3 JVM's (IBM or Sun) we tested to be stable enough for long term production use - however Sun's 1.4.x on Linux 2.4 is looking promising. achana@saysit.com wrote: >Hi ! >How does one allocate physical RAM to the JVM on a Linux RH box ? >How does one change existing allocation. >Keeping my fingers crossed. >TIA > >-- >To unsubscribe, e-mail: >For additional commands, e-mail: > > > -- To unsubscribe, e-mail: For additional commands, e-mail: