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

Remove LockOSThread()/UnlockOSThread() throughout #90

Open
pvoicu opened this issue May 3, 2018 · 0 comments
Open

Remove LockOSThread()/UnlockOSThread() throughout #90

pvoicu opened this issue May 3, 2018 · 0 comments

Comments

@pvoicu
Copy link

pvoicu commented May 3, 2018

LockOSThread() is not needed anywhere in spacemonkeygo. Using it is detrimental because:

  • in case of high load, with many opened connections, the Golang runtime creates a lot of Kernel threads. For example hundreds or even thousands of threads even if the number of processors is 24 for example. Reason is given here https://golang.org/pkg/runtime/debug/#SetMaxThreads: "A Go program creates a new thread only when a goroutine is ready to run but all the existing threads are blocked in system calls, cgo calls, or are locked to other goroutines due to use of runtime.LockOSThread.". These goes against the power of Golang: multiplexing tens of thousands of goroutines over a very small number of threads.
  • minor performance degradation (see for ex. runtime: big performance penalty with runtime.LockOSThread golang/go#21827)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant