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

Parallelize process_inboxes_and_force_validator_updates #3245

Merged

Conversation

ndr-ds
Copy link
Contributor

@ndr-ds ndr-ds commented Feb 4, 2025

Motivation

Will start paralellizing some parts of this existing flow

Proposal

Paralellize initial validator sync step

Test Plan

CI + ran locally

Release Plan

  • Nothing to do / These changes follow the usual release cycle.

Copy link
Contributor Author

ndr-ds commented Feb 4, 2025

let (listener, _listen_handle, notification_stream) = chain_client.listen().await?;
self.chain_listeners.spawn_task(listener);
Ok(notification_stream)
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Do these need to be pub? And shouldn't they be in the #[cfg(feature = "benchmark")] impl below?

result?
};
certificates.extend(new_certificates);
if maybe_timeout.is_none() {
Copy link
Contributor

Choose a reason for hiding this comment

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

Can this ever be Some in the benchmark? Aren't these all single-user chains, where we expect the first proposal to succeed?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good point! They're all single super owner chains. This should simplify the code quite a bit :)

})
.collect::<Vec<_>>();

let mut chain_client_and_notification_stream = Vec::new();
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
let mut chain_client_and_notification_stream = Vec::new();
let mut chain_clients_and_notification_streams = Vec::new();

Copy link
Contributor Author

ndr-ds commented Feb 5, 2025

This one is significantly faster, 850ms in parallel vs 3500ms serially

@ndr-ds ndr-ds force-pushed the 02-03-remove_max_in_flight_from_linera_benchmark branch from d19808a to 34e94bf Compare February 5, 2025 20:07
@ndr-ds ndr-ds force-pushed the 02-03-parallelize_process_inboxes_and_force_validator_updates branch from 2e762fc to 466a717 Compare February 5, 2025 20:07
@ndr-ds ndr-ds requested a review from afck February 5, 2025 20:12
@ndr-ds ndr-ds force-pushed the 02-03-parallelize_process_inboxes_and_force_validator_updates branch from 466a717 to 8af1570 Compare February 6, 2025 00:04
@ndr-ds ndr-ds force-pushed the 02-03-remove_max_in_flight_from_linera_benchmark branch from 34e94bf to 96d6a58 Compare February 6, 2025 03:47
@ndr-ds ndr-ds force-pushed the 02-03-parallelize_process_inboxes_and_force_validator_updates branch from 8af1570 to f7cca92 Compare February 6, 2025 03:47
linera-client/src/client_context.rs Outdated Show resolved Hide resolved
linera-client/src/client_context.rs Outdated Show resolved Hide resolved
linera-client/src/client_context.rs Outdated Show resolved Hide resolved
@ndr-ds ndr-ds force-pushed the 02-03-remove_max_in_flight_from_linera_benchmark branch from 96d6a58 to 179c093 Compare February 6, 2025 13:36
@ndr-ds ndr-ds force-pushed the 02-03-parallelize_process_inboxes_and_force_validator_updates branch 2 times, most recently from 6797419 to 6e1bb0d Compare February 6, 2025 13:54
.await
.expect("Processing inbox should not fail!");
chain_client
.update_validators(None)
Copy link
Contributor

Choose a reason for hiding this comment

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

I wonder if that's even necessary. process_inbox_without_prepare already updates the validators about the new certificates.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's probably an unlikely case, but from what I looked, process_inbox_without_prepare will only execute a new block (and then update the validators) if we have pending message bundles. If that's not the case, then we won't update the validators.
update_validators in this case will only update anything if our committee has changed. So I guess in the case where we're running this against the testnet or something, and some validator gets added/removed, we should keep this around to make sure things will be properly updated in that case.

Copy link
Contributor

Choose a reason for hiding this comment

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

But if the committee changed, we do receive a message about it, so there will be a pending message bundle. (At least until we have event streams—but even if, I'd say it isn't the benchmark's task to update the validators about the admin chain.)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I see! Then maybe we don't need it. I'll remove it.

@ndr-ds ndr-ds force-pushed the 02-03-remove_max_in_flight_from_linera_benchmark branch from 179c093 to 4073be0 Compare February 6, 2025 17:31
@ndr-ds ndr-ds force-pushed the 02-03-parallelize_process_inboxes_and_force_validator_updates branch from 6e1bb0d to 09aeee8 Compare February 6, 2025 17:31
Copy link
Contributor Author

ndr-ds commented Feb 6, 2025

Merge activity

  • Feb 6, 1:28 PM EST: A user started a stack merge that includes this pull request via Graphite.
  • Feb 6, 1:30 PM EST: Graphite rebased this pull request as part of a merge.
  • Feb 6, 1:30 PM EST: A user merged this pull request with Graphite.

@ndr-ds ndr-ds changed the base branch from 02-03-remove_max_in_flight_from_linera_benchmark to graphite-base/3245 February 6, 2025 18:28
@ndr-ds ndr-ds changed the base branch from graphite-base/3245 to main February 6, 2025 18:28
@ndr-ds ndr-ds force-pushed the 02-03-parallelize_process_inboxes_and_force_validator_updates branch from 09aeee8 to fdd3ba9 Compare February 6, 2025 18:29
@ndr-ds ndr-ds merged commit 62cac58 into main Feb 6, 2025
22 checks passed
@ndr-ds ndr-ds deleted the 02-03-parallelize_process_inboxes_and_force_validator_updates branch February 6, 2025 18:30
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