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: resharding config allowing throttling #9994

Merged
merged 4 commits into from
Oct 24, 2023
Merged

Conversation

wacban
Copy link
Contributor

@wacban wacban commented Oct 24, 2023

  • Added SplitStateConfig that configures the resharding batch size and delay between batches. Both can be used to throttle resharding.
  • Added metrics to check how much time do different parts of resharding take.

@wacban wacban requested a review from a team as a code owner October 24, 2023 12:14
@@ -579,6 +582,7 @@ impl Chain {
pending_state_patch: Default::default(),
requested_state_parts: StateRequestTracker::new(),
state_snapshot_helper: None,
state_split_config: StateSplitConfig::default(),
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The view client doesn't need to have resharding configured so it's fine to use default here.

// Once we build the iterator, we break it into batches using the get_trie_update_batch function.
while let Some(batch) = get_trie_update_batch(&mut iter) {
loop {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

In here each of the three phases is wrapped in a dedicated scope with a relevant timer.
Slightly easier to review with whitespace hidden.


RESHARDING_BATCH_COUNT.with_label_values(&metrics_labels).inc();
RESHARDING_BATCH_SIZE.with_label_values(&metrics_labels).add(size as i64);
std::thread::sleep(config.batch_delay);
Copy link
Contributor

Choose a reason for hiding this comment

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

optional: quick comment as to why we have this sleep (to ease out writes to RocksDB which is in contention with block processing..)

@@ -162,6 +162,24 @@ impl SyncConfig {
}
}

#[derive(serde::Serialize, serde::Deserialize, Clone, Copy, Debug)]
Copy link
Contributor

Choose a reason for hiding this comment

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

Should this be in near_config.config close to where StateSyncConfig is?

Copy link
Contributor

Choose a reason for hiding this comment

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

Actually, it might be fine here as we need to plumb it through to chain. That apparently only comes from chain config which comes from client config...

shreyan-gupta
shreyan-gupta previously approved these changes Oct 24, 2023
Copy link
Contributor

@shreyan-gupta shreyan-gupta left a comment

Choose a reason for hiding this comment

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

Looks good!

@shreyan-gupta
Copy link
Contributor

Apologies, the conflicts are from my PR 😅

shreyan-gupta
shreyan-gupta previously approved these changes Oct 24, 2023
@wacban wacban enabled auto-merge October 24, 2023 15:49
@wacban wacban added this pull request to the merge queue Oct 24, 2023
Merged via the queue into master with commit b0bbd04 Oct 24, 2023
15 of 16 checks passed
@wacban wacban deleted the waclaw-resharding-throttle branch October 24, 2023 18:01
nikurt pushed a commit that referenced this pull request Nov 2, 2023
- Added SplitStateConfig that configures the resharding batch size and
delay between batches. Both can be used to throttle resharding.
- Added metrics to check how much time do different parts of resharding
take.
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.

2 participants