New tunable 'sbuf_loopcnt' to limit time spent on one socket.
authorMarko Kreen <markokr@gmail.com>
Wed, 19 Nov 2008 12:06:37 +0000 (12:06 +0000)
committerMarko Kreen <markokr@gmail.com>
Wed, 19 Nov 2008 12:06:37 +0000 (12:06 +0000)
commitac4ab0fc88a17fff8cad6f07da9ff12b1f025276
tree64aaac94d7c69cb3d30e80ef98b3a9db0bcb3402
parentea4fd79e3665a009a1794ee716eec0dcd3365cb5
New tunable 'sbuf_loopcnt' to limit time spent on one socket.

In some situations - eg SMP server, local Postgres and fast network -
pgbouncer can run recv()->send() loop many times without blocking
on either side.  But that means other connections will stall for
a long time.  To make processing more fair, limit the times
of doing recv()->send() one socket.  If count reaches limit,
just proceed processing other sockets.  The processing for
that socket will resume on next event loop.

Thanks to Alexander Schöcke for report and testing.
doc/config.txt
include/bouncer.h
src/main.c
src/sbuf.c