Re: Memory Leak executing small queries without closing the connection - FreeBSD - Mailing list pgsql-general

From Gerhard Wiesinger
Subject Re: Memory Leak executing small queries without closing the connection - FreeBSD
Date
Msg-id 566DE1C7.3010208@wiesinger.com
Whole thread Raw
In response to Re: Memory Leak executing small queries without closing the connection - FreeBSD  (Bill Moran <wmoran@potentialtech.com>)
Responses Re: Memory Leak executing small queries without closing the connection - FreeBSD  (Bill Moran <wmoran@potentialtech.com>)
Re: Memory Leak executing small queries without closing the connection - FreeBSD  (Adrian Klaver <adrian.klaver@aklaver.com>)
List 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



pgsql-general by date:

Previous
From: Bill Moran
Date:
Subject: Re: Memory Leak executing small queries without closing the connection - FreeBSD
Next
From: Tim Smith
Date:
Subject: Re: Postgresql INET select and default route ?