0

I understand ZFS uses / can be set up to use an SSD as L2ARC cache, ZIL, as well as host for a deduplication table.

None of these appear to require a fixed minimum size (the deduplication table might, info on this is somewhat vague - maybe the deduplication table itself could be hosted on a slow disk and accelerated by L1/L2ARC). Which brings us to the idea of using the same disk for the same performance reasons as host for the swap space, which also has dynamic size requirement, depending on memory load.

Is there a way to automatically resize both swap and L2ARC according to memory needs similar to how swapspace grows the swap space automatically, and L1ARC is reduced according to memory pressure?

A different way I could imagine the same effect would be achievable was if the pagefile is cached in L2ARC. Can anyone confirm to which extent this is the case?

1

No.

Both L2ARC and ZIL require dedicated block devices (e.g. a partition or an entire disk). These, of course, have a fixed size.

For a ZIL, you don't need much space. 4GB is more than enough. 1 or 2GB is also fine. For safety, it's best if the ZIL is mirrored over two or more devices.

L2ARC shouldn't be mirrored. It's just transient cached data, so there's no point, and it's just wasteful to do so.

e.g. this is what I have on my backup pool on my home ZFS server:

# zpool list -L -v backup 
NAME   SIZE  ALLOC   FREE  EXPANDSZ   FRAG    CAP  DEDUP  HEALTH  ALTROOT
backup  7.25T  3.62T  3.63T         -    18%    49%  1.00x  ONLINE  -
  mirror  3.62T  1.81T  1.82T         -    18%    49%
    sde      -      -      -         -      -      -
    sdf      -      -      -         -      -      -
  mirror  3.62T  1.81T  1.82T         -    18%    49%
    sdh      -      -      -         -      -      -
    sdg      -      -      -         -      -      -
log      -      -      -         -      -      -
  mirror  1.98G    48K  1.98G         -     0%     0%
    sdn6      -      -      -         -      -      -
    sdo6      -      -      -         -      -      -
cache      -      -      -         -      -      -
  sdn7  37.2G  31.7G  5.51G         -     0%    85%
  sdo7  37.2G  30.3G  6.84G         -     0%    81%

The log (ZIL) is mirrored. the cache (L2ARC) is not.

sd[e-h] are seagate ST4000DX001 hybrid drives (i.e. with 8GB flash cache built in). sd[no][67] are partitions on Crucial_CT275MX300SSD1 SSDs (the same SSDs that my zfs root pool is on).

  • Thanks for the answer! I added an aspect to the question since it being entirely impossible left me a bit dissatisfied :b Would you mind taking a look? – hyperfekt Aug 7 '17 at 3:06
  • if you're using a swapfile on a zfs dataset that has an L2ARC then it will be cached by ARC AND L2ARC exactly the same as any other file. It's hard to see why you'd want to do this, there's no benefit...and the fact that it's also cached by ARC would add additional memory pressure to the ARC. i.e. this would not only be premature optimisation, but also detrimental optimisation. Just use a swap file or partition on your SSD. Or if you have a zpool on SSDs, create a ZVOL on it and use that for swap. – cas Aug 7 '17 at 3:45
  • Normally the system or you would set primarycache=metadata for ZFS swap devices. You could even set it to disabled if you wanted. – sleepyweasel Aug 14 '17 at 19:48
  • Is there a performance boost from using a ZIL on an ssd? I just have one ssd partition to be used for this. This ssd also has my root partition. – user128063 Sep 16 '17 at 20:35
  • If you are doing a lot of fsynced writes (e.g. a database. another fairly common example is that sometimes syslog is configured to fsync some log files on each write), then yes - having ZIL on an SSD can improve performance. – cas Sep 17 '17 at 4:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.