SSD’s, Journaling, and noatime/relatime

On occasion, you will see the advice that the ext3 file system is not suitable for Solid State Disks (SSD’s) due to the extra writes caused by journaling — and so Linux users using SSD’s should use ext2 instead. However, is this folk wisdom actually true? This weekend, I decided to measure exactly what the write overhead of journaling actually is in actual practice.

For this experiment I used ext4, since I recently added a feature to track the amount of writes to the file system over its lifetime (to better gauge the wear and tear on an SSD). Ext4 also has the advantage that (starting in 2.6.29), it can support operations with and without a journal, allowing me to do a controlled experiment where I could manipulate only that one variable. The test workload I chose was a simple one:

Clone a git repository containing a linux source tree

Compile the linux source tree using make -j2

Remove the object files by running make clean

For the first test, I ran the test using no special mount options, and the only difference being the presence or absence of the has_journal feature. (That is, the first file system was created using mke2fs -t ext4 /dev/closure/testext4 , while the second file system was created using mke2fs -t ext4 -O ^has_journal /dev/closure/testext4 .)

Amount of data written (in megabytes) on an ext4 filesystem Operation <td align="center"> with journal </td> <td align="center"> w/o journal </td> <td align="center"> percent change </td> </tr> <tr> <td> git clone </td> <td align="right"> 367.7 </td> <td align="right"> 353.0 </td> <td align="center"> 4.00% </td> </tr> <tr> <td> make </td> <td align="right"> 231.1 </td> <td align="right"> 203.4 </td> <td align="center"> 12.0% </td> </tr> <tr> <td> make clean </td> <td align="right"> 14.6 </td> <td align="right"> 7.7 </td> <td align="center"> 47.3% </td> </tr>

What the results show is that metadata-heavy workloads, such as make clean , do result in almost twice the amount data written to disk. This is to be expected, since all changes to metadata blocks are first written to the journal and the journal transaction committed before the metadata is written to their final location on disk. However, for more common workloads where we are writing data as well as modifying filesystem metadata blocks, the difference is much smaller: 4% for the git clone, and 12% for the actual kernel compile.

The noatime mount option

Can we do better? Yes, if we mount the file system using the noatime mount option: