Received: from localhost (unknown [200.46.204.183]) by postgresql.org (Postfix) with ESMTP id 8012C650224 for ; Wed, 27 Aug 2008 18:45:38 -0300 (ADT) Received: from postgresql.org ([200.46.204.86]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 45893-03 for ; Wed, 27 Aug 2008 18:45:29 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from bifrost.lang.hm (mail.lang.hm [64.81.33.126]) by postgresql.org (Postfix) with ESMTP id 53D5565018B for ; Wed, 27 Aug 2008 18:45:33 -0300 (ADT) Received: from asgard.lang.hm (asgard.lang.hm [10.0.0.100]) by bifrost.lang.hm (8.13.4/8.13.4/Debian-3) with ESMTP id m7RLjKlG012759; Wed, 27 Aug 2008 14:45:20 -0700 Date: Wed, 27 Aug 2008 14:45:47 -0700 (PDT) From: david@lang.hm X-X-Sender: dlang@asgard.lang.hm To: Florian Weimer cc: henk de wit , pgsql-performance@postgresql.org Subject: Re: select on 22 GB table causes "An I/O error occured while sending to the backend." exception In-Reply-To: <82bpze3ou8.fsf@mid.bfk.de> Message-ID: References: <82bpze3ou8.fsf@mid.bfk.de> User-Agent: Alpine 1.10 (DEB 962 2008-03-14) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests=none X-Spam-Level: X-Archive-Number: 200808/356 X-Sequence-Number: 31237 On Wed, 27 Aug 2008, Florian Weimer wrote: > * henk de wit: > >> On this table we're inserting records with a relatively low >> frequency of +- 6~10 per second. We're using PG 8.3.1 on a machine >> with two dual core 2.4Ghz XEON CPUs, 16 GB of memory and Debian >> Linux. The machine is completely devoted to PG, nothing else runs on >> the box. > > Have you disabled the OOM killer? my understanding of the OOM killer is that 'disabling' it is disabling memory overcommit, making it impossible for you to get into a situation where the OOM killer would activate, but this means that any load that would have triggered the OOM killer will always start getting memory allocation errors before that point. the OOM killer exists becouse there are many things that can happen on a system that allocate memory that 'may' really be needed, but also 'may not' really be needed. for example if you have a process that uses 1G of ram (say firefox) and it needs to start a new process (say acroread to handle a pdf file), what it does is it forks the firefox process (each of which have 1G of ram allocated), and then does an exec of the acroread process (releasing the 1G of ram previously held by that copy of the firefox process) with memory overcommit enabled (the default), the kernel recognises that most programs that fork don't write to all the memory they have allocated, so it marks the 1G of ram that firefox uses as read-only, and if either copy of firefox writes to a page of memory it splits that page into seperate copies for the seperate processes (and if at this time it runs of of memory it invokes the OOM killer to free some space), when firefox does an exec almost immediatly after the fork it touches basicly none of the pages, so the process only uses 1G or ram total. if memory overcommit is disabled, the kernel checks to see if you have an extra 1G of ram available, if you do it allows the process to continue, if you don't it tries to free memory (by throwing away cache, swapping to disk, etc), and if it can't free the memory will return a memroy allocation error (which I believe will cause firefox to exit). so you can avoid the OOM killer, but the costs of doing so are that you make far less efficiant use of your ram overall. David Lang