Curiosity-Driven Inquiry: Why a Global Map for Socket Management #2115
FreeYourSoul
started this conversation in
General
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hello,
When a large number of sockets are instantiated and accessed across multiple threads, each message sent (via any function in the
nng_send
family) triggers a lookup in a global map that is protected by a mutex. Doesn't this create a potential point of contention? Are there benchmarks available that demonstrate this overhead is negligible, or is it simply that using many sockets is not recommended—in favor of utilizing Scalability Protocols, which are intended to eliminate the need for numerous sockets?Overall, I'm curious about the rationale behind this design decision: why employ a global map instead of transferring the responsibility of managing socket lifetimes to the library user?
Thank you.
Beta Was this translation helpful? Give feedback.
All reactions