Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1XtluC-0004uy-AM for pgsql-bugs@arkaria.postgresql.org; Wed, 26 Nov 2014 23:21:52 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1XtluB-0007VO-Qj for pgsql-bugs@arkaria.postgresql.org; Wed, 26 Nov 2014 23:21:51 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1XtluA-0007VF-OW for pgsql-bugs@postgresql.org; Wed, 26 Nov 2014 23:21:50 +0000 Received: from smtp-out1.gransy.com ([77.78.126.51]) by makus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1Xtlu6-0007Yn-NQ for pgsql-bugs@postgresql.org; Wed, 26 Nov 2014 23:21:49 +0000 Received: from smtp-out.gransy.com (localhost [127.0.0.1]) by smtp-out1.gransy.com (Postfix) with ESMTP id D7ADA360038 for ; Thu, 27 Nov 2014 00:21:43 +0100 (CET) Received: from smtp.gransy.com (smtp.simplia.cz [77.78.126.20]) by smtp-out1.gransy.com (Postfix) with ESMTP id 9502E360005 for ; Thu, 27 Nov 2014 00:21:43 +0100 (CET) Received: from [192.168.1.163] (ip-78-45-139-138.net.upcbroadband.cz [78.45.139.138]) (Authenticated sender: tv@fuzzy.cz) by smtp.gransy.com (Postfix) with ESMTPSA id 5D5F619A0456 for ; Thu, 27 Nov 2014 00:21:43 +0100 (CET) Message-ID: <54766086.6090205@fuzzy.cz> Date: Thu, 27 Nov 2014 00:21:42 +0100 From: Tomas Vondra User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.2.0 MIME-Version: 1.0 To: pgsql-bugs@postgresql.org Subject: Re: BUG #12071: Stat collector went crasy (50MB/s constant writes) References: <20141126130810.15507.39189@wrigleys.postgresql.org> <54763BD8.8020906@fuzzy.cz> <54764BF6.20605@fuzzy.cz> <5476539A.6090506@fuzzy.cz> In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Pg-Spam-Score: -1.9 (-) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org On 27.11.2014 00:01, Maxim Boguk wrote: > > > On Thu, Nov 27, 2014 at 1:26 AM, Tomas Vondra > 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