forked from openzfs/zfs
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Tune zettacache index merge channels to reduce memory usage (openzfs#639
) During a zettacache index merge, memory usage can increase drastically, e.g. from 8GB to 19GB, primarily due to memory used by the `IndexMessage`s (which are passed from the `merge_task()` to the `next_index_task()`) and `MergeMessage`s (which is passed from the `next_index_task()` to the `checkpoint_task()`). IndexMessages take 62MB each, and MergeMessages take 39MB each, due to the allocation of `MERGE_PROGRESS_CHUNK` (1 million) entries in each of their `entries`, `frees`, and `cache_updates` Vec's. There can be up to 100 of each of these messages in the channels, for a total of 10GB. This commit reduces the memory usage in two ways: Reduce the number of IndexMessages from 100 to 10. This has little impact on merge performance, because the next_index_task() can process messages at a relatively constant rate. Reduce the size of the `frees` and `cache_updates` Vec's in the `MergeMessage` to be just big enough to contain their used entries, which is typically very few, because there are few frees/updates compared to the number of `entries`. This reduces the typical maximum memory used by these messages from 10GB to <1GB, with negligible impact on merge performance.
- Loading branch information
Showing
1 changed file
with
47 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters