PSA: Nix on XFS on ZFS
First post deployed with new purpose built CI
This is the first post on this blog, that is deployed with my new purpose built CI. It's written in Haskell and it allows me to deploy new posts without having to rebuild the whole underlying NixOS server. But more on that in another post.
This is a very quick write up, to share an optimization I did and to ask folks to try it out and see what they find.
I run ZFS on my workstations and as such I get to both relish in the good parts of ZFS and also suffer under the bad parts daily. One of the primary issues I've had is Nix seeming very very slugish. In the past I've fixed some of it by VACUUM-ing the database that Nix uses (located at /nix/var/nix/db/db.sqlite usually) but today I took things a step further. I moved the database onto a XFS filesystem located on a zvol. And it seems to have done something?
I did some very unscientific measurements and it seems like the eval time for my VPS (the one that's serving this website), went down to 6 or 7 seconds from 9 or 11, which is not a huge improvement but every bit counts. If you do deploy this change and know how to do some scientific tests, please do reach out with your results and I'll update this post (or open a PR, by clicking on the Source Code link in the footer).
I also want to add, that the same approach of moving sqlite databases onto to a XFS filesystem on a ZVOL, can be applied to other programs, like atuin, Firefox, Hedgedoc or the Nix eval cache. I have noticed atuin randomly locking up on me and this experience has been corroberated by a good friend of mine, so atuin is probbaly gonna get the zvol treatement next.