spacemonkeygo/openssl

Remove LockOSThread()/UnlockOSThread() throughout

Opened this issue · 0 comments

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. golang/go#21827)