-
Notifications
You must be signed in to change notification settings - Fork 955
On-demand database allocation instead of preallocation #1609
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
Conversation
ranshid
left a comment
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.
some immediate comments.
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## unstable #1609 +/- ##
============================================
+ Coverage 71.43% 71.53% +0.09%
============================================
Files 122 122
Lines 66210 66484 +274
============================================
+ Hits 47300 47561 +261
- Misses 18910 18923 +13
🚀 New features to boost your workflow:
|
1bfa8b4 to
9f07a4f
Compare
reducing overhead and improving scalability for large database counts. Signed-off-by: xbasel <[email protected]>
|
Running valkey with 10 million databases: empty dbs: Before: After: db 8 million: |
zuiderkwast
left a comment
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.
Great, this looks pretty strait-forward.
The benchmark with 10M databases is great, but not a very common I think. :) The main motivation for this optimization IMO is in combination with #1319. For cluster mode with 16 empty databases, does it go from 10MB to 1MB?
This has been created artificially (this change hasn't been merged into multi-database code, i changed the code to create 16k slots without cluster mode) before (preallocated) with (16 databases, 16k slots): allocated-on-demand (16 databases, 16k slots), database 0 is always pre-allocated.. |
Signed-off-by: xbasel <[email protected]>
|
@zuiderkwast / @ranshid reminder :) |
|
It's not forgotten, but the focus now is on stabilizing the 8.1 release and fix the flaky tests before 8.1 GA. This one will have to wait until after 8.1. It will be good to release it together with the related cluster-multidb feature. |
|
I see many changes from |
Signed-off-by: xbasel <[email protected]>
Signed-off-by: xbasel <[email protected]>
Signed-off-by: xbasel <[email protected]>
Signed-off-by: xbasel <[email protected]>
Co-authored-by: Viktor Söderqvist <[email protected]> Signed-off-by: xbasel <[email protected]>
Signed-off-by: xbasel <[email protected]>
Co-authored-by: Viktor Söderqvist <[email protected]> Signed-off-by: xbasel <[email protected]>
zuiderkwast
left a comment
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.
Yeah this looks good to merge.
Signed-off-by: xbasel <[email protected]>
Co-authored-by: Viktor Söderqvist <[email protected]> Signed-off-by: xbasel <[email protected]>
Co-authored-by: Viktor Söderqvist <[email protected]> Signed-off-by: xbasel <[email protected]>
Signed-off-by: Viktor Söderqvist <[email protected]>
Allocate database structures lazily to prevent excessive memory usage when a large number of databases is configured but not actually used. fixes valkey-io#1597 --------- Signed-off-by: xbasel <[email protected]> Signed-off-by: Viktor Söderqvist <[email protected]> Co-authored-by: Viktor Söderqvist <[email protected]> Signed-off-by: chzhoo <[email protected]>
Allocate database structures lazily to prevent excessive memory usage when a large number of databases is configured but not actually used. fixes valkey-io#1597 --------- Signed-off-by: xbasel <[email protected]> Signed-off-by: Viktor Söderqvist <[email protected]> Co-authored-by: Viktor Söderqvist <[email protected]> Signed-off-by: shanwan1 <[email protected]>
In valkey-io#1609, we now doing on-demand database allocation instead of preallocation. And in beginDefragCycle, we should not skip empty databases if they exist. The defrag still defrags the internal allocations of the hashtables structs if they exist. Call chain: defragStageDbKeys -> defragStageKvstoreHelper -> kvstoreHashtableDefragTables -> hashtableDefragTables. Signed-off-by: Binbin <[email protected]>
In #1609, we now doing on-demand database allocation instead of preallocation. And in beginDefragCycle, we should not skip empty databases if they exist. The defrag still defrags the internal allocations of the hashtables structs if they exist. Call chain: defragStageDbKeys -> defragStageKvstoreHelper -> kvstoreHashtableDefragTables -> hashtableDefragTables. Signed-off-by: Binbin <[email protected]>
Allocate database structures lazily to prevent excessive memory usage
when a large number of databases is configured but not actually used.
fixes #1597