{"action":"created","issue":{"url":"https://api.github.com/repos/chriskohlhoff/asio/issues/101","repository_url":"https://api.github.com/repos/chriskohlhoff/asio","labels_url":"https://api.github.com/repos/chriskohlhoff/asio/issues/101/labels{/name}","comments_url":"https://api.github.com/repos/chriskohlhoff/asio/issues/101/comments","events_url":"https://api.github.com/repos/chriskohlhoff/asio/issues/101/events","html_url":"https://github.com/chriskohlhoff/asio/issues/101","id":138983932,"number":101,"title":"Is it really necessary to have a global mutex protecting calls to SSL_accept?","user":{"login":"dkadashev","id":1396608,"avatar_url":"https://avatars.githubusercontent.com/u/1396608?v=3","gravatar_id":"","url":"https://api.github.com/users/dkadashev","html_url":"https://github.com/dkadashev","followers_url":"https://api.github.com/users/dkadashev/followers","following_url":"https://api.github.com/users/dkadashev/following{/other_user}","gists_url":"https://api.github.com/users/dkadashev/gists{/gist_id}","starred_url":"https://api.github.com/users/dkadashev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dkadashev/subscriptions","organizations_url":"https://api.github.com/users/dkadashev/orgs","repos_url":"https://api.github.com/users/dkadashev/repos","events_url":"https://api.github.com/users/dkadashev/events{/privacy}","received_events_url":"https://api.github.com/users/dkadashev/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2016-03-07T13:57:00Z","updated_at":"2016-03-10T11:02:44Z","closed_at":null,"body":"`SSL_accept()` call inside of `ssl::detail::engine::do_accept()` is protected by a global mutex. Not surprisingly this is a huge bottleneck.\r\n\r\nOpenSSL doc says that \"Provided an application sets up the thread callback function\" OpenSSL is thread-safe (https://www.openssl.org/docs/faq.html#PROG1). I think the mutex was originally added here: https://sourceforge.net/p/asio/patches/1/ - could it be the case that back then either thread locking callback was not configured [properly] or there was an error in testing? Does the OpenSSL doc lie?\r\n\r\nThe mutex contention heavily limits achievable request rates."},"comment":{"url":"https://api.github.com/repos/chriskohlhoff/asio/issues/comments/194792357","html_url":"https://github.com/chriskohlhoff/asio/issues/101#issuecomment-194792357","issue_url":"https://api.github.com/repos/chriskohlhoff/asio/issues/101","id":194792357,"user":{"login":"dkadashev","id":1396608,"avatar_url":"https://avatars.githubusercontent.com/u/1396608?v=3","gravatar_id":"","url":"https://api.github.com/users/dkadashev","html_url":"https://github.com/dkadashev","followers_url":"https://api.github.com/users/dkadashev/followers","following_url":"https://api.github.com/users/dkadashev/following{/other_user}","gists_url":"https://api.github.com/users/dkadashev/gists{/gist_id}","starred_url":"https://api.github.com/users/dkadashev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dkadashev/subscriptions","organizations_url":"https://api.github.com/users/dkadashev/orgs","repos_url":"https://api.github.com/users/dkadashev/repos","events_url":"https://api.github.com/users/dkadashev/events{/privacy}","received_events_url":"https://api.github.com/users/dkadashev/received_events","type":"User","site_admin":false},"created_at":"2016-03-10T11:02:44Z","updated_at":"2016-03-10T11:02:44Z","body":"We did several stress tests on an 8-core box with patched ASIO that doesn't protect `SSL_accept()` with mutex. No crashes / errors / memory leaks observed after ~65M requests at ~1350 requests per second (CPU was maxed out, mostly by SSL code).\r\n\r\nLooks like the mutex is not necessary as OpenSSL docs suggest."}}