ethdb/pebble: adjust the number of memory tables #31970
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull request adjusts the number of allowed memory tables in Pebble.
Pebble allows configuring an arbitrary number of memory tables to hold
unflushed data. When the current memtable becomes full, it is scheduled
for flushing, and a new memtable is allocated to accept subsequent writes.
However, if too many memtables accumulate and are waiting to be flushed,
subsequent writes will stall.
Originally, only two memtables were configured, each with a size of 512 MB
for Ethereum mainnet. While this setup works well under normal conditions,
it becomes problematic under heavy write loads. In such scenarios, flushing
is only triggered when more than 512 MB of data is pending, which may not
be responsive enough. Even worse, if compactions are running concurrently,
flushing memtables can become slow due to the heavy IO overhead, leading
to write stalls across the system.
This pull request tries to mitigate the performance degradation by having
more memory tables but with a smaller size. In this case, the pending writes
can be flushed more smoothly and responsively.