Skip to content
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

TcpSocket#Bind(): also set SO_REUSEPORT #6901

Merged
merged 1 commit into from Feb 4, 2019
Merged

Conversation

Al2Klimov
Copy link
Member

fixes #6898

@dnsmichi
Copy link
Contributor

dnsmichi commented Feb 4, 2019

Relatively new with Kernel 3.9 (that's why I didn't know it existed). Reading about it makes me believe that this could solve problems with the API thread pool later on as well.

https://stackoverflow.com/questions/14388706/socket-options-so-reuseaddr-and-so-reuseport-how-do-they-differ-do-they-mean-t
https://medium.com/uckey/the-behaviour-of-so-reuseport-addr-1-2-f8a440a35af6

http://man7.org/linux/man-pages/man7/socket.7.html

        SO_REUSEPORT (since Linux 3.9)
              Permits multiple AF_INET or AF_INET6 sockets to be bound to an
              identical socket address.  This option must be set on each
              socket (including the first socket) prior to calling bind(2)
              on the socket.  To prevent port hijacking, all of the pro‐
              cesses binding to the same address must have the same effec‐
              tive UID.  This option can be employed with both TCP and UDP
              sockets.

              For TCP sockets, this option allows accept(2) load distribu‐
              tion in a multi-threaded server to be improved by using a dis‐
              tinct listener socket for each thread.  This provides improved
              load distribution as compared to traditional techniques such
              using a single accept(2)ing thread that distributes connec‐
              tions, or having multiple threads that compete to accept(2)
              from the same socket.

              For UDP sockets, the use of this option can provide better
              distribution of incoming datagrams to multiple processes (or
              threads) as compared to the traditional technique of having
              multiple processes compete to receive datagrams on the same
              socket.

@dnsmichi dnsmichi added this to the 2.10.3 milestone Feb 4, 2019
@dnsmichi dnsmichi added bug Something isn't working area/api REST API labels Feb 4, 2019
Copy link
Contributor

@dnsmichi dnsmichi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks 👍

@dnsmichi dnsmichi merged commit 77572c4 into master Feb 4, 2019
@dnsmichi dnsmichi deleted the bugfix/so_reuseport-6898 branch February 4, 2019 13:21
@dnsmichi dnsmichi added the backported Fix was included in a bugfix release label Feb 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/api REST API backported Fix was included in a bugfix release bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

API action restart-process fails on FreeBSD
2 participants