You may be interested in checking out bcache[1] or bcachefs[2].
[1] https://www.kernel.org/doc/html/latest/admin-guide/bcache.ht...
https://github.com/45Drives/autotier is exactly what they were asking for as well
Worked well enough on the small scale, but sadly haven't had the time or hardware to test it in a more production-like environment.
Also, it was starting to feel a bit like a Jenga tower, increasing the chances of bugs and other weird issues to strike.
I started thinking about this when considering using a SAN for the disks, so that write speed was limited by the 10GbE network I had. A local NVMe could then absorb write bursts, maintaining performance.
That said, it's not something I'd want to use in production that's for sure.
There was some work being done on writeback caching for ZFS[1], sadly it seems to have remained closed-source.
ZFS of course has its limits too. But in my experience I feel much more confident (re)configuring it. You can tune the real world performance well enough especially if you can utilize some of the advanced features of ZFS like snapshots/ bookmarks + zfs-send/recv for backups. Because with LVM/ XFS you can certainly hack something together which will work pretty reliably too but with ZFS it's all integrated and well tested (because it is a common use case).
I love ZFS overall, it's been rock solid for me in the almost 15 years I've used it. This is just that one area where I feel could do with some improvements.
Another much simpler filesystem-agnostic alternative would be to copy it over to the SSD with a script and commence streaming from there. You'll have to wait for the entire file to copy for the stream to start, though. I think some streaming servers may actually support this natively if you mount /var and/or /var/tmp on the faster drive and configure it to utilize it as a "cache".
As a sibling says, ZFS should support this pretty transparently.
http://jolly.jinx.de/teclog/2012.10.31.02-fusion-drive-loose...
blockdev --setra <num_sectors> /dev/sdX
But I feel like there was a sysctl for this too in the past. I used it back in the day to make the HDD in my laptop spin down immediately after a new song started playing in rhythmbox by setting it to 16MB.Additionally, ZFS supports using SSDs to supplement the cache.
Maybe there is some combination of settings that will get it to cache more aggressively; just saying that it's not a given that it will do so.
/sys/module/zfs/parameters/zfs_arc_max
or setting the module e.g. in /etc/modporbe.d/zfs.conf
to something like this options zfs zfs_arc_max=<size in bytes>
). But be careful, as the ZFS ARC does not play that nice with the OOM killer.I'm using Jellyfin server and Infuse on Apple TV, so I don't have a great way to force-slurp a file on first read, at least not without patching Jellyfin. And I'm not super eager to learn C#.
Even if I were streaming to mpv, most of my lan is only gigabit which is much less then what my storage array can put out.
have a ssd ie mounted in /tmp/movies
and create a script in .bin/ (or whatever)
#!/bin/sh
tmp_m="/tmp/movies/$(mktemp -d)"
cp "$@" $tmp_m
mpv $tmp_m
rm $tmp_m
please note i have not tried the script but it probably works
Edit: demuxer-max-bytes=2147483647
I'm unsure if they ship any macs with these anymore. I guess not since the Apple Sillicon iMacs don't have spinning hard drives?
You can do all sorts of really neat things. You can define pools of drives at different cache levels. You can have a bunch of mechanical drives for deep storage, some for hot storage, SSD to cache recently read files, then write-through from the SSD down to mechanical drives, either immediately or after a delay.
It's pretty much everything I could wish for from a filesystem, though I haven't actually taken the time to try it out yet. AFAIK it's still somewhat experimental, more or less in beta.
Edit: or maybe it was some drama over userspace tooling, I can't remember tbh.
https://jonathancarter.org/2024/08/29/orphaning-bcachefs-too...
ZFS has caching for writes (SLOG)[0][1] and reads (L2ARC),[2][3] which was introduced many years ago when HDDs were cheap and flash was still very, very expensive:
* https://www.brendangregg.com/blog/2009-10-08/hybrid-storage-...
[0] https://openzfs.github.io/openzfs-docs/man/master/7/zpoolcon...
[1] https://openzfs.github.io/openzfs-docs/man/master/8/zpool-cr...
[2] https://openzfs.github.io/openzfs-docs/man/master/7/zpoolcon...
[3] https://openzfs.github.io/openzfs-docs/man/master/8/zpool-ad...
Not really.
It will accumulate synchronous writes into the ZIL, and you put the ZIL on a fast SLOG vdev. But it will only do so for a limited amount of time/space, and is not meant as a proper write-back cache but rather as a means to quickly service synchronous writes.
By default asynchronous writes do not use the ZIL, and hence SLOG vdev at all. You can force it to, but that can also be a bad idea unless you have Optane drives as you're then bottlenecked by the ZIL/SLOG.
A SLOG needs to have: good throughput and low latency at a queue depth of 1.
Also, the L2ARC is great, but does still have RAM overhead. There are also useful tunables. I had a workload on a RAM limited machine where directory walking was common, but data reads were fairly random and a L2ARC configured for metadata only speed it up by a large amount.
cat filename > /dev/null
Reads the entire file into the OS buffer.
I have a somewhat large zfs array and it makes consistent noise as I stream videos from it. The streaming is basically a steady trickle compared to what the array is capable of. I'd rather incur all the noise up front, as fast as possible, then continue the stream from a silent SSD.