Skip to content
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

Enable configuration of local store size limits #11777

Merged
merged 4 commits into from Mar 23, 2021

Conversation

stuhood
Copy link
Sponsor Member

@stuhood stuhood commented Mar 23, 2021

Problem

The local Store uses LMDB, which requires you to pre-specify the maximum store size for the purposes of MMAP.

Unfortunately, our previously lowered Store size values (#11513) put too low a cap on file sizes for some users.

Solution

Make the maximum sizes of the stores configurable, and calculate the target store size for GC from the maximum size.

Result

Users can increase the maximum sizes of the stores to support larger file sizes.

Comment on lines +776 to 814
register(
"--local-store-processes-max-size-bytes",
type=int,
advanced=True,
help=(
"The maximum size in bytes of the local store containing process cache entries. "
f"Stored below `{local_store_dir_flag}`."
),
default=DEFAULT_LOCAL_STORE_OPTIONS.processes_max_size_bytes,
)
register(
"--local-store-files-max-size-bytes",
type=int,
advanced=True,
help=(
"The maximum size in bytes of the local store containing files. "
f"Stored below `{local_store_dir_flag}`."
"\n\n"
"NB: This size value bounds the total size of all files, but (due to sharding of the "
"store on disk) it also bounds the per-file size to (VALUE / 16)."
"\n\n"
"This value doesn't reflect space allocated on disk, or RAM allocated (it "
"may be reflected in VIRT but not RSS). However, the default is lower than you "
"might otherwise choose because macOS creates core dumps that include MMAP'd "
"pages, and setting this too high might cause core dumps to use an unreasonable "
"amount of disk if they are enabled."
),
default=DEFAULT_LOCAL_STORE_OPTIONS.files_max_size_bytes,
)
register(
"--local-store-directories-max-size-bytes",
type=int,
advanced=True,
help=(
"The maximum size in bytes of the local store containing directories. "
f"Stored below `{local_store_dir_flag}`."
),
default=DEFAULT_LOCAL_STORE_OPTIONS.directories_max_size_bytes,
)
Copy link
Sponsor Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One potential alternative to exposing all three options would be to expose one option, and to then bake in a ratio.

…ured, and unify them with StoreGCService settings.

[ci skip-rust]

[ci skip-build-wheels]
# Rust tests and lints will be skipped. Delete if not intended.
[ci skip-rust]

# Building wheels and fs_util will be skipped. Delete if not intended.
[ci skip-build-wheels]
src/python/pants/option/global_options.py Outdated Show resolved Hide resolved
src/python/pants/option/global_options.py Outdated Show resolved Hide resolved
src/python/pants/option/global_options.py Show resolved Hide resolved
src/python/pants/option/global_options.py Outdated Show resolved Hide resolved
# Rust tests and lints will be skipped. Delete if not intended.
[ci skip-rust]

# Building wheels and fs_util will be skipped. Delete if not intended.
[ci skip-build-wheels]
@stuhood stuhood merged commit f648760 into pantsbuild:main Mar 23, 2021
@stuhood stuhood deleted the stuhood/store-limits branch March 23, 2021 16:51
stuhood added a commit that referenced this pull request Mar 23, 2021
### Problem

The top commit in #11777 was marked `skip-rust`, and so ... the rust tests were skipped while landing. After landing, it failed on main.

### Solution

Fix the test. Independently, we should follow up to fix the implementation of the `skip-rust` tag.
Comment on lines +281 to +295
def target_total_size_bytes(self) -> int:
"""Returns the target total size of all of the stores.

The `max_size` values are caps on the total size of each store: the "target" size
is the size that garbage collection will attempt to shrink the stores to each time
it runs.

NB: This value is not currently configurable, but that could be desirable in the future.
"""
max_total_size_bytes = (
self.processes_max_size_bytes
+ self.files_max_size_bytes
+ self.directories_max_size_bytes
)
return max_total_size_bytes // 10
Copy link
Sponsor Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The fact that this is calculated from the new higher default ended up changing the concrete target to a higher value.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants