Linux – Best Linux Filesystem for MySQL (InnoDB)

benchmarkdatabasefilesystemslinuxMySQL

I tried to look for benchmark on the performances of various filesystems with MySQL InnoDB but couldn't find any.

My database workload is the typical web-based OLTP, about 90% read, 10% write. Random IO.

Among popular filesystems such as ext3, ext4, xfs, jfs, Reiserfs, Reiser4, etc. which one do you think is the best for MySQL?

Best Answer

How much do you value the data?

Seriously, each filesystem has its own tradeoffs. Before I go much further, I am a big fan of XFS and Reiser both, although I often run Ext3. So there isn't a real filesystem bias at work here, just letting you know...

If the filesystem is little more than a container for you, then go with whatever provides you with the best access times.

If the data is of any significant value, you will want to avoid XFS. Why? Because if it can't recover a portion of a file that is journaled it will zero out the blocks and make the data un-recoverable. This issue is fixed in Linux Kernel 2.6.22.

ReiserFS is a great filesystem, provided that it never crashes hard. The journal recovery works fine, but if for some reason you loose your parition info, or the core blocks of the filesystem are blown away, you may have a quandry if there are multiple ReiserFS partitions on a disk - because the recovery mechanism basically scans the entire disk, sector by sector, looking for what it "thinks" is the start of the filesystem. If you have three partitions with ReiserFS but only one is blown, you can imagine the chaos this will cause as the recovery process stitches together a Frankenstein mess from the other two systems...

Ext3 is "slow", in a "I have 32,000 files and it takes time to find them all running ls" kinda way. If you're going to have thousands of small temporary tables everywhere, you will have a wee bit of grief. Newer versions now include an index option that dramatically cuts down the directory traversal but it can still be painful.

I've never used JFS. I can only comment that every review of it I've ever read has been something along the lines of "solid, but not the fastest kid on the block". It may merit investigation.

Enough of the Cons, let's look at the Pros:

XFS:

  • screams with enormous files, fast recovery time
  • very fast directory search
  • Primitives for freezing and unfreezing the filesystem for dumping

ReiserFS:

  • Highly optimal small-file access
  • Packs several small files into same blocks, conserving filesystem space
  • fast recovery, rivals XFS recovery times

Ext3:

  • Tried and true, based on well-tested Ext2 code
  • Lots of tools around to work with it
  • Can be re-mounted as Ext2 in a pinch for recovery
  • Can be both shrunk and expanded (other filesystems can only be expanded)
  • Newest versions can be expanded "live" (if you're that daring)

So you see, each has its own quirks. The question is, which is the least quirky for you?