-
Notifications
You must be signed in to change notification settings - Fork 156
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Uneven incoming connection distribution to worker processes with SO_REUSEPORT #142
Comments
Submitted pull request #144 to move front-end listener socket initialisation to individual worker processes. At a beta deployment in production this change seems to have resolved the issue related to uneven distribution of incoming connection across Hitch worker processes. Took the hint for this change from https://lwn.net/Articles/542629/
In order to appropriately use SO_REUSEPORT each worker/thread should have a different socket-handle, this does move away from the current Hitch implementation where we had a socket initialised and bonded only once in master process. |
Any chance of this particular change also being pushed upstream. |
Thanks for taking this up. I can confirm that this does indeed work and help a bit in current stable Debian derivative production environment since past year or so... |
We've seen lumpy distributions of requests to workers, which seems to parallel what some other projects have seen [0][1]. The solution (as best we can tell) is to take advantage of the SO_REUSEPORT that eventlet's been setting for us since basically forever [2]. [0] https://lwn.net/Articles/542629/ [1] varnish/hitch#142 [2] eventlet/eventlet@f9a3074a3 Change-Id: I83cdaa2cbd394cbd49609c65bf9c5ed026c55417
* Update swift from branch 'master' - Merge "Bind a new socket per-worker" - Bind a new socket per-worker We've seen lumpy distributions of requests to workers, which seems to parallel what some other projects have seen [0][1]. The solution (as best we can tell) is to take advantage of the SO_REUSEPORT that eventlet's been setting for us since basically forever [2]. [0] https://lwn.net/Articles/542629/ [1] varnish/hitch#142 [2] eventlet/eventlet@f9a3074a3 Change-Id: I83cdaa2cbd394cbd49609c65bf9c5ed026c55417
The usage for option SO_REUSEPORT was recently updated in
9eb1bc9
However, there is an additional issue with using the specific option in the current-code flow which affect high volume traffic sites being serviced by Hitch.
The initial patch in Linux kernel 3.9 for the said option SO_REUSEPORT does explain the intended use to be a case where we can have multiple (unrelated) processes bind to the same IP:PORT pair if and only if the first process chooses to create the first binding with this specific option enabled and the connection would be distributed among the interest processes based on a hash of source/destination ip:port pairs.
The behavior observed in Debian (Jessie/Whezzy) is that it leads to uneven distribution (pretty skewed) of incoming connection to different worker processes, with the initial/first process get 'most' of the connection (till the RX queue associated with the first core gets full)
The text was updated successfully, but these errors were encountered: