Re: Increase in max_connections

From: Bruce Momjian <bruce(at)momjian(dot)us>
To: "Anand Kumar, Karthik" <Karthik(dot)AnandKumar(at)classmates(dot)com>
Cc: John R Pierce <pierce(at)hogranch(dot)com>, "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: Increase in max_connections
Date: 2014-03-26 20:54:39
Message-ID: 20140326205439.GB475@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Wed, Mar 26, 2014 at 08:22:01PM +0000, Anand Kumar, Karthik wrote:
> Looking a little deeper, I saw signs of memory being heavily fragmented:
>
> root(at)site-db01b:/var/log # cat /proc/buddyinfo
> Node 0, zone DMA 1 1 2 2 2 1 0 0 1 1 3
> Node 0, zone DMA32 8 7 8 7 10 8 7 11 9 5 92
> Node 0, zone Normal 13069 0 0 0 0 0 0 0 0 0 1
> Node 1, zone Normal 652315 36885 1168 0 1 1 0 1 1 1 0
>
>
> Node 0 has 13069 4k blocks, and zero 8k blocks available to use
> Which is likely what caused the problem, I'd think.
>
> A little while later though, buddyinfo changed and suddenly there was a
> lot more memory in 8k blocks.
>
> root(at)site-db01b:/proc # cat /proc/buddyinfo
> Node 0, zone DMA 1 1 2 2 2 1 0
> 0 1 1 3
> Node 0, zone DMA32 8 7 8 7 10 8 7
> 11 9 5 92
> Node 0, zone Normal 9645 5495 1115 0 0 0 0
> 0 0 0 1
> Node 1, zone Normal 409734 10953 1 0 1 1 0
> 1 1 1 0
>
> (Note the change in the Node 0 line, 8k blocks went up from 0 to 5495)
>
> Anyone have any idea why memory was so fragmented, and what causes memory
> to be defragged? Is it something postgres does? Are there any kernel
> specific settings that control it?

If I had to take a guess, it is zone_reclaim; see:

http://frosty-postgres.blogspot.com/2012/08/postgresql-numa-and-zone-reclaim-mode.html

The fix is this sysctl:

vm.zone_reclaim_mode = 0

--
Bruce Momjian <bruce(at)momjian(dot)us> http://momjian.us
EnterpriseDB http://enterprisedb.com

+ Everyone has their own god. +

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2014-03-26 21:03:05 Re: PgAdmin errors
Previous Message John R Pierce 2014-03-26 20:28:58 Re: PgAdmin errors