Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1XgiBx-0003Gs-40 for pgsql-performance@arkaria.postgresql.org; Tue, 21 Oct 2014 22:46:13 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1XgiBv-000289-V2 for pgsql-performance@arkaria.postgresql.org; Tue, 21 Oct 2014 22:46:12 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1XgiBu-00027v-Qd for pgsql-performance@postgresql.org; Tue, 21 Oct 2014 22:46:10 +0000 Received: from smtp-out1.gransy.com ([77.78.126.51]) by magus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1XgiBq-0001jm-R3 for pgsql-performance@postgresql.org; Tue, 21 Oct 2014 22:46:09 +0000 Received: from smtp-out.gransy.com (localhost [127.0.0.1]) by smtp-out1.gransy.com (Postfix) with ESMTP id 59C8336004D for ; Wed, 22 Oct 2014 00:46:05 +0200 (CEST) Received: from smtp.gransy.com (smtp.simplia.cz [77.78.126.20]) by smtp-out1.gransy.com (Postfix) with ESMTP id 0EB3B360005; Wed, 22 Oct 2014 00:46:05 +0200 (CEST) Received: from 2.emaily.eu (elizabeth.gransy.com [89.187.132.199]) (Authenticated sender: tv@fuzzy.cz) by smtp.gransy.com (Postfix) with ESMTPA id A2E8819A010A; Wed, 22 Oct 2014 00:46:04 +0200 (CEST) Received: from 194.224.59.233 (SquirrelMail authenticated user tv@fuzzy.cz) by 2.emaily.eu with HTTP; Wed, 22 Oct 2014 00:46:04 +0200 Message-ID: <958a02c0cf34f31136a23edf4a1ca401.squirrel@2.emaily.eu> In-Reply-To: References: Date: Wed, 22 Oct 2014 00:46:04 +0200 Subject: Re: ERROR: out of memory | with 23GB cached 7GB reserved on 30GB machine From: "Tomas Vondra" To: "Montana Low" Cc: pgsql-performance@postgresql.org User-Agent: SquirrelMail/1.4.22 MIME-Version: 1.0 Content-Type: text/plain;charset=utf-8 Content-Transfer-Encoding: 8bit X-Priority: 3 (Normal) Importance: Normal X-Pg-Spam-Score: -1.9 (-) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-performance Precedence: bulk Sender: pgsql-performance-owner@postgresql.org Dne 22 Říjen 2014, 0:25, Montana Low napsal(a): > I'm running postgres-9.3 on a 30GB ec2 xen instance w/ linux kernel > 3.16.3. > I receive numerous Error: out of memory messages in the log, which are > aborting client requests, even though there appears to be 23GB available > in > the OS cache. > > There is no swap on the box. Postgres is behind pgbouncer to protect from > the 200 real clients, which limits connections to 32, although there are > rarely more than 20 active connections, even though postgres > max_connections is set very high for historic reasons. There is also a 4GB > java process running on the box. > > > > > relevant postgresql.conf: > > max_connections = 1000 # (change requires restart) > shared_buffers = 7GB # min 128kB > work_mem = 40MB # min 64kB > maintenance_work_mem = 1GB # min 1MB > effective_cache_size = 20GB > > > > sysctl.conf: > > vm.swappiness = 0 > vm.overcommit_memory = 2 This means you have 'no overcommit', so the amount of memory is limited by overcommit_ratio + swap. The default value for overcommit_ratio is 50% RAM, and as you have no swap that effectively means only 50% of the RAM is available to the system. If you want to verify this, check /proc/meminfo - see the lines CommitLimit (the current limit) and Commited_AS (committed address space). Once the committed_as reaches the limit, it's game over. There are different ways to fix this, or at least improve that: (1) increasing the overcommit_ratio (clearly, 50% is way too low - something 90% might be more appropriate on 30GB RAM without swap) (2) adding swap (say a small ephemeral drive, with swappiness=10 or something like that) Tomas -- Sent via pgsql-performance mailing list (pgsql-performance@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-performance