public inbox for pbs-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Dominik Csapak <d.csapak@proxmox.com>
To: pbs-devel@lists.proxmox.com
Subject: [pbs-devel] [PATCH proxmox-backup 1/2] tape: improve throughput by not unnecessarily syncing/committing
Date: Tue,  7 May 2024 15:45:52 +0200	[thread overview]
Message-ID: <20240507134553.3233550-1-d.csapak@proxmox.com> (raw)

When writing data on tape, the idea was to sync/committing to tape and
the catalog to disk every 128GiB of data. For that the counter
'bytes_written' was introduced and checked after every chunk/snapshot
archive.

Sadly we forgot to reset the counter after doing so, which meant that
after 128GiB was written onto the tape, we synced/committed after every
archive on the tape for the remaining length of the tape.

Since syncing to tape and writing to disk takes a bit of time, the drive
had to slow down every time and reduced the available throughput. (In
our tests here from ~300MB/s to ~255MB/s).

By resetting the value to zero after syncing, we avoid that and increase
throughput performance when backups are bigger than 128GiB on tape.

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
 src/tape/pool_writer/mod.rs | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/src/tape/pool_writer/mod.rs b/src/tape/pool_writer/mod.rs
index 214260804..1a47e837c 100644
--- a/src/tape/pool_writer/mod.rs
+++ b/src/tape/pool_writer/mod.rs
@@ -43,7 +43,7 @@ struct PoolWriterState {
     media_uuid: Uuid,
     // tell if we already moved to EOM
     at_eom: bool,
-    // bytes written after the last tape fush/sync
+    // bytes written after the last tape flush/sync and catalog commit
     bytes_written: usize,
 }
 
@@ -200,8 +200,9 @@ impl PoolWriter {
     /// This is done automatically during a backupsession, but needs to
     /// be called explicitly before dropping the PoolWriter
     pub fn commit(&mut self) -> Result<(), Error> {
-        if let Some(PoolWriterState { ref mut drive, .. }) = self.status {
-            drive.sync()?; // sync all data to the tape
+        if let Some(ref mut status) = self.status {
+            status.drive.sync()?; // sync all data to the tape
+            status.bytes_written = 0; // reset bytes written
         }
         self.catalog_set.lock().unwrap().commit()?; // then commit the catalog
         Ok(())
-- 
2.39.2



_______________________________________________
pbs-devel mailing list
pbs-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel


             reply	other threads:[~2024-05-07 13:46 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-07 13:45 Dominik Csapak [this message]
2024-05-07 13:45 ` [pbs-devel] [PATCH proxmox-backup 2/2] examples: add tape write benchmark Dominik Csapak
2024-05-08  7:06 ` [pbs-devel] applied: [PATCH proxmox-backup 1/2] tape: improve throughput by not unnecessarily syncing/committing Dietmar Maurer

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=20240507134553.3233550-1-d.csapak@proxmox.com \
    --to=d.csapak@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