Re: pgbench throttling latency limit

From: Heikki Linnakangas <hlinnakangas(at)vmware(dot)com>
To: Rukh Meski <rukh(dot)meski(at)gmail(dot)com>, Fabien COELHO <coelho(at)cri(dot)ensmp(dot)fr>
Cc: PostgreSQL Developers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: pgbench throttling latency limit
Date: 2014-08-27 08:08:11
Message-ID: 53FD91EB.8000603@vmware.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 08/27/2014 03:47 AM, Rukh Meski wrote:
> Hi Fabien,
>
> On Tue, Aug 26, 2014 at 04:07 AM, Fabien COELHO <coelho(at)cri(dot)ensmp(dot)fr> wrote:
>>
>> Please find attached a new version which fixes these two points.
>
> Indeed it does. Marking the patch ready for a committer.

I find the definition of the latency limit a bit strange. It's a limit
on how late a transaction can *start* compared to it's scheduled
starting time, not how long a query is allowed to last. How do figure
out what it should be set to?

That model might make some sense if you think e.g. of a web application,
where the web server has a timeout for how long it waits to get a
database connection from a pool, but once a query is started, the
transaction is considered a succeess no matter how long it takes. The
latency limit would be that timeout. But I think a more useful model is
that when the user clicks a button, he waits at most X seconds for the
result. If that deadline is exceeded, the web server will give a 404, or
the user will simply get bored and go away, and the transaction is
considered a failure.

So I think a more useful model is that new queries arrive at a given
rate, and each query is expected to finish in X milliseconds from its
arrival time (i.e the time the query is scheduled to begin, not the time
it was sent to the server) or it's counted as failed. If a transaction
cannot even be started by that deadline, because the connection is still
busy with the previous query, it's counted as failed without even
sending it to the server.

With that definition, it makes sense to specify the latency limit even
without --rate. In that case, it's simply a limit on how long each
query's execution is allowed to last until it's considered as failed.
IOW, each query's scheduled start time is when the previous query ends.

- Heikki

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2014-08-27 08:30:26 Re: postgresql latency & bgwriter not doing its job
Previous Message Heikki Linnakangas 2014-08-27 07:47:39 Re: Allow multi-byte characters as escape in SIMILAR TO and SUBSTRING