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

feat: add cross-block cache size cli arg #14305

Merged
merged 4 commits into from
Feb 10, 2025
Merged

Conversation

fgimenez
Copy link
Member

@fgimenez fgimenez commented Feb 7, 2025

Closes #14300

@fgimenez fgimenez added C-perf A change motivated by improving speed, memory usage or disk footprint A-cli Related to the reth CLI A-engine Related to the engine implementation labels Feb 7, 2025
@github-actions github-actions bot added the C-enhancement New feature or request label Feb 7, 2025
@fgimenez fgimenez requested a review from gakonst as a code owner February 7, 2025 15:26
Comment on lines 40 to 41
/// Default size of cross-block cache.
pub const DEFAULT_CROSS_BLOCK_CACHE_SIZE: u64 = 4 * 1024 * 1024 * 1024;
Copy link
Collaborator

Choose a reason for hiding this comment

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

this is in bytes?

can we mention this?

Comment on lines 30 to 31
/// Configure the size of cross-block cache
#[arg(long = "engine.cross-block-cache-size", default_value_t = DEFAULT_CROSS_BLOCK_CACHE_SIZE)]
Copy link
Collaborator

Choose a reason for hiding this comment

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

this should mention the unit,

for other caches we expect that the input is MB because handling bytes is a bit useless:

for example:

/// Set the maximum RPC request payload size for both HTTP and WS in megabytes.
#[arg(long = "rpc.max-request-size", alias = "rpc-max-request-size", default_value_t = RPC_DEFAULT_MAX_REQUEST_SIZE_MB.into())]
pub rpc_max_request_size: MaxU32,

Copy link
Member Author

Choose a reason for hiding this comment

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

makes sense, done here 0918a5b PTAL

Copy link
Collaborator

@mattsse mattsse left a comment

Choose a reason for hiding this comment

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

lgtm, one more pedantic q re MB vs bytes 🙃

@@ -65,7 +65,7 @@ impl Default for TreeConfig {
use_state_root_task: false,
always_compare_trie_updates: false,
use_caching_and_prewarming: false,
cross_block_cache_size: DEFAULT_CROSS_BLOCK_CACHE_SIZE,
cross_block_cache_size: DEFAULT_CROSS_BLOCK_CACHE_SIZE_MB,
Copy link
Collaborator

Choose a reason for hiding this comment

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

hmm, not sure if we should mix this here, I lean towards handling this here in bytes as well as build_caches

wdyt @Rjected

Copy link
Member Author

Choose a reason for hiding this comment

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

yep better to be consistent internally, i¡ve pushed changes to manage bytes from TreeConfig, done the change MB -> bytes in the cache size setter invocation, ptal

Copy link
Collaborator

@mattsse mattsse left a comment

Choose a reason for hiding this comment

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

lgtm

builder.config.engine.state_root_task_compare_updates,
.with_always_compare_trie_updates(builder.config.engine.state_root_task_compare_updates)
.with_cross_block_cache_size(
builder.config.engine.cross_block_cache_size * 1024 * 1024,
Copy link
Collaborator

Choose a reason for hiding this comment

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

from MB to bytes, lgtm

@mattsse mattsse added this pull request to the merge queue Feb 10, 2025
Merged via the queue into main with commit d9e660b Feb 10, 2025
44 checks passed
@mattsse mattsse deleted the fgimenez/cache-size-cli-arg branch February 10, 2025 19:43
18aaddy pushed a commit to 18aaddy/reth that referenced this pull request Feb 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-cli Related to the reth CLI A-engine Related to the engine implementation C-enhancement New feature or request C-perf A change motivated by improving speed, memory usage or disk footprint
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add tree CLI argument for configuring the cache size
2 participants