Fun!
Pretty sure you already know this, but an alternative is to tune a separate ZFS dataset to perform well with databases (at the expense of small files, which is why you make it a separate dataset) - see Tuning recordsize in OpenZFS - Klara Systems for a random example article.
1 Like
Yep, I do, I do that for PostgreSQL, where I have found 8k to work well. But I haven’t really found anyone talking about what is the correct tuning for SQLite and honestly, I couldn’t be arsed to find out :D. So I just slapped it on XFS.
1 Like
How did the thought of moving it to XFS occur to you in the first place? What’s the reasoning here?
I use ZFS and face similar issues, but I would never think about this.
Sorry if the question is stupid but I’m no filesystems expert.
norpol
June 29, 2026, 12:49pm
5
FYI the ZFS sqlite performance issues should be resolved with 2.4.0
opened 05:51PM - 23 Dec 25 UTC
Good news! 🎉
In #952 (locked so posting new issue), @ellie mentioned:
> We wi… ll likely consider deprecating + removing it as soon as the issue with ZFS is resolved
The ZFS issue has now been resolved. PR https://github.com/openzfs/zfs/pull/17584 by Rob Norris (Klara, Inc. / Wasabi Technology, Inc.) was merged and included in ZFS 2.4.0 (released 2025-12-18):
| Commit | Description |
|--------|-------------|
| [`fb7a8503bcfb`](https://github.com/openzfs/zfs/commit/fb7a8503bcfb) | Linux: zfs_putpage: complete async page writeback immediately |
| [`a18c9edda621`](https://github.com/openzfs/zfs/commit/a18c9edda621) | Linux: sync: remove async/sync accounting |
| [`c3496b5cc6f8`](https://github.com/openzfs/zfs/commit/c3496b5cc6f8) | Linux: zfs_putpage: document (and fix!) confusing sync/commit modes |
| [`7ac5440ecf53`](https://github.com/openzfs/zfs/commit/7ac5440ecf53) | ZTS: mmap_ftruncate test to confirm async writeback behaviour |
The fix unlocks pages immediately once data is in the DMU/ZIL, rather than waiting for the ZIL itx callback. This eliminates the `ftruncate()` blocking on mapped page writeback that caused 500ms-5s delays at every shell prompt.
Root cause: https://github.com/openzfs/zfs/issues/14290
Users on ZFS 2.4.0+ should no longer need:
- Atuin daemon mode
- `sync=disabled` workaround
- ext4 zvol workaround
- `zfs_txg_timeout` tuning
Is deprecating the daemon still on the table?
opened 02:51PM - 15 Dec 22 UTC
closed 04:56PM - 06 Aug 25 UTC
Type: Defect
### System information
Type | Version/Name
--- | ---
Distribution Name | F… edora
Distribution Version | 36
Kernel Version | 5.15.82
Architecture |x86_64
OpenZFS Version |2.1.7
### Describe the problem you're observing
Usually `rpm` commands execute quickly, but pretty often (10% of the cases) there is 4 second extra delay:
```
16:22:55.694445 openat(AT_FDCWD, "/usr/lib/sysimage/rpm/rpmdb.sqlite-shm", O_RDWR|O_CREAT|O_NOFOLLOW|O_CLOEXEC, 0644) = 6 <0.000086>
16:22:55.694563 newfstatat(6, "", {st_dev=makedev(0, 0x1e), st_ino=27231358, st_mode=S_IFREG|0644, st_nlink=1, st_uid=0, st_gid=0, st_blksize=131072, st_blocks=18, st_size=32768, st_atime=1671114175 /* 2022-12-15T16:22:55.105109260+0200 */, st_atime_nsec=105109260, st_mtime=1671114175 /* 2022-12-15T16:22:55.106109257+0200 */, st_mtime_nsec=106109257, st_ctime=1671114175 /* 2022-12-15T16:22:55.106109257+0200 */, st_ctime_nsec=106109257}, AT_EMPTY_PATH) = 0 <0.000011>
16:22:55.694692 geteuid() = 0 <0.000010>
16:22:55.694759 fchown(6, 0, 0) = 0 <0.000047>
16:22:55.694855 fcntl(6, F_GETLK, {l_type=F_UNLCK, l_whence=SEEK_SET, l_start=128, l_len=1, l_pid=0}) = 0 <0.000010>
16:22:55.694909 fcntl(6, F_SETLK, {l_type=F_WRLCK, l_whence=SEEK_SET, l_start=128, l_len=1}) = 0 <0.000009>
16:22:55.694953 ftruncate(6, 3) = 0 <4.372489>
```
I have ZFS as root fs running on top of **LUKS2**. NVMe Corsair MP510 (Max Random Write QD32 IOMeter: Up to _440K_ IOPS) with practically zero other IO operations when I run `rpm`.
### Describe how to reproduce the problem
Just try rpm again.
### Include any warning/errors/backtraces from the system logs
zpool show no errors and:
```
NAME PROPERTY VALUE SOURCE
tank type filesystem -
tank creation Wed Nov 10 15:40 2021 -
tank used 1.39T -
tank available 296G -
tank referenced 96K -
tank compressratio 1.29x -
tank mounted no -
tank quota none default
tank reservation none default
tank recordsize 128K default
tank mountpoint /tank default
tank sharenfs off default
tank checksum on default
tank compression zstd-3 local
tank atime on default
tank devices on default
tank exec on default
tank setuid on default
tank readonly off default
tank zoned off default
tank snapdir hidden default
tank aclmode discard default
tank aclinherit restricted default
tank createtxg 1 -
tank canmount off local
tank xattr sa local
tank copies 1 default
tank version 5 -
tank utf8only on -
tank normalization formD -
tank casesensitivity sensitive -
tank vscan off default
tank nbmand off default
tank sharesmb off default
tank refquota none default
tank refreservation none default
tank guid 8575689710526589949 -
tank primarycache all default
tank secondarycache all default
tank usedbysnapshots 0B -
tank usedbydataset 96K -
tank usedbychildren 1.39T -
tank usedbyrefreservation 0B -
tank logbias latency default
tank objsetid 54 -
tank dedup off default
tank mlslabel none default
tank sync standard default
tank dnodesize auto local
tank refcompressratio 1.00x -
tank written 0 -
tank logicalused 1.77T -
tank logicalreferenced 42K -
tank volmode default default
tank filesystem_limit none default
tank snapshot_limit none default
tank filesystem_count none default
tank snapshot_count none default
tank snapdev hidden default
tank acltype posix local
tank context none default
tank fscontext none default
tank defcontext none default
tank rootcontext none default
tank relatime on local
tank redundant_metadata all default
tank overlay on default
tank encryption off default
tank keylocation none default
tank keyformat none default
tank pbkdf2iters 0 default
tank special_small_blocks 0 default
```
1 Like
I’ve been running ZFS on everything for nearly 5 years and i maintain a sizable homelab (more like homeprod these days). I’ve had issues with zfs performance in the past, especially when it comes to databases. A database like sqlite and postgres are actually somewhat similar to zfs. The internal data layout is different, but they both keep a write ahead log, journal, zfs intent log, whatever you want to call it. It’s purpose is to allow the program to quickly and reliably make sure that all changes make it to disk when desired. Then, the log is applied to the actual on-disk datastore.
But yeah, honestly, mostly a hunch. If i had more time on my hands, way more time, id also attempt to write a patch for Nix which allows it to store store paths in a prefix form. So instead of /nix/store/aaaaaaaa youd have /nix/store/aa/aaaaaa which should help with the ZAP (data structures zfs uses for directory lookups). Youd also need a kernel module which undoes this prefixing so it still looks like a normal store to the rest of the system.
1 Like
I’ll check, i might be on 2.4 already. Will update this comment when I do.
@norpol yes i am:
zfs-2.4.3-1
zfs-kmod-2.4.1-1
1 Like