User Tools

Site Tools


freebsd:zfs

Differences

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

Link to this comparison view

Next revision
Previous revision
freebsd:zfs [2020/09/27 01:54] – created sleepyfreebsd:zfs [2025/07/07 23:10] (current) – external edit 127.0.0.1
Line 1: Line 1:
-===== ZFS Commands =====+====== ZFS Commands ======
 <code>zfs list</code> shows USED and AVAILABLE after parity/redundancy are removed <code>zfs list</code> shows USED and AVAILABLE after parity/redundancy are removed
 <code>zpool list</code> shows ALLOCATED and FREE including space occupied by parity/redundancy <code>zpool list</code> shows ALLOCATED and FREE including space occupied by parity/redundancy
 +----
 +====== Create ZFS dataset ======
  
-=== /boot/loader.conf ===+===== PostgreSQL ===== 
 +~~REFNOTES~~ 
 +==== notes ==== 
 +  * use ZFS's cache is postgresql dataset exceeds RAM, use postgres's cache if dataset fits in RAM 
 +    * disable postgres cache, enable ZFS cache 
 +    * enable postgres cache, disable ZFS cache 
 + 
 +==== zfs ==== 
 +  * **atime=off** -- disable access time recording for files when they are read 
 +  * **compression=lz4** -- turn on compression 
 +  * **recordsize=8k** -- set record size to postgres's default write block size 8k 
 +  * **logbias=throughput**  --  
 +  * **primarycache=metadata** -- ARC only cache metadata (dnode entries), not page data itself. DO NOT disable if PostgreSQL's cache is disabled! 
 +  * quota=500G 
 + 
 +==== postgres ==== 
 +  * disable full_page_writes 
 +  * disable PostgreSQL TOAST compression 
 +  * dedicate 15%-25% physical ram to ARC, and 50% to shared_buffers 
 +=== raw benchmark data === 
 +{{tablelayout?tableSort=1}} 
 +^ pgbench -c 10 -j 2 -t 10000 ^ inc. connections est. ^ exc. connections est. ^ latency ^ 
 +| BASE |  6775 |  6776 |  1.476 ms | 
 +| primarycache=metadata |  3850 |  3850 |  2.597 ms | 
 +| primarycache=metadata compression=lz4 |  4815 |  4816 |  2.077 ms | 
 +| primarycache=metadata compression=lz4 recordsize=16k |  4160 |  4160 |  2.404 ms | 
 +| primarycache=metadata, compression=lz4, recordsize=16k, atime=off |  3415 |  3415 |  2.928 ms | 
 +| primarycache=metadata, compression=lz4, recordsize=8k, atime=off |  4362 |  4363 |  2.292 ms | 
 +| primarycache=metadata, compression=lz4, recordsize=8k, atime=off, \\ shared_buffers=2048MB |  5862 |  5863 |  1.706 ms | 
 +| primarycache=metadata, compression=lz4, recordsize=16k, atime=off, \\ shared_buffers=2048MB |  5819 |  5820 |  1.718 ms | 
 +| compression=lz4, recordsize=16k, atime=off, \\ shared_buffers=2048MB |  7628 |  7628 |  1.311 ms | 
 +| compression=lz4, recordsize=16k, atime=off, \\ shared_buffers=4096MB |  7332 |  7333 |  1.364 ms | 
 +| compression=lz4, recordsize=16k, atime=off, logbias=throughput, \\ shared_buffers=4096MB, synchronous_commit=off |  27052 |   27067 |  0.370 ms | 
 +| compression=lz4, recordsize=16k, atime=off, logbias=throughput, \\ shared_buffers=4096MB, synchronous_commit=off, full_page_writes=off |  30348 |  30366 |  0.330 ms | 
 + 
 + 
 +---- 
 +====== /boot/loader.conf ======
 <code> <code>
 # ZFS tuning. arc min at 2GB, max at 8GB. ashift to 12 for 4k sectors # ZFS tuning. arc min at 2GB, max at 8GB. ashift to 12 for 4k sectors
Line 45: Line 84:
 </code> </code>
  
 +----
 ===== Benchmarks ===== ===== Benchmarks =====
 {{tablelayout?tableSort=1}} {{tablelayout?tableSort=1}}
freebsd/zfs.1601171688.txt.gz · Last modified: (external edit)