From: Tom Lane <tgl@sss.pgh.pa.us>
To: Schmidt, Peter <peter.schmidt@prismedia.com>
Cc: pgsql-hackers@postgreSQL.org
Cc: pgsql-admin@postgreSQL.org
Subject: Re: v7.1b4 bad performance
Date: Fri, 16 Feb 2001 23:43:29 -0500
Message-ID: <2081.982385009@sss.pgh.pa.us> (raw)
In-Reply-To: <F1DC8388AD52D411B83B00D0B774D6EB1928E4@winmail.prismedia.com>
References: <F1DC8388AD52D411B83B00D0B774D6EB1928E4@winmail.prismedia.com>
"Schmidt, Peter" <peter.schmidt@prismedia.com> writes:
> So, is it OK to use commit_delay=0?
Certainly. In fact, I think that's about to become the default ;-)
I have now experimented with several different platforms --- HPUX,
FreeBSD, and two considerably different strains of Linux --- and I find
that the minimum delay supported by select(2) is 10 or more milliseconds
on all of them, as much as 20 msec on some popular platforms. Try it
yourself (my test program is attached).
Thus, our past arguments about whether a few microseconds of delay
before commit are a good idea seem moot; we do not have any portable way
of implementing that, and a ten millisecond delay for commit is clearly
Not Good.
regards, tom lane
/* To use: gcc test.c, then
time ./a.out N
N=0 should return almost instantly, if your select(2) does not block as
per spec. N=1 shows the minimum achievable delay, * 1000 --- for
example, if time reports the elapsed time as 10 seconds, then select
has rounded your 1-microsecond delay request up to 10 milliseconds.
Some Unixen seem to throw in an extra ten millisec of delay just for
good measure, eg, on FreeBSD 4.2 N=1 takes 20 sec, N=20000 takes 30.
*/
#include <stdio.h>
#include <stdlib.h>
#include <sys/stat.h>
#include <sys/time.h>
#include <sys/types.h>
int main(int argc, char** argv)
{
struct timeval delay;
int i, del;
del = atoi(argv[1]);
for (i = 0; i < 1000; i++) {
delay.tv_sec = 0;
delay.tv_usec = del;
(void) select(0, NULL, NULL, NULL, &delay);
}
return 0;
}
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-admin@postgresql.org
Cc: tgl@sss.pgh.pa.us, peter.schmidt@prismedia.com, pgsql-hackers@postgreSQL.org
Subject: Re: v7.1b4 bad performance
In-Reply-To: <2081.982385009@sss.pgh.pa.us>
References: <F1DC8388AD52D411B83B00D0B774D6EB1928E4@winmail.prismedia.com> <2081.982385009@sss.pgh.pa.us>
* 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