netapp.rs: Set SO_REUSEPORT on listen_addr with TcpSocket. #9
Loading…
Reference in a new issue
No description provided.
Delete branch "jpds/netapp:so-reuseport"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Thanks for the patch, but can you explain what this patch does and why it is needed? This won't enable several Garage processes to run on the same port as there can be only one Garage process running (for each node id) due to exclusive locking on the metadata database, and it might even be the cause of confusion/wierd bugs if it somehow allows different Garage processes on the same port that do not handle incomming connections in the same way (e.g. different versions or different node ids). SO_REUSEPORT was intentionnally designed for better load-balancing between several server processes, but that's not something we are doing with Garage.
The documentation is a bit unclear, but I believe it also provides load-balancing across threads as well for TCP: https://man7.org/linux/man-pages/man7/socket.7.html
When enabled, it uses a hashing scheme to distribute load for different connections: https://kb.isc.org/docs/bind-option-reuseport
Caddy also enables this, and similarly has a single process but multiple threads on different CPUs (the
kqread
goes to a different CPU ID with everycurl
request I do):But that's only relevant for many short-lived connections such as HTTP requests. Netapp uses a small number of long-lived TCP connections, so this wouldn't help much. Also, I think even with SO_REUSEPORT it wouldn't change anything for the Tokio listener because we're still using a single socket and
accept()
calls are still made in a single thread, unless special code is added to do effective load-balancing accross threads.If you find any convincing evidence that this changes something performance-wise for Netapp or Garage, feel free to ping me here again, but for now I'm closing this PR. Thanks for the proposal though.
Pull request closed