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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

馃 [Question]: How does the prefork in Fiber work? #2780

Closed
3 tasks done
hitrop opened this issue Dec 29, 2023 · 4 comments
Closed
3 tasks done

馃 [Question]: How does the prefork in Fiber work? #2780

hitrop opened this issue Dec 29, 2023 · 4 comments

Comments

@hitrop
Copy link

hitrop commented Dec 29, 2023

Question Description

Fasthttp github page suggests a series of steps to improve the performance on multi-core systems (https://github.com/valyala/fasthttp?tab=readme-ov-file#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 the latest version of Go as each version contains performance improvements.

Does go fiber perform these steps in the prefork option?

Checklist:

  • I agree to follow Fiber's Code of Conduct.
  • I have checked for existing issues that describe my questions prior to opening this one.
  • I understand that improperly formatted questions may be closed without explanation.
Copy link

welcome bot commented Dec 29, 2023

Thanks for opening your first issue here! 馃帀 Be sure to follow the issue template! If you need help or want to chat with us, join us on Discord https://gofiber.io/discord

@nickajacks1
Copy link
Member

Prefork will cause fiber to

  • use 1 cpu core per process
  • use SO_REUSEPORT or SO_REUSEADDR depending on the platform

It doesn't look like CPU affinity is set by Fiber when prefork is enabled. It also doesn't look like the child PIDs are directly exposed for you to set the affinity yourself either. That would need to be added to the App API somehow.

Adjusting interrupts must be done manually.

@gaby
Copy link
Member

gaby commented Dec 29, 2023

Duplicate of #180

@gaby gaby marked this as a duplicate of #180 Dec 29, 2023
@ReneWerner87
Copy link
Member

@hitrop does it answer your question?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants