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
REUSE_PORT: define in Linux #487
Conversation
For some reason syscall.SO_REUSEPORT is not defined for Linux/amd64,386. Hack around this by taking the value 0x0200 and play with build tags. Also add code that sets these values on the socket. I've only locally tested this with an UDP server, don't know if there are any regression for TCP (or improvements)
This came up in coredns/perf-tests#4 |
Hmmm, in isolation the test works:
|
something, something, reuse:
|
For some weird reason the srv.inFlight sync.WaitGroup is not zero once we reach the Shutdown() code. I have no idea why. |
Commenting setting reuse fixes it so somehow they really related.... |
http://lxr.free-electrons.com/source/include/uapi/asm-generic/socket.h#L25 where did you get constant from? It's not failing with 15 for me but fails with 0x0200 |
It's not the WaitGroup (doing a |
@asergeyev ghe. I got the value from some page I can't find anymore :( Original patch going in kernel I think. Anyway seems to match values in Golang:
|
Prints 15 for me. See http://lxr.free-electrons.com/ident?i=SO_REUSEPORT risc stuff says 0x200, others set to 15 I don't know what OSX would do. |
Hmmm. Ghe :) Good be. Then interesting why: I'll double check. Also try your value. Seems legit. |
Also, also what does 0x200 do then??? |
It's not my value, it's what 4.10.9-200.fc25.x86_64 printed for me. I don't know kernel deep enough to know what would happen upon receiving 0x200. I'd expect some error and in case of test C program I actually get ENOPROTOOPT |
Really not adding anything but it's worth to review: |
Confused about the figures... Now everything on my machine is fast and I can't reproduce the original case of getting 45K qps :/ Running |
BenchmarkServe should not be changed since it's single goroutine that reads from single socket handle. |
Thanks for double checking me on this whole thread @asergeyev |
This doesn't help. Active perf testing of CoreDNS (and thus Go DNS) is happening in github.com/coredns/perf-tests |
Set SO_REUSEADDR on the UDP socket for improved performance.