go-siris / siris

DEPRECATED: The community driven fork of Iris. The fastest web framework for Golang!

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Reuse-Port

godofdream opened this issue · comments

The Portlistener can be enhanced. Fasthttp can use something called "reuse_port"
We should implement it

Some infos about it:
https://github.com/valyala/fasthttp/blob/master/reuseport/reuseport.go
https://github.com/valyala/tcplisten

Performance optimization tips for multi-core systems

  • Use reuseport listener.
  • Run a separate server instance per CPU core with GOMAXPROCS=1.
  • Pin each server instance to a separate CPU core using taskset.
  • Ensure the interrupts of multiqueue network card are evenly distributed between CPU cores. See this article for details.
  • Use Go 1.6+ as it provides some considerable performance improvements.

This is only meant to run on Linux/BSD distros? macOS runs POSIX certified BSD core with a custom kernel, but when I turn this feature on (as a test), the server just stops instantly without an error or prompt.

Would there be an explanation for the server instantly shutting down without warnings on macOS? Maybe it's an interpretal thing, or a bug?

Look into go-siris/tcplistener when you find there a bug or something... let me know i dont see any known bugs there.

https://github.com/go-siris/siris/blob/master/vendor/gopkg.in/go-siris/tcplisten.v1/tcplisten.go#L132

On macOS it says it's tcp and thus makes it panic. Would that be a legit alias for tcp4 or is that not safe enough?

Update: If I temporarly alias tcp to tcp4 everything seems to run well. But as I don't have much knowledge of the internal workings, I'm not sure that is the safest way.

Damn, you are right. There is a aliase needed.