[PATCH] reuse_port option for multiple server instances

Alex Rousskov rousskov at measurement-factory.com
Mon Jan 11 16:44:06 UTC 2016

On 01/11/2016 07:09 AM, Harry Mason wrote:
> This patch allows multiple polygraph-server instances to bind to the
> same address and port. The intended use is to easily spread CPU load
> across multiple cores. Enable it by adding "reuse_port = true" to the
> Server block.

Thank you! Please note that according to our tests with Squid on
Linux[1], sharing the listening socket does not automatically balance
the load among the listening processes due to unfortunate TCP stack
listener selection algorithms in the kernel. I believe the last
paragraph in the article you cited[2] may hint at a similar problem.


[2] https://lwn.net/Articles/542738/

Do you see any harm in enabling server port reuse on all platforms where
it is supported, without adding a PGL option to control this behavior?
The only negative side effect I can see is where the test is
misconfigured to listen on a server port already used by another program
(e.g., httpd). In that case, reusing the port may mask a serious
configuration flaw, right?

> Binding a new socket can reset existing connections which are part of
> the way through a TCP handshake, so start all server instances before
> starting any clients. See https://lwn.net/Articles/542738/

FWIW, starting servers before clients is the best practice regardless of
port reuse.

Thank you,


More information about the Users mailing list