Getting OOM errors from PostgreSQL

From: Chris Lajoie <chris(at)etriptrader(dot)com>
To: "pgsql-admin(at)postgresql(dot)org" <pgsql-admin(at)postgresql(dot)org>
Subject: Getting OOM errors from PostgreSQL
Date: 2016-03-04 21:23:02
Message-ID: 77b989891467460b9e1dede8fedd25f1@etriptrader.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

In my log I have been getting errors that look like this:
LOG: could not fork new process for connection: Cannot allocate memory

This seems to only happen during periods of high activity. Shortly after the last one occurred I checked the free mem and got this:
# free -h
total used free shared buff/cache available
Mem: 9.4G 737M 283M 2.1G 8.4G 6.3G
Swap: 2.0G 8.3M 2.0G

From this I see the vast majority of the 10GB of memory is being used by the OS cache. If I understand how it works correctly, this means it is basically free memory because if an application needs it the kernel will free some of it for use... is my understanding correct?

Here are the memory-related settings I am using:

max_connections = 50
shared_buffers = 2000MB
maintenance_work_mem = 500MB
autovacuum_work_mem = 500MB
work_mem = 50MB
temp_buffers = 16MB

Can anyone help me determine what is causing postgresql to be unable to fork a new process because it can't allocate memory?

Chris

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message Kevin Grittner 2016-03-05 16:12:40 Re: Getting OOM errors from PostgreSQL
Previous Message Jehan-Guillaume de Rorthais 2016-03-04 17:28:02 Re: [ADMIN] autovacuum disk IO