Re: Memory Leak executing small queries without closing the connection - FreeBSD

From: Gerhard Wiesinger <lists(at)wiesinger(dot)com>
To: Bill Moran <wmoran(at)potentialtech(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-general(at)postgresql(dot)org
Subject: Re: Memory Leak executing small queries without closing the connection - FreeBSD
Date: 2015-12-13 21:23:19
Message-ID: 566DE1C7.3010208@wiesinger.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 13.12.2015 21:14, Bill Moran wrote:
> Wait ... this is a combined HTTP/Postgres server? You didn't mention that
> earlier, and it's kind of important.
>
> What evidence do you have that Postgres is actually the part of
> this system running out of memory?

For me the complete picture doesn't look consistent.

> I don't see any such evidence in any of
> your emails, and (based on experience) I find it pretty likely that whatever
> is running under node is doing something in a horrifically memory-inefficient
> manner. Since you mention that you see nothing in the PG logs, that makes it
> even more likely (to me) that you're looking entirely in the wrong place.
>
> I'd be willing to bet a steak dinner that if you put the web server on a
> different server than the DB, that the memory problems would follow the
> web server and not the DB server.

Changes in config:
track_activity_query_size = 102400
work_mem = 100MB

Ok, we restarted PostgreSQL and had it stopped for seconds, and logged
top every second:

When PostgreSQL was down nearly all memory was freed, looks good to me.
So it is likely that node and other processes are not the cause.
Mem: 742M Active, 358M Inact, 1420M Wired, 21G Cache, 871M Buf, 8110M Free
Swap: 512M Total, 477M Used, 35M Free, 93% Inuse

When PostgreSQL restarted, Inactive was growing fast (~1min):
Mem: 7998M Active, 18G Inact, 2763M Wired, 1766M Cache, 1889M Buf, 1041M
Free
Swap: 512M Total, 472M Used, 41M Free, 92% Inuse

After some few minutes we are back again at the same situation:
Mem: 8073M Active, 20G Inact, 2527M Wired, 817M Cache, 1677M Buf, 268M Free
Swap: 512M Total, 472M Used, 41M Free, 92% Inuse

The steak dinner is mine :-) Donating to the PostgreSQL community :-)

Any further ideas, I don't think this is normal system behaviour.

Ciao,
Gerhard

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tim Smith 2015-12-13 21:23:51 Re: Postgresql INET select and default route ?
Previous Message Bill Moran 2015-12-13 20:14:25 Re: Memory Leak executing small queries without closing the connection - FreeBSD