From: Michael Paquier <michael@paquier.xyz>
To: Joshua White <joshua.white@monash.edu>
Cc: Raghavendra Rao J S V <raghavendrajsv@gmail.com>
Cc: pgsql-general@lists.postgresql.org
Subject: Re: Does idle sessions will consume more cpu and ram? If yes,how to control them
Date: Thu, 20 Dec 2018 10:27:18 +0900
Message-ID: <20181220012718.GI27104@paquier.xyz> (raw)
In-Reply-To: <CAGY1NOnUMH=+RUkEnyF3RyY2Bieruh5A+y-7T_49xoXj47MP3w@mail.gmail.com>
References: <CAEHH7R5wnqTJ3gxiBmVfQLk2CXa2k+xpq24Ma2edCaQm2jntbw@mail.gmail.com>
<CAGY1NOnUMH=+RUkEnyF3RyY2Bieruh5A+y-7T_49xoXj47MP3w@mail.gmail.com>
On Thu, Dec 20, 2018 at 11:32:22AM +1100, Joshua White wrote:
>> In my application, the idle sessions are consuming cpu and ram. refer the
>> ps command output.
>>
>
> If you connect to the database, does select * from pg_stat_activity() show
> a lot of idle connections?
Each backend stores its own copy of the relation cache, so if you have
idle connections which have been used for other work in the past then
the memory of those caches is still around. Idle connections also have
a CPU cost in Postgres when building snapshots for example, and their
entries need to be scanned from a wider array, but usually the relation
cache bloat is a wider problem. This can be countered with pgbouncer as
connection pooling.
--
Michael
Attachments:
signature.asc (application/pgp-signature, 832B) download
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-general@postgresql.org
Cc: michael@paquier.xyz, joshua.white@monash.edu, raghavendrajsv@gmail.com
Subject: Re: Does idle sessions will consume more cpu and ram? If yes,how to control them
In-Reply-To: <20181220012718.GI27104@paquier.xyz>
References: <CAEHH7R5wnqTJ3gxiBmVfQLk2CXa2k+xpq24Ma2edCaQm2jntbw@mail.gmail.com> <CAGY1NOnUMH=+RUkEnyF3RyY2Bieruh5A+y-7T_49xoXj47MP3w@mail.gmail.com> <20181220012718.GI27104@paquier.xyz>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
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