-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
nsqlookupd: use map for producers - with benchmarks #1038
Conversation
After that, I realized: we usually look-up topics, not channels, which my benchmark was looking up producers for. And it looks like there's some "filtering" code that kicks in sometimes. I should probably benchmark looking up producers of topics. So I split out topic-lookup benchmarks. The results were pretty much the same as for channel lookup. But I realized that the typical |
09e0aaa
to
0dbe591
Compare
and the results:
It's probably a good idea to add benchmarks for typical lookup-protocol IDENTIFY and REGISTER operations (mostly |
Results for the new REGISTER bench:
|
@ploxiln Thanks for the more detailed benchmark. The new scheme's decreased performance may be due to the map allocation and adjustment. But the lookup is called periodically and the register is only called on the start of nsqd and new consumer connections. |
3x slower lookup may be an OK tradeoff for 10x faster register and 30x faster disconnect. nsqd do disconnect and reconnect now and then, especially in large clusters. Absolute numbers are also good to consider: the new slower topic-lookup is 100us, while the old slower disconnect-related registrations-lookup is 16000us. (The Register benchmark is a bit harder to interpret, a single iteration includes a whole set of producers. So for the old slower value for 512 topics and 2048 producers, it's 12 seconds / 2048 producers = 6000us per producer doing REGISTER.) I've re-run the benchmarks on a desktop computer with a good cpu cooler, which gives more consistent results than my laptop:
|
I think I agree, since lookups can also happen in parallel. Thanks for this — do you want to clean up these commits before we merge? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
with typical REGISTER ops, typical doLookup() ops, and LookupRegistrations() which is part of disconnect thanks Andy Xie for the first version of the LookupRegistration() bench
8c9e8b7
to
f8b49e6
Compare
squashed |
@ploxiln @mreiferson Thanks for reviewing and merging this PR. 👏 |
I refactored and added a bit to @andyxning's benchmark from #1036
Results:
take a look @mreiferson