-
Notifications
You must be signed in to change notification settings - Fork 20.2k
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
metrics: use sync.map in registry #27159
Conversation
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. I agree about using sync.Map here, the speed-improvements on multithreaded Get
-operations are pretty awesome.
Parallel get is performed e.g. in the p2p/tracker/tracker.go
, aswell as lazy message handlers for both eth
and snap
protocol (if enabled.expensive), the p2p/transport.go
etc
Todo: I'll try it on a benchmarker |
This reverts commit dd2f5b3.
This reverts commit dd2f5b3.
This PR changes the registry from mutex protected map to sync.map implementation.
The registry is mostly read-heavy due to GetOrRegister method being used for tracking packets and rpc. Besides that most of the primitives are created at initialization and never unregistered. It sounds like a good place for sync.map.
Some stats: