On-demand database allocation instead of preallocation#1609
Conversation
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 <103044017+xbasel@users.noreply.github.com>
|
Running valkey with 10 million databases: empty dbs: Before: After: db 8 million: |
zuiderkwast
left a comment
There was a problem hiding this comment.
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 <103044017+xbasel@users.noreply.github.com>
|
@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 <103044017+xbasel@users.noreply.github.com>
Signed-off-by: xbasel <103044017+xbasel@users.noreply.github.com>
Co-authored-by: Viktor Söderqvist <viktor.soderqvist@est.tech> Signed-off-by: xbasel <103044017+xbasel@users.noreply.github.com>
Signed-off-by: xbasel <103044017+xbasel@users.noreply.github.com>
Co-authored-by: Viktor Söderqvist <viktor.soderqvist@est.tech> Signed-off-by: xbasel <103044017+xbasel@users.noreply.github.com>
zuiderkwast
left a comment
There was a problem hiding this comment.
Yeah this looks good to merge.
Signed-off-by: xbasel <103044017+xbasel@users.noreply.github.com>
Co-authored-by: Viktor Söderqvist <viktor.soderqvist@est.tech> Signed-off-by: xbasel <103044017+xbasel@users.noreply.github.com>
Co-authored-by: Viktor Söderqvist <viktor.soderqvist@est.tech> Signed-off-by: xbasel <103044017+xbasel@users.noreply.github.com>
Signed-off-by: Viktor Söderqvist <viktor.soderqvist@est.tech>
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 <103044017+xbasel@users.noreply.github.com> Signed-off-by: Viktor Söderqvist <viktor.soderqvist@est.tech> Co-authored-by: Viktor Söderqvist <viktor.soderqvist@est.tech> Signed-off-by: chzhoo <czawyx@163.com>
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 <103044017+xbasel@users.noreply.github.com> Signed-off-by: Viktor Söderqvist <viktor.soderqvist@est.tech> Co-authored-by: Viktor Söderqvist <viktor.soderqvist@est.tech> Signed-off-by: shanwan1 <shanwan1@intel.com>
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 <binloveplay1314@qq.com>
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 <binloveplay1314@qq.com>
Allocate database structures lazily to prevent excessive memory usage
when a large number of databases is configured but not actually used.
fixes #1597