Received: from malur.postgresql.org ([2a02:16a8:dc51::56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1g5PpH-0005CQ-Df for pgsql-general@arkaria.postgresql.org; Thu, 27 Sep 2018 06:31:03 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1g5PpE-00019n-Bz for pgsql-general@arkaria.postgresql.org; Thu, 27 Sep 2018 06:31:00 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1g5PpD-00019g-SZ for pgsql-general@lists.postgresql.org; Thu, 27 Sep 2018 06:31:00 +0000 Received: from smtp.burggraben.net ([2a01:4f8:140:50a2::3:1]) by makus.postgresql.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1g5Pp9-0007bS-4a for pgsql-general@lists.postgresql.org; Thu, 27 Sep 2018 06:30:58 +0000 Received: from localhost (localhost [127.0.0.1]) by smtp.burggraben.net (Postfix) with ESMTP id C9E466002F6 for ; Thu, 27 Sep 2018 08:30:50 +0200 (CEST) X-Spam-Scanned: by amavisd-new at exwg.net Received: from smtp.burggraben.net ([127.0.0.1]) by localhost (ns.burggraben.net [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id z3YXq1uAXesz for ; Thu, 27 Sep 2018 08:30:40 +0200 (CEST) Received: from squirrel.exwg.net (p5B2D8A4F.dip0.t-ipconnect.de [91.45.138.79]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "squirrel.exwg.net", Issuer "Christoph Moench-Tegeder" (verified OK)) by smtp.burggraben.net (Postfix) with ESMTPS for ; Thu, 27 Sep 2018 08:30:40 +0200 (CEST) Received: by squirrel.exwg.net (Postfix, from userid 1000) id 76D50E0826D; Thu, 27 Sep 2018 08:30:39 +0200 (CEST) Date: Thu, 27 Sep 2018 08:30:39 +0200 From: Christoph Moench-Tegeder To: pgsql-general@lists.postgresql.org Subject: Re: Out of Memory Message-ID: <20180927063039.n5ea4xuefxtrbusa@squirrel.exwg.net> References: <1537536021272-0.post@n3.nabble.com> <1537900459605-0.post@n3.nabble.com> <18741.1537906384@sss.pgh.pa.us> <1537909379739-0.post@n3.nabble.com> <1537971881585-0.post@n3.nabble.com> <3321.1537972628@sss.pgh.pa.us> <1537973357976-0.post@n3.nabble.com> <1537979068444-0.post@n3.nabble.com> <1537979569920-0.post@n3.nabble.com> <824208787ca76bb05c1076b72629e394c6ed660b.camel@cybertec.at> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <824208787ca76bb05c1076b72629e394c6ed660b.camel@cybertec.at> User-Agent: NeoMutt/20170113 (1.7.2) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk ## Laurenz Albe (laurenz.albe@cybertec.at): > vm.overcommit_memory = 2 > vm_overcommit_ratio = 100 > > Linux commits (swap * overcommit_ratio * RAM / 100), ^ That should be a "+". See Documentation/sysctl/vm.txt and Documentation/vm/overcommit-accounting.rst in your kernel tree. > so without any swap the correct value would be 100. > > I don't know how safe it is to got entirely without swap. That's completely safe. Even more: if your production machine ever needs swap, it's already mostly dead in the water. So there's also no benefit in having the kernel copy stuff to swap "just in case" (read: set sysctl vm.swappiness to 0) and use the swap disk space for something more productive. If your memory usage ever exceeds available memory, something already went horribly wrong, and you want to know about it right now. A good way to know about this kind of mistakes is having stuff fail hard, obviously and loudly (i.e. Out Of Memory). Do not try to save some day by swapping: stuff is "sometimes slow" and if you really need the swap, everything crawls to a halt anyway. Of course, this does not hold for personal workstations and the like where you might want to use the swap space for suspend to disk, or have some buffer in case of runaway processes. Regards, Christoph -- Spare Space.