Which Linux filesystem is best for a huge Apache mod_disk_cache partition

apache-2.2cachedisk-cachefilesystems

Talking about a huge (50GB, 500.000 entries) Apache disk_cache partition: Which Linux filesystem performs best for this task?

In my example, the partition has a lot (500.000) of very small files (< 1 KB) and a lot (500.000) of files with ~ 50 KB.

File hierarchy is as deep as /htcache/B/x/i_iGfmmHhxJRheg8NHcQ.header.vary/A/W/oGX3MAV3q0bWl30YmA_A.header.

Typical actions are creating directories and files (by Apache), reading files (Apache) and removing files and directories (htcacheclean).

I'm currently using ext3 and I'm facing bad performance (i.e. slow ops with high IOwaits) when purging outdated files and emptied directories from the cache.

  • the ext3 filesystem was created with "-t news" (i.e. blocksize = 4096, inode_size = 256 and inode_ratio = 4096).
  • filesystem features: "has_journal ext_attr resize_inode dir_index filetype needs_recovery sparse_super large_file"
  • the partition is mounted with "noatime"

Best Answer

I wonder if using a non-journalling FS is an option (or turning journaling off in ext3). You could also try some ext3 tuning options - like noatime - tune2fs could help.

Btrfs is the new buzzFS at the moment... from the benhcmarks I've seen, it is comparable to (or better than) ext4. If I were starting with a new system, I'd prefer (tuned) ext4, then maybe btrfs, then (tuned) ext3 for may small files. I'd hesitate about ext2: old and stable and has no journalling, but haven't really seen it compared to the current ext3/ext4/btrfs.

You probably should not not go with XFS for many small files.