What’s the fastest filesystem (and/or filesystem options) for a drive where I don’t care about whether the data survives a crash or power-off, such as /tmp?
The data is a few hundred gigabytes so won’t all fit in RAM. There is a mix of small and very large files (think HTML files and videos).
Is it best to just create a massive swap partition and use tmpfs? (Will that even work?) Or should I use ext2/3/4 or XFS or Btrfs? What are the optimization options I should use to turn off all the safety features and get the most performance out of the filesystem?
The disk is a HDD. An SSD is not feasible: This is a build server, so data is always being deleted and recreated, so the number of bytes written per day is a few times larger than the disk size. That means a consumer SSD is unlikely to last, and datacenter class SSDs designed for the high write load are too expensive.
Sounds like your builds are rather large, so I’d stay away from massive swap + tmpfs – this could indiscriminately force your system into swapping while building which will ruin your build performance.
For my build systems I only had the ext2 and ext3 options, ext2 was faster (understandably – no journaling).
Look also at tune2fs and mount options in addition to mkfs options (as applicable). You could probably drop stuff like user_xattr, acl. You might be able to drop timestamping (noatime, nodiratime) but with care – some builds may depend on that.
Don’t forget fragmentation, it really creeps up in such highly-churned partitions, especially if they often go over 80-90% fill level. I was re-formatting the build partitions about once a month – for my builds that alone meant some 10-15% improvement.
IMHO the best way of approaching this is to really try your options out, measure and compare using one of your typical builds as reference.
Side note: the speed of the HDD might not be the significant limiting factor in the overall build speed (I had builds which had less than 10% improvement in tmpfs/ramfs vs on HDDs). The build structure/dependencies/parallelism (which may change in time as the code evolves), -j factor, CPU/RAM load, networking, other infrastructure services your build might use can also matter significantly.
Hate to be that guy but…it depends. It’s all dependent on your workload. Only testing will show the best choice. If this is a build server, you will probably be CPU limited anyway so I’d go with the simplest solution.
Using tmpfs/swap will tax the heck out of your CPU when the data is getting pushed and pulled from memory. I wouldn’t go this route since if it is a build server, you probably want those cycles going towards building anyway.
In terms of file system type I’d choose any filesystem and mount it with “noatime”. That will give the best performance with the least amount of work to start some testing.