-
Notifications
You must be signed in to change notification settings - Fork 208
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
Replace mutex with ReadWriteLock in CipherManager #981
Conversation
Everyone wants to get rid of locks. You need to test in a multi threaded environment before claiming locks are useless. Even if ReadWriteLock is a bit slower, it lets more threads through than a mutex. But in this case, I think |
That is not the point I was raising. The locks (whether monitors or read-write) are necessary for synchronizing access to the cache - when there is one.
Which is why the above micro benchmark was run using 4 threads to maximize contention.
The benchmark result appears to indicate the opposite.
This is exactly the point I was trying to raise 👍 |
Let's remove the unnecessary caches instead |
CipherManager seems to be accessed a lot, but uses a mutex. So I replaced it with a ReadWriteLock.