Re: pg_test_fsync performance

From: Bruce Momjian <bruce(at)momjian(dot)us>
To: Marko Kreen <markokr(at)gmail(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Robert Haas <robertmhaas(at)gmail(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: pg_test_fsync performance
Date: 2012-02-15 15:17:00
Message-ID: 20120215151700.GB13011@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, Feb 14, 2012 at 08:23:10PM -0500, Bruce Momjian wrote:
> On Wed, Feb 15, 2012 at 01:35:05AM +0200, Marko Kreen wrote:
> > On Tue, Feb 14, 2012 at 05:59:06PM -0500, Tom Lane wrote:
> > > Bruce Momjian <bruce(at)momjian(dot)us> writes:
> > > > On Mon, Feb 13, 2012 at 08:28:03PM -0500, Tom Lane wrote:
> > > >> +1, I was about to suggest the same thing. Running any of these tests
> > > >> for a fixed number of iterations will result in drastic degradation of
> > > >> accuracy as soon as the machine's behavior changes noticeably from what
> > > >> you were expecting. Run them for a fixed time period instead. Or maybe
> > > >> do a few, then check elapsed time and estimate a number of iterations to
> > > >> use, if you're worried about the cost of doing gettimeofday after each
> > > >> write.
> > >
> > > > Good idea, and it worked out very well. I changed the -o loops
> > > > parameter to -s seconds which calls alarm() after (default) 2 seconds,
> > > > and then once the operation completes, computes a duration per
> > > > operation.
> > >
> > > I was kind of wondering how portable alarm() is, and the answer
> > > according to the buildfarm is that it isn't.
> >
> > I'm using following simplistic alarm() implementation for win32:
> >
> > https://github.com/markokr/libusual/blob/master/usual/signal.c#L21
> >
> > this works with fake sigaction()/SIGALARM hack below - to remember
> > function to call.
> >
> > Good enough for simple stats printing, and avoids win32-specific
> > code spreading around.
>
> Wow, I wasn't even aware this compiled in Win32; I thought it was
> ifdef'ed out. Anyway, I am looking at SetTimer as a way of making this
> work. (Me wonders if the GoGrid Windows images have compilers.)
>
> I see backend/port/win32/timer.c so I might go with a simple "create a
> thread, sleep(2), set flag, exit" solution.

Yeah, two Windows buildfarm machines have now successfully compiled my
patches, so I guess I fixed it; patch attached.

The fix was surprisingly easy given the use of threads; scheduling the
timeout in the operating system was just too invasive.

I would like to eventually know if this fix actually produces the right
output. How would I test that? Are the buildfarm output binaries
available somewhere? Should I add this as a 9.2 TODO item?

--
Bruce Momjian <bruce(at)momjian(dot)us> http://momjian.us
EnterpriseDB http://enterprisedb.com

+ It's impossible for everything to be true. +

Attachment Content-Type Size
test_fsync.diff text/x-diff 2.2 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Amit Kapila 2012-02-15 15:24:27 Re: client performance v.s. server statistics
Previous Message Christoph Berg 2012-02-15 15:16:52 Re: [trivial patch] typo in doc/src/sgml/sepgsql.sgml