-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Prefork w/reuse port is NOT really faster than multi-threaded #23
Comments
Look at issue #4. He elaborates on his benchmarks and provides some of the background information behind his benchmarks. |
@Annonomus-Penguin I have seen that. But my doubt are something else, first is preffered usage Just to be clear, I am not denying that this solution is fast, it is VERY FAST. And it is 4th in my benchmarks, only loosing to some heavily optimized Java and 2 native C solution. So I think it is great. |
@nanoant , first of all thanks for the benchmark.
Prefork with SO_REUSEPORT scales perfectly when a lot of concurrent client connections (at least thouthands) are established over the real network (preferrably 10Gbit with per-CPU hardware packet queues). See #4 for details. When small number of concurrent client connections are established over localhost, then SO_REUSEPORT usually doesn't give any performance gain (like in your case).
10x performance gain is achieved in synthetic benchmarks - see server benchmark results on the main page. These benchmarks completely skip network API provided by the operating system - they test bare server implementation performance. In real life fasthttp is faster than net/http by up to 3x (when client uses http pipelining) due to network API overhead. As for the source code: Replace io.WriteString(ctx, "Hello World") with ctx.Write(helloWorldBytes) where var helloWorldBytes = []byte("Hello World") This may improve benchmark performance, since it eliminates |
Closing this issue, since this is not a bug. |
Hello I am an author of dumb & simple WebFrameworkBenchmark. It isn't as complete as TechEmpower's one, but the purpose it just to test the framework (router) overhead.
According to your Performance optimization tips for multi-core systems using pre-fork with
SO_REUSEPORT
is preferred way to scale on multicore system.However I get completely opposite numbers, when using
prefork
I get worse results (~440kreq/s) than with multi-threded simpler version (~480kreq).You can find the source for my benchmark at:
https://github.com/nanoant/WebFrameworkBenchmark/blob/master/benchmarks/go-fasthttp/helloworldserver.go
Also another important observation is that is performance increase comparing to
net/http
is around 1.8x, and it is nowhere close to claimed 4x-10x. Thoughts?Therefore I humbly ask you to provide some solid benchmark examples where we can see the performance differences.
The text was updated successfully, but these errors were encountered: