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 1gCLvv-00052e-Sq for pgsql-general@arkaria.postgresql.org; Tue, 16 Oct 2018 09:46:36 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1gCLvu-0000Yh-5r for pgsql-general@arkaria.postgresql.org; Tue, 16 Oct 2018 09:46:34 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1gCLvt-0000YZ-U3 for pgsql-general@lists.postgresql.org; Tue, 16 Oct 2018 09:46:33 +0000 Received: from mx1.mailbox.org ([2001:67c:2050:104:0:1:25:1]) by magus.postgresql.org with esmtps (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gCLvn-0004b4-Uo for pgsql-general@lists.postgresql.org; Tue, 16 Oct 2018 09:46:33 +0000 Received: from smtp2.mailbox.org (unknown [IPv6:2001:67c:2050:105:465:1:2:0]) (using TLSv1.2 with cipher ECDHE-RSA-CHACHA20-POLY1305 (256/256 bits)) (No client certificate requested) by mx1.mailbox.org (Postfix) with ESMTPS id 2376342914; Tue, 16 Oct 2018 11:46:23 +0200 (CEST) X-Virus-Scanned: amavisd-new at heinlein-support.de Received: from smtp2.mailbox.org ([80.241.60.241]) by hefe.heinlein-support.de (hefe.heinlein-support.de [91.198.250.172]) (amavisd-new, port 10030) with ESMTP id FX30Oh37Ug-M; Tue, 16 Oct 2018 11:46:21 +0200 (CEST) Message-ID: <60bbd40bebd9bef763f3e62b79ac621a76db9330.camel@cybertec.at> Subject: Re: Swap on postgres master server From: Laurenz Albe To: Nicola Contu , pgsql-general@lists.postgresql.org Cc: Alessandro Aste Date: Tue, 16 Oct 2018 11:46:20 +0200 In-Reply-To: References: Organization: Cybertec Content-Type: text/plain; charset="UTF-8" Mime-Version: 1.0 Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Nicola Contu wrote: > we are running Postgres 10.5 with master slave replication. > > This server is on Centos 7 and the strange thing is that we see a lot of swap usage : > > [root@usnyh-cmd1 ~]# free -m > total used free shared buff/cache available > Mem: 257652 7555 5559 12804 244536 236036 > Swap: 16383 7326 9057 > > 7GB used. > > But can't see it from any of the commands like top etc. > I am sure it is postgres because it is the only service running on that machine. > > Is there anything we can do? > On the sync slave, the usage is just 400MB. I recommend that you set "vm.swappiness = 0" using "sysctl" to discourage the operating system from swapping as much as possible. Yours, Laurenz Albe -- Cybertec | https://www.cybertec-postgresql.com