Presentation slides for running MySQL (InnoDB) on ZFS. Since most databases have analogues to optimisation targets mentioned, it is more broadly applicable.
2. Disk Geometry
● ZFS:
− pools
● mirror vdevs (equivalent of RAID1 / RAID10)
● ashift to match the drives (it may be dangerous to
assume long-term availability of disks with < 4KB sectors)
● versions > v28 aren't cross-compatible, but OpenZFS
v5000 is required for LZ4 compression (LZJB still helps
on v28)
4. File System Options
● ZFS
− File systems
● atime=off
● compression=lz4
● logbias=throughput
● primarycache=metadata
● recordsize=16k (128k for logs)
● xattr=sa
5. MySQL Options
● MySQL
− innodb_flush_method=fsync (O_DIRECT is in ZoL
0.8, but ZFS primarycache=metadata ensures no
double caching)
− innodb_doublewrite=0 (ZFS is copy-on-write and
transactional, precluding partial writes)
− innodb_checksum_algorithm=none (>= 5.6.3)
− innodb_checksum=0 (< 5.6.3)
− Don't use compression – leaving it to ZFS results in
faster performance, lower space consumption and
doesn't break storage alignment
6. Other benefits
● Transparent error detection and self-healing
● Improved performance (compression and CoW)
● Efficient backups in impractical situations
− Snapshots without a performance penalty
− Efficient incremental snapshot transfers
− Efficient Galera state transfers (custom script)