public inbox for pbs-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: "Fabian Grünbichler" <f.gruenbichler@proxmox.com>
To: Christian Ebner <c.ebner@proxmox.com>, pbs-devel@lists.proxmox.com
Subject: Re: [PATCH proxmox-backup v6 05/15] client: backup writer: fix upload stats size and rate for push sync
Date: Mon, 20 Apr 2026 14:29:51 +0200	[thread overview]
Message-ID: <1776688031.fv5zhjkwk5.astroid@yuna.none> (raw)
In-Reply-To: <20260417092621.455374-6-c.ebner@proxmox.com>

On April 17, 2026 11:26 am, Christian Ebner wrote:
> Currently, the logical size of the uploaded chunks is used for size
> and upload rate calculation in case of sync jobs in push direction,
> leading to inflated values for the transferred size and rate.
> 
> Use the compressed chunk size instead. To get the required
> information, return the more verbose `UploadStats` on
> `upload_index_chunk_info` calls and use it's compressed size for the
> transferred `bytes` of `SyncStats` instead. Since `UploadStats` is
> now part of a pub api, increase it's scope as well.
> 
> This is then finally being used to display the upload size and
> calculate the rate for the push sync job.

this would make it inconsistent with the logging when doing a regular
backup though:

> linux.mpxar: had to backup 13.587 MiB of 13.587 MiB (compressed 2.784 MiB) in 2.13 s (average 6.392 MiB/s)

from backup_writer.rs:482:

```
        let size_dirty = upload_stats.size - upload_stats.size_reused;
[..]
            let speed: HumanByte =
                ((size_dirty * 1_000_000) / (upload_stats.duration.as_micros() as usize)).into();
            let size_dirty: HumanByte = size_dirty.into();
            let size_compressed: HumanByte = upload_stats.size_compressed.into();
            info!(
                "{archive}: had to backup {size_dirty} of {size} (compressed {size_compressed}) in {:.2} s (average {speed}/s)",
                upload_stats.duration.as_secs_f64()
            );
```

I think if we adapt this, we should adapt it to either that calculation
or unify them?

