LindaSummer commented on code in PR #2461:
URL: https://github.com/apache/kvrocks/pull/2461#discussion_r1701972560
##########
src/server/worker.h:
##########
@@ -88,9 +91,10 @@ class Worker : EventCallbackBase<Worker>,
EvconnlistenerBase<Worker> {
UniqueEvent timer_;
std::thread::id tid_;
std::vector<evconnlistener *> listen_events_;
- std::mutex conns_mu_;
- std::map<int, redis::Connection *> conns_;
- std::map<int, redis::Connection *> monitor_conns_;
+ mutable std::mutex conns_mu_; // refer to
https://github.com/oneapi-src/oneTBB/issues/183, traverse and erase should
Review Comment:
Hi @mapleFU ,
Thanks for your suggestions and help! ❤
I will add the tbb's code reference in comment.
> Would you mind add // guarded by for the protected element?
Of course, I will add comments for resources protected by mutex in next
patches.
> would a extra lock and synchronization break the potential performance
speedup and causing the performance worse than before?
Yes, during my development, I also concern about the performance of using
both `tbb::concurrent_hash_map` and `std::mutex`. Maybe a simple read-write
shared_mutex have a better performance and cleaner logic.
Best Regards,
Edward
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]