From: Gabriel Goller <g.goller@proxmox.com>
To: Proxmox Backup Server development discussion
<pbs-devel@lists.proxmox.com>
Subject: Re: [pbs-devel] [RFC proxmox-backup 3/4] fix #4182: server: sync: allow pulling groups concurrently
Date: Tue, 30 Jul 2024 17:54:01 +0200 [thread overview]
Message-ID: <20240730155401.xsyyuxplepwjoc6v@luna.proxmox.com> (raw)
In-Reply-To: <20240725101922.231053-4-c.ebner@proxmox.com>
On 25.07.2024 12:19, Christian Ebner wrote:
>Currently, a sync job sequentially pulls the backup groups and the
>snapshots contained within them, therefore being limited in download
>speed by the http2 connection of the source reader instance in case
>of remote syncs. High latency networks suffer from limited download
>speed.
>
>Improve the throughput by allowing to pull up to a configured number
>of backup groups concurrently, by creating tasks connecting and
>pulling from the remote source in parallel.
>
>Link to issue in bugtracker:
>https://bugzilla.proxmox.com/show_bug.cgi?id=4182
>
>Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
>---
> src/server/pull.rs | 50 ++++++++++++++++++++++++++++++++++++++--------
> 1 file changed, 42 insertions(+), 8 deletions(-)
>
>diff --git a/src/server/pull.rs b/src/server/pull.rs
>index e2d155c78..0a54217d4 100644
>--- a/src/server/pull.rs
>+++ b/src/server/pull.rs
>@@ -10,6 +10,8 @@ use std::sync::{Arc, Mutex};
> use std::time::{Duration, SystemTime};
>
> use anyhow::{bail, format_err, Error};
>+use futures::stream::FuturesUnordered;
>+use futures::StreamExt;
> use http::StatusCode;
> use proxmox_human_byte::HumanByte;
> use proxmox_router::HttpError;
>@@ -1452,16 +1454,48 @@ pub(crate) async fn pull_ns(
> new_groups.insert(group.clone());
> }
>
>- let mut progress = StoreProgress::new(list.len() as u64);
>- let mut pull_stats = PullStats::default();
>+ let mut store_progress = StoreProgress::new(list.len() as u64);
>
> let target_ns = namespace.map_prefix(¶ms.source.get_ns(), ¶ms.target.ns)?;
>
>- for (done, group) in list.into_iter().enumerate() {
>- progress.done_groups = done as u64;
>- progress.done_snapshots = 0;
>- progress.group_snapshots = 0;
>- pull_group_task(params, &group, namespace, &target_ns, progress.clone()).await?;
>+ let mut pull_group_tasks = FuturesUnordered::new();
>+
>+ let mut list_iter = list.iter();
>+ // queue up to requested number of initial group sync tasks to the task pool
>+ for _ in 0..params.group_sync_tasks.unwrap_or(1) {
>+ if let Some(group) = list_iter.next() {
>+ let task_progress = StoreProgress::new(list.len() as u64);
>+ pull_group_tasks.push(pull_group_task(
>+ params,
>+ group,
>+ namespace,
>+ &target_ns,
>+ task_progress,
>+ ));
>+ }
>+ }
>+
>+ let mut pull_stats = PullStats::default();
>+ // poll to initiate tasks, queue another remaining tasks for each finished one
>+ while let Some(result) = pull_group_tasks.next().await {
>+ let (progress, stats, has_errors) = result?;
>+ errors |= has_errors;
>+ pull_stats.add(stats);
>+ store_progress.done_groups += progress.done_groups;
>+ store_progress.done_snapshots += progress.done_snapshots;
>+
>+ matches!(params.group_sync_tasks, Some(n) if n > 1);
This can be removed, it does nothing.
>+ // queue another remaining group sync to the task pool
>+ if let Some(group) = list_iter.next() {
>+ let task_progress = StoreProgress::new(list.len() as u64);
>+ pull_group_tasks.push(pull_group_task(
>+ params,
>+ group,
>+ namespace,
>+ &target_ns,
>+ task_progress,
>+ ));
>+ }
> }
>
> if params.remove_vanished {
>@@ -1516,5 +1550,5 @@ pub(crate) async fn pull_ns(
> };
> }
>
>- Ok((progress, pull_stats, errors))
>+ Ok((store_progress, pull_stats, errors))
> }
>--
>2.39.2
>
>
>
>_______________________________________________
>pbs-devel mailing list
>pbs-devel@lists.proxmox.com
>https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel
>
>
_______________________________________________
pbs-devel mailing list
pbs-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel
next prev parent reply other threads:[~2024-07-30 15:54 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-25 10:19 [pbs-devel] [RFC proxmox-backup 0/4] concurrent group pull support for sync jobs Christian Ebner
2024-07-25 10:19 ` [pbs-devel] [RFC proxmox-backup 1/4] api: config/sync: add optional group-sync-tasks property Christian Ebner
2024-07-25 10:19 ` [pbs-devel] [RFC proxmox-backup 2/4] server: pull: factor out group pull task into helper Christian Ebner
2024-07-30 15:56 ` Gabriel Goller
2024-07-31 7:38 ` Christian Ebner
2024-07-25 10:19 ` [pbs-devel] [RFC proxmox-backup 3/4] fix #4182: server: sync: allow pulling groups concurrently Christian Ebner
2024-07-30 15:54 ` Gabriel Goller [this message]
2024-07-31 7:35 ` Christian Ebner
2024-07-25 10:19 ` [pbs-devel] [RFC proxmox-backup 4/4] server: pull: conditionally buffer parallel tasks log output Christian Ebner
2025-01-20 10:57 ` [pbs-devel] [RFC proxmox-backup 0/4] concurrent group pull support for sync jobs Christian Ebner
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240730155401.xsyyuxplepwjoc6v@luna.proxmox.com \
--to=g.goller@proxmox.com \
--cc=pbs-devel@lists.proxmox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox