Conversation
|
Does this affect performance? |
about 20% slower in my 100w data set test. (mainly because of ssl enable. if remove lock and enable ssl, the speed is almost the same with lock added.) |
Brpc already piped write requests by linked list and only one bthread calls ssl_write. In data reading, brpc use epoll in edge triggered mode and an atomic variable to make sure there is only one bthread is calling ssl_read. Adding a mutex here will introduce some competition, but it should be very slight. Further this mutex will avoided the competition of using underlay socket fd. So, the impact of this change on performance should be almost none. |
|
LGTM |
|
@jamesge @Huixxi @wwbmmm @chenBright |
|
LGTM |
OpenSSL does not guarantee that any of its objects can be used concurrently by multiple threads:
openssl/openssl#2165
openssl/openssl#20446
Related issue with this PR: #2166
And this PR is not the best solution for this core issue.
The best way is put SSL obj's read/write operate in same event loop but this changes too much of the current code structure, i'm too lazy to do it.