On 6/30/13 2:04 AM, Fabien COELHO wrote:
> My guess is the OS. "PQfinish" or "select" do/are systems calls that
> present opportunities to switch context. I think that the OS is passing
> time with other processes on the same host, expecially postgres
> backends, when it is not with the client.
I went looking for other instances of this issue in pgbench results,
that's what I got lost in the last two weeks. It's subtle because the
clients normally all end in one very short burst of time, but I have
found evidence of PQfinish issues elsewhere. Evidence still seems to
match the theory that throttling highlights this only because it spreads
out the ending a bit more. Also, it happens to be a lot worse on the
Mac I did initial testing with, and I don't have nearly as many Mac
pgbench results.
There's a refactoring possible here that seems to make this whole class
of problem go away. If I change pgbench so that PQfinish isn't called
for any client until *all* of the clients are actually finished with
transactions, the whole issue goes away. I'm going to package that hack
the right way into its own little change, revisit the throttling code,
and then this all should wrap up nicely. I'd like to get this one out
of the commitfest so I can move onto looking at something else.
--
Greg Smith 2ndQuadrant US greg@2ndQuadrant.com Baltimore, MD
PostgreSQL Training, Services, and 24x7 Support www.2ndQuadrant.com