pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
How can I find the source of postgresql per-connection memory leaks?
2+ messages / 2 participants
[nested] [flat]

* How can I find the source of postgresql per-connection memory leaks?
@ 2017-01-12 17:08  Eric Jensen <ericcj@gmail.com>
  0 siblings, 1 reply; 2+ messages in thread

From: Eric Jensen @ 2017-01-12 17:08 UTC (permalink / raw)
  To: pgsql-performance

I'm using postgresql 9.5.4 on amazon RDS with ~1300 persistent connections
from rails 4.2 with "prepared_statements: false". Over the course of hours
and days, the "Freeable Memory" RDS stat continues to go down indefinitely
but jumps back up to a relatively small working set every time we reconnect
(restart our servers). If we let it go too long, it goes all the way to
zero and the database instance really does start to go into swap and
eventually fail. Subtracting the freeable memory over days from the peaks
when we restart we see that there are 10's of MB per connection on average.

[image: enter image description here]
Digging into the per-pid RSS from enhanced monitoring, we see the same slow
growth on example connection pids but the total RSS seems to just be a
proxy for actual memory usage per connection (
https://www.depesz.com/2012/06/09/how-much-ram-is-postgresql-using/).

[image: enter image description here]

How can I either:

Change the default.postgres9.5 parameters below to avoid unbounded memory
growth per-connection
Determine what queries cause this unbounded growth and change them to
prevent it
Determine what type of buffering/caching is causing this unbounded growth
so that I can use that to do either of the above

[image: enter image description here]

^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: How can I find the source of postgresql per-connection memory leaks?
@ 2017-01-12 17:18  Joshua D. Drake <jd@commandprompt.com>
  parent: Eric Jensen <ericcj@gmail.com>
  0 siblings, 0 replies; 2+ messages in thread

From: Joshua D. Drake @ 2017-01-12 17:18 UTC (permalink / raw)
  To: Eric Jensen <ericcj@gmail.com>; pgsql-performance

On 01/12/2017 09:08 AM, Eric Jensen wrote:
> I'm using postgresql 9.5.4 on amazon RDS with ~1300 persistent
> connections from rails 4.2 with "prepared_statements: false". Over the
> enter image description here

PostgreSQL on RDS is a closed product. My recommendation would be to 
contact Amazon support. They are likely to be able to provide you with 
better support.

Sincerely,

JD



-- 
Command Prompt, Inc.                  http://the.postgres.company/
                         +1-503-667-4564
PostgreSQL Centered full stack support, consulting and development.
Everyone appreciates your honesty, until you are honest with them.
Unless otherwise stated, opinions are my own.


-- 
Sent via pgsql-performance mailing list (pgsql-performance@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-performance



^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2017-01-12 17:18 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2017-01-12 17:08 How can I find the source of postgresql per-connection memory leaks? Eric Jensen <ericcj@gmail.com>
2017-01-12 17:18 ` Joshua D. Drake <jd@commandprompt.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox