-
Notifications
You must be signed in to change notification settings - Fork 236
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
Thread creation overhead due to cgo calls #88
Comments
The library tries to do a good job about only doing short cgo calls: they should all return quickly. Do you have a short example demonstrating the problem? |
Indeed the cgo calls are short because they are not waiting for IO, however internally functions like SSL_do_handshake, SSL_read, SSL_write are making a lot of mutex lock()/unlock() calls. I put a trace in https://github.com/spacemonkeygo/openssl/blob/master/init_posix.go, I see hundreds of calls. This is source of contention and for higher load (2000 handshakes per second on my dev machine) I see a spike in the number of threads created by the runtime and a performance degradation. |
I have the same problem. |
I think it is limit of go GPM |
The connections in Spacemonkey openssl wrapper makes use of cgo calls and this is an issue because it leads to massive number of threads for simultaneous ssl connections. cgo marks all C code as syscall causing scheduler to allocate a new thread if needed. Can this be addressed ?
The text was updated successfully, but these errors were encountered: