Return-Path: Delivered-To: apmail-tomcat-users-archive@www.apache.org Received: (qmail 38972 invoked from network); 29 Nov 2005 16:06:22 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 29 Nov 2005 16:06:22 -0000 Received: (qmail 29832 invoked by uid 500); 29 Nov 2005 16:06:05 -0000 Delivered-To: apmail-tomcat-users-archive@tomcat.apache.org Received: (qmail 29818 invoked by uid 500); 29 Nov 2005 16:06:04 -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 29807 invoked by uid 99); 29 Nov 2005 16:06:04 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 29 Nov 2005 08:06:04 -0800 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: local policy) Received: from [82.70.116.177] (HELO mail.melandra.com) (82.70.116.177) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 29 Nov 2005 08:07:33 -0800 Content-Class: urn:content-classes:message Subject: RE: heap size problems (speed) [2] MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Date: Tue, 29 Nov 2005 16:05:37 -0000 X-MimeOLE: Produced By Microsoft Exchange V6.0.6603.0 Message-ID: X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: heap size problems (speed) [2] thread-index: AcX0bVF89SNaw5OkRxyKQWCyClruVwAjz5eA From: "Peter Crowther" To: "Tomcat Users List" X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N > From: Cristian S [mailto:cs@nightwish.eu.org]=20 > Frankly I have no ideea what's the point of loading almost=20 > 400M of data in memory in a HashMap. > Maybe this very approach has a design flaw when it comes to JAVA. If it's expensive to generate / load that data and the app has tight response time restrictions, and if there's enough RAM to keep the data in main memory without paging, and if the heap is large enough to allow other processing to take place, and if the map is set up so that there are few collisions, then the map is a very sensible approach. That's a lot of ifs. I'd try the following: - Check for paging traffic on your server. Are other apps causing Tomcat to be paged out, leading to expensive disk I/O when the map is accessed? - Follow Chuck's suggestion to check for garbage collection activity. If possible, try increasing the Java heap size (and check for paging activity on the server). - Talk to your dev team to find out how well or badly the map is keyed. A HashMap with a lot of entries can be slow if the hash for the key is poor. I'd expect to see high CPU usage *or* high paging activity if this was the case, as the server will either spend a lot of its time hashing or have to load a lot of pages from backing store to examine them for hash keys. Neither is pleasant. Java HashMaps aren't inherently slow; something's poorly configured. Those are a few guesses, no more than that. I also suspect it's *not* your CPU cache size. Yes, going to RAM is slower than loading from a processor cache line, but it's still a *lot* faster than retrieving a row from the database. I'd be looking elsewhere. Intel have spent a lot of money making people think that the CPU is the only contributor to overall system speed; RAM and disk I/O speeds play a much larger part these days. - Peter --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org For additional commands, e-mail: users-help@tomcat.apache.org