Received: from localhost (maia-3.hub.org [200.46.204.184]) by postgresql.org (Postfix) with ESMTP id ADBBD9FB480 for ; Fri, 2 Mar 2007 19:28:36 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.184]) (amavisd-new, port 10024) with ESMTP id 45265-04 for ; Fri, 2 Mar 2007 19:28:29 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey-1.7.4 Received: from lists.commandprompt.com (host-254.commandprompt.net [207.173.203.254]) by postgresql.org (Postfix) with ESMTP id F391F9FB399 for ; Fri, 2 Mar 2007 19:23:32 -0400 (AST) Received: from [192.168.1.50] (or-67-76-146-141.sta.embarqhsd.net [67.76.146.141]) (authenticated bits=0) by lists.commandprompt.com (8.13.7/8.13.6) with ESMTP id l22NNPIA017483 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 2 Mar 2007 15:23:25 -0800 Message-ID: <45E8B209.1040209@commandprompt.com> Date: Fri, 02 Mar 2007 15:23:53 -0800 From: "Joshua D. Drake" Organization: Command Prompt, Inc. User-Agent: Thunderbird 1.5.0.9 (X11/20070103) MIME-Version: 1.0 To: Bruce Momjian CC: Tom Lane , Benjamin Minshall , pgsql-performance@postgresql.org Subject: Re: stats collector process high CPU utilization References: <200703022306.l22N6dc21565@momjian.us> In-Reply-To: <200703022306.l22N6dc21565@momjian.us> X-Enigmail-Version: 0.94.0.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Virus-Scanned: ClamAV version 0.88.5, clamav-milter version 0.88.5 on projects.commandprompt.com X-Virus-Status: Clean X-Greylist: Sender succeded SMTP AUTH authentication, not delayed by milter-greylist-1.6 (lists.commandprompt.com [192.168.2.159]); Fri, 02 Mar 2007 15:23:26 -0800 (PST) X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=1.089 tagged_above=0 required=5 tests=AWL, BAYES_50, BIZ_TLD, FORGED_RCVD_HELO X-Spam-Level: * X-Archive-Number: 200703/74 X-Sequence-Number: 23479 Bruce Momjian wrote: > Sorry, I introduced this bug. To the gallows with you! :) Don't feel bad, there were several hackers that missed the math on that one. Joshua D. Drake > > --------------------------------------------------------------------------- > > Tom Lane wrote: >> Benjamin Minshall writes: >>> Tom Lane wrote: >>>> It's sounding like what you had was just transient bloat, in which case >>>> it might be useful to inquire whether anything out-of-the-ordinary had >>>> been done to the database right before the excessive-CPU-usage problem >>>> started. >>> I don't believe that there was any unusual activity on the server, but I >>> have set up some more detailed logging to hopefully identify a pattern >>> if the problem resurfaces. >> A further report led us to realize that 8.2.x in fact has a nasty bug >> here: the stats collector is supposed to dump its stats to a file at >> most every 500 milliseconds, but the code was actually waiting only >> 500 microseconds :-(. The larger the stats file, the more obvious >> this problem gets. >> >> If you want to patch this before 8.2.4, try this... >> >> Index: pgstat.c >> =================================================================== >> RCS file: /cvsroot/pgsql/src/backend/postmaster/pgstat.c,v >> retrieving revision 1.140.2.2 >> diff -c -r1.140.2.2 pgstat.c >> *** pgstat.c 26 Jan 2007 20:07:01 -0000 1.140.2.2 >> --- pgstat.c 1 Mar 2007 20:04:50 -0000 >> *************** >> *** 1689,1695 **** >> /* Preset the delay between status file writes */ >> MemSet(&write_timeout, 0, sizeof(struct itimerval)); >> write_timeout.it_value.tv_sec = PGSTAT_STAT_INTERVAL / 1000; >> ! write_timeout.it_value.tv_usec = PGSTAT_STAT_INTERVAL % 1000; >> >> /* >> * Read in an existing statistics stats file or initialize the stats to >> --- 1689,1695 ---- >> /* Preset the delay between status file writes */ >> MemSet(&write_timeout, 0, sizeof(struct itimerval)); >> write_timeout.it_value.tv_sec = PGSTAT_STAT_INTERVAL / 1000; >> ! write_timeout.it_value.tv_usec = (PGSTAT_STAT_INTERVAL % 1000) * 1000; >> >> /* >> * Read in an existing statistics stats file or initialize the stats to >> >> >> regards, tom lane >> >> ---------------------------(end of broadcast)--------------------------- >> TIP 1: if posting/reading through Usenet, please send an appropriate >> subscribe-nomail command to majordomo@postgresql.org so that your >> message can get through to the mailing list cleanly > -- === The PostgreSQL Company: Command Prompt, Inc. === Sales/Support: +1.503.667.4564 || 24x7/Emergency: +1.800.492.2240 Providing the most comprehensive PostgreSQL solutions since 1997 http://www.commandprompt.com/ Donate to the PostgreSQL Project: http://www.postgresql.org/about/donate PostgreSQL Replication: http://www.commandprompt.com/products/