> 
> Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
> ---
> changes since version 5:
> - no changes
> 
>  pbs-client/src/backup_stats.rs  | 20 ++++++++++----------
>  pbs-client/src/backup_writer.rs |  4 ++--
>  src/server/push.rs              |  4 ++--
>  3 files changed, 14 insertions(+), 14 deletions(-)
> 
> diff --git a/pbs-client/src/backup_stats.rs b/pbs-client/src/backup_stats.rs
> index f0563a001..edf7ef3c4 100644
> --- a/pbs-client/src/backup_stats.rs
> +++ b/pbs-client/src/backup_stats.rs
> @@ -15,16 +15,16 @@ pub struct BackupStats {
>  }
>  
>  /// Extended backup run statistics and archive checksum
> -pub(crate) struct UploadStats {
> -    pub(crate) chunk_count: usize,
> -    pub(crate) chunk_reused: usize,
> -    pub(crate) chunk_injected: usize,
> -    pub(crate) size: usize,
> -    pub(crate) size_reused: usize,
> -    pub(crate) size_injected: usize,
> -    pub(crate) size_compressed: usize,
> -    pub(crate) duration: Duration,
> -    pub(crate) csum: [u8; 32],
> +pub struct UploadStats {
> +    pub chunk_count: usize,
> +    pub chunk_reused: usize,
> +    pub chunk_injected: usize,
> +    pub size: usize,
> +    pub size_reused: usize,
> +    pub size_injected: usize,
> +    pub size_compressed: usize,
> +    pub duration: Duration,
> +    pub csum: [u8; 32],
>  }
>  
>  impl UploadStats {
> diff --git a/pbs-client/src/backup_writer.rs b/pbs-client/src/backup_writer.rs
> index 49aff3fdd..4a4391c8b 100644
> --- a/pbs-client/src/backup_writer.rs
> +++ b/pbs-client/src/backup_writer.rs
> @@ -309,7 +309,7 @@ impl BackupWriter {
>          archive_name: &BackupArchiveName,
>          stream: impl Stream<Item = Result<MergedChunkInfo, Error>>,
>          options: UploadOptions,
> -    ) -> Result<BackupStats, Error> {
> +    ) -> Result<UploadStats, Error> {
>          let mut param = json!({ "archive-name": archive_name });
>          let (prefix, archive_size) = options.index_type.to_prefix_and_size();
>          if let Some(size) = archive_size {
> @@ -391,7 +391,7 @@ impl BackupWriter {
>              .post(&format!("{prefix}_close"), Some(param))
>              .await?;
>  
> -        Ok(upload_stats.to_backup_stats())
> +        Ok(upload_stats)
>      }
>  
>      pub async fn upload_stream(
> diff --git a/src/server/push.rs b/src/server/push.rs
> index 697b94f2f..494e0fbce 100644
> --- a/src/server/push.rs
> +++ b/src/server/push.rs
> @@ -1059,8 +1059,8 @@ async fn push_index(
>          .await?;
>  
>      Ok(SyncStats {
> -        chunk_count: upload_stats.chunk_count as usize,
> -        bytes: upload_stats.size as usize,
> +        chunk_count: upload_stats.chunk_count,
> +        bytes: upload_stats.size_compressed,
>          elapsed: upload_stats.duration,
>          removed: None,
>      })
> -- 
> 2.47.3
> 
> 
> 
> 
> 
> 




  reply	other threads:[~2026-04-20 12:29 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-17  9:26 [PATCH proxmox{,-backup} v6 00/15] fix #4182: concurrent group pull/push support for sync jobs Christian Ebner
2026-04-17  9:26 ` [PATCH proxmox v6 01/15] pbs api types: add `worker-threads` to sync job config Christian Ebner
2026-04-17  9:26 ` [PATCH proxmox-backup v6 02/15] tools: group and sort module imports Christian Ebner
2026-04-17  9:26 ` [PATCH proxmox-backup v6 03/15] tools: implement buffered logger for concurrent log messages Christian Ebner
2026-04-20 10:57   ` Fabian Grünbichler
2026-04-20 17:15     ` Christian Ebner
2026-04-21  6:49       ` Fabian Grünbichler
2026-04-17  9:26 ` [PATCH proxmox-backup v6 04/15] tools: add bounded join set to run concurrent tasks bound by limit Christian Ebner
2026-04-20 11:15   ` Fabian Grünbichler
2026-04-17  9:26 ` [PATCH proxmox-backup v6 05/15] client: backup writer: fix upload stats size and rate for push sync Christian Ebner
2026-04-20 12:29   ` Fabian Grünbichler [this message]
2026-04-17  9:26 ` [PATCH proxmox-backup v6 06/15] api: config/sync: add optional `worker-threads` property Christian Ebner
2026-04-17  9:26 ` [PATCH proxmox-backup v6 07/15] sync: pull: revert avoiding reinstantiation for encountered chunks map Christian Ebner
2026-04-17  9:26 ` [PATCH proxmox-backup v6 08/15] sync: pull: factor out backup group locking and owner check Christian Ebner
2026-04-17  9:26 ` [PATCH proxmox-backup v6 09/15] sync: pull: prepare pull parameters to be shared across parallel tasks Christian Ebner
2026-04-17  9:26 ` [PATCH proxmox-backup v6 10/15] fix #4182: server: sync: allow pulling backup groups in parallel Christian Ebner
2026-04-17  9:26 ` [PATCH proxmox-backup v6 11/15] server: pull: prefix log messages and add error context Christian Ebner
2026-04-20 11:56   ` Fabian Grünbichler
2026-04-21  7:21     ` Christian Ebner
2026-04-21  7:42       ` Christian Ebner
2026-04-21  8:00         ` Fabian Grünbichler
2026-04-21  8:04           ` Christian Ebner
2026-04-21 12:57     ` Thomas Lamprecht
2026-04-17  9:26 ` [PATCH proxmox-backup v6 12/15] sync: push: prepare push parameters to be shared across parallel tasks Christian Ebner
2026-04-17  9:26 ` [PATCH proxmox-backup v6 13/15] server: sync: allow pushing groups concurrently Christian Ebner
2026-04-17  9:26 ` [PATCH proxmox-backup v6 14/15] server: push: prefix log messages and add additional logging Christian Ebner
2026-04-17  9:26 ` [PATCH proxmox-backup v6 15/15] ui: expose group worker setting in sync job edit window Christian Ebner
2026-04-20 12:33 ` [PATCH proxmox{,-backup} v6 00/15] fix #4182: concurrent group pull/push support for sync jobs Fabian Grünbichler
2026-04-21 10:28 ` superseded: " 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=1776688031.fv5zhjkwk5.astroid@yuna.none \
    --to=f.gruenbichler@proxmox.com \
    --cc=c.ebner@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
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal