Hello Thomas,
>>> Pgbench is managing clients I/Os manually with select or poll. Much of this
>>> could be managed by libevent.
>>
>> Or maybe libuv (used by nodejs?).
>>
>> From preliminary testing libevent seems not too good at fine grain time
>> management which are used for throttling, whereas libuv advertised that it
>> is good at it, although what it does is yet to be seen.
>
> Do you think our WaitEventSet stuff could be good here, if made
> frontend-friendly?
Interesting question.
AFAICS, the answer is that it could indeed probably fit the task, but it
would require significant work to make it thread-compatible, and to
untangle it from IsUnderPosmaster/postmaster death, memory context,
elog/ereport, and other back-end specific stuff.
If you remove all that with a clean abstraction (quite a task), then once
done the question could be why not use libevent/libuv/… in the backend
instead of maintaining more or less the same thing inside postgres?
So ISTM that as far as pgbench is concerned it would be much simpler to
use libevent/libuv/… directly if the pros are enough and the cons not
redhibitory, and provided that the needed detailed features are really
there.
--
Fabien.