Re: BUG #12071: Stat collector went crasy (50MB/s constant writes) - Mailing list pgsql-bugs

From Tomas Vondra
Subject Re: BUG #12071: Stat collector went crasy (50MB/s constant writes)
Date
Msg-id 54764BF6.20605@fuzzy.cz
Whole thread Raw
In response to Re: BUG #12071: Stat collector went crasy (50MB/s constant writes)  (Maxim Boguk <maxim.boguk@gmail.com>)
Responses Re: BUG #12071: Stat collector went crasy (50MB/s constant writes)  (Maxim Boguk <maxim.boguk@gmail.com>)
List pgsql-bugs
On 26.11.2014 22:36, Maxim Boguk wrote:
>>>So yes,  pgstat_send_inquiry definitely issued by autovacuum launcher.
>>>Now question why EVERY pgstat_send_inquiry request from autovacuum
> leads to the 1-2 full >>pgstat.stat rewrite on idle server?
>
> Just another theory
> It happens exactly because the full idle server so no other activity
> which could provide some changes to pgstat.tmp file timestamp.
>
> May be it could be good idea to update timestamp of pgstat.tmp file on
> every PgstatCollectorMain iteration if nothing had been received from
> stat socket?
> Or alternatively internally track the timestamp of the last update
> received from stat socket, and skip file rewrite step if nothing had
> been received since last full rewrite?

I'm not sure I understand what you mean.

The timestamp *IS* updated on every write - see this:

https://github.com/postgres/postgres/blob/REL9_2_STABLE/src/backend/postmaster/pgstat.c#L3469

Otherwise the difference between last_statwrite and last_statrequest
would grow indefinitely (and you're observing it's ~30ms every time).

Tomas

pgsql-bugs by date:

Previous
From: Tomas Vondra
Date:
Subject: Re: BUG #12071: Stat collector went crasy (50MB/s constant writes)
Next
From: Maxim Boguk
Date:
Subject: Re: BUG #12071: Stat collector went crasy (50MB/s constant writes)