You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
cgo marks all C calls as syscall causing scheduler to allocate a new thread everytime. This leads to scaling issues of applications, Is it possible to make the BIO as non blocking in which case most of the thread lock time will be highly optimized.
The text was updated successfully, but these errors were encountered:
The potential blocking is caused by the contention on the map holding callback pointer parameters. https://github.com/spacemonkeygo/openssl/blob/master/bio.go#L54 . I believe spacemonkeygo uses the mapping defined in mapping.go to help in case the garbage collector moves the GO pointer, so the conversion from C int to the GO pointer is still valid.
This map protected by one global mutex is source of contention, and it matters for high load. I propose replacing with sync.Map or maybe some type of lock-free hash map. This is a simple change.
A more complex change would be to rewrite the BIO callbacks in C (from GO - go_read_bio_read, go_write_bio_ctrl, go_write_bio_write). Benefits are:
cgo marks all C calls as syscall causing scheduler to allocate a new thread everytime. This leads to scaling issues of applications, Is it possible to make the BIO as non blocking in which case most of the thread lock time will be highly optimized.
The text was updated successfully, but these errors were encountered: