On Mon, Apr 29, 2013 at 8:27 AM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
Fabien COELHO <coelho@cri.ensmp.fr> writes: > Please find attached a small patch to add a throttling capability to > pgbench, that is pgbench aims at a given client transaction rate instead > of maximizing the load. The throttling relies on Poisson-distributed > delays inserted after each transaction.
I'm having a hard time understanding the use-case for this feature. Surely, if pgbench is throttling its transaction rate, you're going to just end up measuring the throttle rate.
While I don't understand the part about his laptop battery, I think that there is a good use case for this. If you are looking at latency distributions or spikes, you probably want to see what they are like with a load which is like the one you expect having, not the load which is the highest possible. Although for this use case you would almost surely be using custom transaction files, not default ones, so I think you could just use \sleep. However, I don't know if there is an easy way to dynamically adjust the sleep value by subtracting off the overhead time and randomizing it a bit, like is done here.
It does seem to me that we should Poissonize the throttle time, then subtract the average overhead, rather than Poissonizing the difference.