zpool txg_sync

Tuning needed for zfs parameters or server vm

How to tune zfs or system itself so that txg_sync is not in uninterrupted sleep state ?  ubuntu server 16.04 (kernel 4.15)installed on ZFS backed(no ext4 or xfs), below is zpool status. the server has [256 GB of memory and 46 core cpu] and HDD is 10K SAS drives(no SSD disk). the pool "root_pool" is created with below options enabledashift=12, atime=off , canmount=off ,compression=lz4,logbias=throughput,sync=disabled and No deduplication is enabled (zfs get all output in end)
zpool status 
  pool: root_pool
 state: ONLINE
  scan: none requested
config:
NAME        STATE     READ WRITE CKSUM
root_pool     ONLINE       0     0     0
  sda2      ONLINE       0     0     0
errors: No known data errors
  pool: PoolB
 state: ONLINE
  scan: none requested
config:
NAME        STATE     READ WRITE CKSUM
PoolB  ONLINE       0     0     0
  sdb       ONLINE       0     0     0
errors: No known data errors
# lsblk
NAME  MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sdb 8:16  0 1T 0 disk 
├─sdb9  8:25  0 8M 0 part 
└─sdb1  8:17  0 1024G 0 part 
zd0 230:0 0 4G 0 disk 
sda 8:0 0 1T 0 disk 
├─sda2  8:2 0 1024G 0 part 
├─sda9  8:9 0 8M 0 part 
└─sda1  8:1 0 1007K 0 part 
below is a snippet of the output of iostat -x  where the %iowait value is constantly 5% to 13%
when i search for the process in interruptible sleep
S   PID CMD
D  5858 [txg_sync]
D  4356 [txg_sync]
above is process name I see 99% of the time and the pid 4356 doesn't change
Below is output of zfs getall root_pool/logs which is more io intensive
NAME     PROPERTY              VALUE                  SOURCE
root_pool  type                  filesystem             -
root_pool  creation              Wed Nov 28  8:06 2018  -
root_pool  used                  621G                   -
root_pool  available             363G                   -
root_pool  referenced            96K                    -
root_pool  compressratio         3.62x                  -
root_pool  mounted               no                     -
root_pool  quota                 none                   defau        
sda is maxed out at %util 100. And it's a single-disk pool, so that doesn't likely mean sda is failing, it just means you're asking it to do more than a single disk can do.
Tuning isn't going to fix this, you just plain need more IOPS. Your options are 1. add more vdevs to the pool or 2. replace sda with an SSD.
In general, the IOPS profile of a pool is additive of all vdevs. So you have a single vdev (whether it's one disk, or a six-disk stripe) you get one disk's worth of IOPS. You add a second vdev (again, whether single disk, or n-wide stripe) and you get another disk's worth of IOPS. This is a general trend, not a hard-and-fast exact measurement, but it's good enough for calculations.
You'll be able to roughly double the performance you're seeing now if you add another vdev to the root pool. Of course, you'll also be roughly doubling the likelihood of a failure than can bring the pool low, since you're rocking single-disk vdevs, and therefore have no parity or redundancy. Whether this is acceptable or not is up to you, but be certain you've thought through the consequences of a catastrophic pool failure.
A single decent SSD will give you three orders of magnitude more IOPS than that 10K SAS disk you're using right now. The kicker is going to be the cost per TB of storage. If you're storing a lot of data, you might need to just add more spindles instead. If you do add more vdevs, you're going to need to balance the data you've already got; this ideally would mean backing data up externally, destroying the pool, then copying the data back on board after adding the new vdevs. You canjust add the vdevs, backup the data, then delete the data (and all snapshots containing it) then copy it back on the expanded pool... but it's cleaner to just destroy it.
If you switch from single disk vdevs to mirrors, you get more options. Each vdev still only gives you a single disk worth of write IOPS, but it gives you two disks' worth of read IOPS - probably not critical for a log server - and it gives you the ability to rebalance data on-the-fly with a small risk window:
  • scrub the pool (do not skip this initial step!)
  • detach one disk from each mirror
  • create a new pool with the detached disks, and any new disks you're adding
  • replicate from old pool to new
  • quiesce any write sources
  • replicate from old to new again (will go extremely rapidly; typically <1 min)
  • destroy old pool
  • export new pool, reimport new pool with old pool's name
  • attach remaining disks from destroyed pool to disks in new pool to upgrade from single-disk vdevs to mirror vdevs again
  • de-quiesce data sources
https://www.reddit.com/r/zfs/comments/7l64mt/what_zol_performance_optimization_settings_do_you/

No comments:

Post a Comment