-
-
Notifications
You must be signed in to change notification settings - Fork 34
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
Initial implementation of a new lockless hashtable mpmc #262
Conversation
…ry for freeing it
…eparation for the resize support
…d entry has to be skipped
… has to retry the operation
…nt of iterations that can be done in the benchmark
…o 1, style cleanup
…ey would be run every 100/150 operations on the same thread
…generator as it gets updated every 4ms and might cause the generation of the same sequences
Codecov ReportBase: 82.34% // Head: 82.74% // Increases project coverage by
Additional details and impacted files@@ Coverage Diff @@
## main #262 +/- ##
==========================================
+ Coverage 82.34% 82.74% +0.41%
==========================================
Files 157 158 +1
Lines 9795 10240 +445
==========================================
+ Hits 8065 8473 +408
- Misses 1730 1767 +37
Flags with carried forward coverage won't be shown. Click here to find out more.
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
… when an upsize is in progress
…le key value directly
…e that the bucket is altered on the right hashtable array, also properly cleanup after failing to insert because of a migration and when migrating migrating wait for temporary buckets to be cleaned up or finalized
This PR implements a new lockless multi producer and multi consumer parallel hashtable which is capable of achieving amazing numbers (included at the end of the summary)!
This new hashtable works in a very different way from the previous one although the goal keeps being the same: spread the contention of the threads as much as possible and reduce the amount of times the data in memory are changed.
The old approach was relying on a combination of memory fencing and userspace spinlocks to perform lockless GET operations meanwhile using userspace spinlocks for the SET and DEL operations with a lock every 14 buckets, the results were great as an hashtable with 10000 was being controlled by about 714 locks, but the downside was a lot of memory changes, also impacting the cache of the cores, done by 1 single thread to write a value.
The new approach relies on a combination of approaches and components:
The hashtable will implement some extra optimizations to box the upper level data (the storagedb_entry_index) into the lower level data (the key value itself) using a combination of an union and the code in the header using some defines to create a typed version of the hashtable.
This new hashtable will provide much better performances when batching operations or operating in a cluster.
The PR includes new tests and new benchmarks, used to generate the numbers initially mentioned.
The PR is drammatically large:
Talking about numbers, here some
The V2 hashtable is between 2 and 2.5 times faster than the V1, the current implementation.
The hardware used for benchmarking was an EPYC 7502P (32 core, 64 hw thread, default bios settings) with 256GB RDIMM DDR4 3200mhz.
Closes #103