From: | Andrew Dunstan <andrew(at)dunslane(dot)net> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | Darcy Buskermolen <darcyb(at)commandprompt(dot)com>, pgsql-hackers(at)postgresql(dot)org |
Subject: | Re: Possible Bug: high CPU usage for stats collector in 8.2 |
Date: | 2007-03-01 20:20:05 |
Message-ID: | 45E73575.90706@dunslane.net |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Tom Lane wrote:
> Darcy Buskermolen <darcyb(at)commandprompt(dot)com> writes:
>
>> I'm observing high CPU usage (95%) of a 2.6GHz opteron by the stats
>> collector on an 8.2.3 box investigation has lead me to belive that the
>> stats file is written a lot more often that once every 500ms the
>> following shows this behavior.
>>
>
> Looks like someone broke the usage of PGSTAT_STAT_INTERVAL between 8.1
> and 8.2 ... it's waiting 500 microseconds, not the intended 500
> milliseconds.
>
Good catch. I am also a bit dubious about this code:
input_fd.fd = pgStatSock;
input_fd.events = POLLIN | POLLERR;
input_fd.revents = 0;
if (poll(&input_fd, 1, PGSTAT_SELECT_TIMEOUT * 1000) < 0)
{
if (errno == EINTR)
continue;
ereport(ERROR,
(errcode_for_socket_access(),
errmsg("poll() failed in statistics collector: %m")));
}
got_data = (input_fd.revents != 0);
AIUI you are not supposed to put POLLERR in the events field. We should
probably be setting POLLIN | POLLPRI, and we should also probably check
exactly what event was returned in revents.
cheers
andrew
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2007-03-01 20:42:29 | Re: Possible Bug: high CPU usage for stats collector in 8.2 |
Previous Message | Josh Berkus | 2007-03-01 20:17:50 | Re: Google SoC: lots of discussion, very few mentors |