X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id AE77B5286E for ; Tue, 5 Jul 2005 13:55:40 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 39778-01 for ; Tue, 5 Jul 2005 16:55:21 +0000 (GMT) Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id 1CC935281B for ; Tue, 5 Jul 2005 13:55:17 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id j65GtGNS023890; Tue, 5 Jul 2005 12:55:16 -0400 (EDT) To: Alexander Stanier Cc: pgsql-performance@postgresql.org Subject: Re: Heavy virtual memory usage on production system In-reply-to: <42CAB1B6.50201@egsgroup.com> References: <42CAB1B6.50201@egsgroup.com> Comments: In-reply-to Alexander Stanier message dated "Tue, 05 Jul 2005 17:13:42 +0100" Date: Tue, 05 Jul 2005 12:55:16 -0400 Message-ID: <23889.1120582516@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.006 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200507/40 X-Sequence-Number: 13281 Alexander Stanier writes: > The database seems to fine to start with, but then as the load increases > it seems to reach a threshold where the number of non-idle queries in > pg_stat_activity grows heavily and we appear to get something similar to > a motorway tail back with up to perhaps 140 queries awaiting processing. > At the same time the virtual memory usage (reported by the OS) appears > to grow heavily too (sometimes up to 50GB). The CPUs do not seems to be > working overly hard nor do the disks and the memory monitor reports > about 600MB of inactive memory. You shouldn't be putting a lot of credence in the virtual memory usage then, methinks. Some versions of top count the Postgres shared memory against *each* backend process, leading to a wildly inflated figure for total memory used. I'd suggest watching the output of "vmstat 1" (or local equivalent) to observe whether there's any significant amount of swapping going on; if not, excessive memory usage isn't the problem. Are you sure that the problem isn't at the level of some query taking an exclusive lock and then sitting on it? I would expect either CPU or disk bandwidth or both to be saturated if you were having a conventional resource limitation problem. Again, comparing vmstat readings during normal and slow response conditions would be instructive. regards, tom lane