meta data for this page
  •  

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
vm:proxmox:pbs:performance [2023/04/25 09:13] – niziakvm:proxmox:pbs:performance [2026/11/12 08:33] (current) – niziak
Line 1: Line 1:
 ====== performance ====== ====== performance ======
 +
 +===== pbs datastore tunning =====
 +
 +Overview of PBS Sync Levels
 +
 +  * ''filesystem (Default)'': Triggers syncfs(2) across the entire filesystem right after a backup finishes. It balances strong crash-resistance with performance.
 +  * ''file'': Triggers an fsync(0) on every individual chunk insertion. It provides the **highest level of consistency**,
 +    but significantly slows down performance on slower or network-attached storages.
 +  * ''none'': Performs no explicit syncing when writing chunks, relying on the kernel's background flushes (via dirty_expire_centisecs).
 +    It is the **fastest** option, but risks data loss or broken backups if a sudden power loss occurs.
 +
 +===== FS tuning =====
 +
 +PBS stores everything in files. Maximum file size is 4MB.
 +  * Block device backup is in 4MB chunks
 +  * File backup chunk varies from 64kB to 4MB
 +
 +Filesystems:
 +  * ZFS 
 +    * [[https://pbs.proxmox.com/docs/sysadmin.html#zfs-special-device|special device]]
 +    * 128kB recordsize can cause write amplification for chinks smaller than 128kB
 +    * larger recordsize = less IOPS
 +    * Create histogram from existing PBS chunks sizes.
 +    * ''atime=off'
 +    * ''recordsize=1M'' or bigger
 +    * ''xattr=sa''
 +  * ZFS on HDD:
 +    * log on NVM do almost nothing
 +    * add persistent metadata L2ARC on NVM
 +      * ''zfs set secondarycache=metadata backuppool'' if NVM cache is small (up to 10GB). Leave default if it is big enough. Keepeing also data has benefits to cache also index files.
 +      * ''l2arc_rebuild_enabled=1''
 +      * ''l2arc_mfuonly=2'' - prevent one time data reads from flooding the cache.
 +    * GC phase 1 needs to modify inodes. GC phase 2 stats every chunk so it spends its time on dnode misses. Ensure enough dnode cache in ARC. Tune ''arc_dnode_limit_percent'' 
 +      * ''echo 30 > /sys/module/zfs/parameters/zfs_arc_dnode_limit_percent''
 +      * ''echo $((24*1024**3)) > /sys/module/zfs/parameters/zfs_arc_max''
 +    * ''zfs_txg_timeout=15'' (was 5)
 +
 +
  
 <code> <code>
Line 7: Line 45:
 read/written from the HDDs). read/written from the HDDs).
  
-In general HDDs shouldn't be used with PBS, atleast not if you store alot of backups. And if you +In general HDDs shouldn't be used with PBS, at least not if you store a lot of backups. And if you 
 still do it, it's highly recommended to also use SSDs for storing the metadata. still do it, it's highly recommended to also use SSDs for storing the metadata.
 </code> </code>
Line 17: Line 55:
 So:  So: 
   * RAIDZ on HDDS is very slow (due to IO OPS limit to single HDD). Throughput is n x HDD, but IOOPS equals single HDD   * RAIDZ on HDDS is very slow (due to IO OPS limit to single HDD). Throughput is n x HDD, but IOOPS equals single HDD
-  * For HDDs use stripped mirrors to multiply IOOPS (i.e. for 6 disk: 3 stripes per 2 hdd in mirror)+  * For HDDs use stripped mirrors to multiply IOOPS (i.e. for 6 disk: 3 stripes per 2 x HDD in mirror) 
 +  * GC on HDD can takes days without metadata caching on SSD 
 +  * Use SSD as cache: 
 +    * MFU only or 
 +    * configure to cache metadata only
   * Use DRAID - where groups of stripes are used by design.   * Use DRAID - where groups of stripes are used by design.
-  * Use at least separate ZFS dataset for backup, then set block size to <code bash>zfs set recordsize=1M YourPoolName/DatasetUsedAsDatastore</code>+  * Use at least separate ZFS dataset for backup, then set block size to <code bash>zfs set recordsize=16M YourPoolName/DatasetUsedAsDatastore</code> 
 +  * Disable atime <code bash>zfs set atime=off backup2</code>. PBS is not relying on this mechanism. 
 +  * Compression is performed on client side. So enable light compression <code bash>zfs set compression=lz4 YourPoolName/DatasetUsedAsDatastore</code> 
 +  * For small RAM, prefer to cache metadata and data in L2ARC: ''zfs set primarycache=metadata backup'' 
  
  
 +Don't use a raidz1/2/3 as PBS needs high IOPS performance and IOPS performance will only scale with the number of striped vdevs, not with the number of disks. So 20 disks in a raidz wouldn't be faster than a single HDD.
 +And resilvering would also take forever.