perf(hash): use MultiGet to reduce RocksDB calls in HMSET#3327
Conversation
|
Would you like to provide benchmark data about this change? |
In our production environment, benchmarks on real traffic demonstrate that batching reads with MultiGet in HMSET improves performance by approximately 30%. Without MultiGet: setting 27,000 fields took ~101 ms |
|
I should note that this structure is wrong in transaction mode: for (...) {
if (..) return ..;
batch->Put(...)
}
batch->Commit()because if early returns happen, in transaction mode we will still commit this batch in EXEC command. But this is not introduced in this PR, so I'm fine to merge. It can be fixed later. |
|



HMSET previously compared existing values by issuing a separate RocksDB Get
for each field. When the number of fields is large, this results in multiple
Get calls and extra overhead.
This change replaces multiple Get calls with a single MultiGet call, batching
the reads and improving performance for HMSET with many fields.