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

compute_ctl: Perform more startup actions in parallel #11008

Open
wants to merge 3 commits into
base: heikki/refactor-compute_ctl-2
Choose a base branch
from

Conversation

hlinnaka
Copy link
Contributor

To speed up compute startup. Resizing swap in particular takes about 100 ms on my laptop. By performing it in parallel with downloading the basebackup, that latency is effectively hidden. I would imagine that downloading remote extensions can also take a non-trivial amount of time, although I didn't try to measure that. In any case that's now also performed in parallel with downloading the basebackup.

@hlinnaka hlinnaka requested a review from a team as a code owner February 26, 2025 21:26
@hlinnaka hlinnaka requested review from ololobus, MMeent and tristan957 and removed request for a team February 26, 2025 21:26
@hlinnaka
Copy link
Contributor Author

Copy link

github-actions bot commented Feb 26, 2025

7744 tests run: 7364 passed, 0 failed, 380 skipped (full report)


Flaky tests (2)

Postgres 17

Code coverage* (full report)

  • functions: 32.8% (8642 of 26371 functions)
  • lines: 48.6% (73200 of 150570 lines)

* collected from Rust tests only


The comment gets automatically updated with the latest test results
e54eda2 at 2025-02-28T13:57:09.036Z :recycle:

@hlinnaka hlinnaka requested a review from tristan957 February 26, 2025 23:00
@hlinnaka hlinnaka force-pushed the heikki/refactor-compute_ctl-2 branch from dae4c2a to 7bc981e Compare February 26, 2025 23:46
@hlinnaka hlinnaka force-pushed the heikki/parallelize-start_compute branch from 3a6fefc to 6244f72 Compare February 26, 2025 23:46
@hlinnaka hlinnaka force-pushed the heikki/parallelize-start_compute branch from 6244f72 to 2a0918e Compare February 27, 2025 12:21
// If there are any remote extensions in shared_preload_libraries, start downloading them
if pspec.spec.remote_extensions.is_some() {
let (this, spec) = (self.clone(), pspec.spec.clone());
pre_tasks.spawn_blocking_child(move || this.download_preload_extensions(&spec));
Copy link
Contributor

Choose a reason for hiding this comment

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

With async closures (async || {}) I think this should not need the clone() operations.

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 couldn't get that to work

Comment on lines +613 to +588
let (this, cs) = (self.clone(), compute_state.clone());
pre_tasks.spawn_blocking_child(move || this.prepare_pgdata(&cs));
Copy link
Contributor

Choose a reason for hiding this comment

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

Same here

@hlinnaka hlinnaka force-pushed the heikki/parallelize-start_compute branch from 2a0918e to 32f2bc7 Compare February 27, 2025 21:02
@hlinnaka hlinnaka force-pushed the heikki/refactor-compute_ctl-2 branch from 14de70f to 33a2459 Compare February 27, 2025 21:10
To speed up compute startup. Resizing swap in particular takes about
100 ms on my laptop. By performing it in parallel with downloading the
basebackup, that latency is effectively hidden. I would imagine that
downloading remote extensions can also take a non-trivial amount of
time, although I didn't try to measure that. In any case that's now
also performed in parallel with downloading the basebackup.
@hlinnaka hlinnaka force-pushed the heikki/parallelize-start_compute branch from 22d1fb2 to dd4c55d Compare February 27, 2025 21:14
Copy link
Member

@ololobus ololobus left a comment

Choose a reason for hiding this comment

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

LGTM overall, that was the next step I had in mind too :)

@@ -669,20 +679,6 @@ impl ComputeNode {
let config_time = Utc::now();
if pspec.spec.mode == ComputeMode::Primary {
self.configure_as_primary(&compute_state)?;
let conf = self.get_conn_conf(None);
tokio::task::spawn_blocking(|| {
let res = get_installed_extensions(conf);
Copy link
Member

Choose a reason for hiding this comment

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

Hm, looks like this part got removed completely, but we need this for the extensions' metrics

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.

4 participants