pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tomas Vondra <tv@fuzzy.cz>
To: pgsql-bugs@postgresql.org
Subject: Re: BUG #12071: Stat collector went crasy (50MB/s constant writes)
Date: Thu, 27 Nov 2014 00:21:42 +0100
Message-ID: <54766086.6090205@fuzzy.cz> (raw)
In-Reply-To: <CAK-MWwQQedwJVk2LJ0g7LXJAr82NSSvOSv6BBAdSGFB8cLkObg@mail.gmail.com>
References: <20141126130810.15507.39189@wrigleys.postgresql.org>
	<CAK-MWwSDmXTWCc3F2Wj3Zw6WZ_3JSKHaXFqZ2TDuq1jfKZOu=A@mail.gmail.com>
	<CAK-MWwQJF+EM5f_47r5wLpr6_2FBYNFeKKAD-DPP3JtzuAM15Q@mail.gmail.com>
	<CAK-MWwTmJV4VprhAfCyTKRLndYbwbToF-Z0JYv6_o=qq3VYxyQ@mail.gmail.com>
	<54763BD8.8020906@fuzzy.cz>
	<CAK-MWwTFTRVuBjLz_rJVNEompGj2btot88G5uwXW+d2DierSNQ@mail.gmail.com>
	<CAK-MWwSK5AUneiF5zyDvc_9pO4ZNTT_G45ZQG1AD+n55s2zzTg@mail.gmail.com>
	<54764BF6.20605@fuzzy.cz>
	<CAK-MWwRzyzX=BfXkMzPGGWCpxgHmc_zBXBYkp74PkYqQLrjtbQ@mail.gmail.com>
	<5476539A.6090506@fuzzy.cz>
	<CAK-MWwQQedwJVk2LJ0g7LXJAr82NSSvOSv6BBAdSGFB8cLkObg@mail.gmail.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>

On 27.11.2014 00:01, Maxim Boguk wrote:
> 
> 
> On Thu, Nov 27, 2014 at 1:26 AM, Tomas Vondra <tv@fuzzy.cz
> <mailto:tv@fuzzy.cz>> wrote:
> 
>     On 26.11.2014 23:06, Maxim Boguk wrote:
>     >
>     >
>     >     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
>     >
>     >
>     >  I mean that usually 99.9% writes goes through mmap, which update the
>     > pgstat.tmp file timestamp (but not update last_statwrite value).
> 
>     I don't follow. Can you explain what you mean by the mmap? I don't see
>     any mmap stuff in pgstat.c, nor I remember dealing with mmap in my
>     patches in this area ...
> 
> 
> Hm I had been wrong. I seen mmap call on strace after every statistic
> collector file rewrite and I thought that all writes to that file goes
> through memory mapped structure instead of full file writes every time
> when someone need fresh data.
> 
> However, point still open - there are no reason to write a new file
> from scratch if no activity had been received from stat socket since
> the last write (the same point valid for per-database stat files in
> 9.3+).

Well, nothing is perfect and patches are always welcome ;-)

For us, the per-db split was enough - it lowered the CPU and I/O load to
the point that adding such 'is dirty' flag would make absolutely no
difference. I do have it on my TODO list, but it's not very high.

> And check
> https://github.com/postgres/postgres/blob/REL9_2_STABLE/src/backend/postmaster/pgstat.c#L3972
> looks like redundant in that case?

Redundant with what?

That's how the backend checks whether the new file has been written (by
postmaster, i.e. a different process). Keep in mind that this happens in
different process than

    if (last_statwrite < last_statrequest)
        pgstat_write_statsfile(false);

which runs in the postmaster (and not in the backend).

Tomas


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



view thread (24+ messages)  latest in thread

Message-ID: <54766086.6090205@fuzzy.cz>
Permalink:  ../54766086.6090205@fuzzy.cz/
Also on:    postgresql.org/message-id/54766086.6090205@fuzzy.cz

 · 

reply

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-bugs@postgresql.org
  Cc: tv@fuzzy.cz
  Subject: Re: BUG #12071: Stat collector went crasy (50MB/s constant writes)
  In-Reply-To: <54766086.6090205@fuzzy.cz>
  References: <20141126130810.15507.39189@wrigleys.postgresql.org> <CAK-MWwSDmXTWCc3F2Wj3Zw6WZ_3JSKHaXFqZ2TDuq1jfKZOu=A@mail.gmail.com> <CAK-MWwQJF+EM5f_47r5wLpr6_2FBYNFeKKAD-DPP3JtzuAM15Q@mail.gmail.com> <CAK-MWwTmJV4VprhAfCyTKRLndYbwbToF-Z0JYv6_o=qq3VYxyQ@mail.gmail.com> <54763BD8.8020906@fuzzy.cz> <CAK-MWwTFTRVuBjLz_rJVNEompGj2btot88G5uwXW+d2DierSNQ@mail.gmail.com> <CAK-MWwSK5AUneiF5zyDvc_9pO4ZNTT_G45ZQG1AD+n55s2zzTg@mail.gmail.com> <54764BF6.20605@fuzzy.cz> <CAK-MWwRzyzX=BfXkMzPGGWCpxgHmc_zBXBYkp74PkYqQLrjtbQ@mail.gmail.com> <5476539A.6090506@fuzzy.cz> <CAK-MWwQQedwJVk2LJ0g7LXJAr82NSSvOSv6BBAdSGFB8cLkObg@mail.gmail.com> <54766086.6090205@fuzzy.cz>

* 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