XFS vs ext4 performance

xfs
58,129

A previous XFS Q/A mentioned this page: How to Choose Your Red Hat Enterprise Linux File System. I think it will address your question about performance :-). This is from the official Red Hat Knowledgebase. It would be inappropriate to copy the whole page. Here is a taste:

Another way to characterize this is that the Ext4 file system variants tend to perform better on systems that have limited I/O capability. Ext3 and Ext4 perform better on limited bandwidth (< 200MB/s) and up to ~1,000 IOPS capability. For anything with higher capability, XFS tends to be faster. XFS also consumes about twice the CPU-per-metadata operation compared to Ext3 and Ext4, so if you have a CPU-bound workload with little concurrency, then the Ext3 or Ext4 variants will be faster. In general, Ext3 or Ext4 is better if an application uses a single read/write thread and small files, while XFS shines when an application uses multiple read/write threads and bigger files.

Previous answer

Here is a previous version of this answer. I have adapted and expanded it, to provide context and corroborate the above source. It is not all essential reading.


It does not make sense to avoid XFS for being old. There are many similarities between XFS and ext2/ext3/ext4, including their long and active lives.

XFS is the main supported filesystem for RedHat Enterprise Linux. A lot of effort has gone in to develop XFS over time, particularly from RHEL. The sheer number of new and advanced features is higher in XFS :-). See e.g. support for "reflink".

"Desktop Linux" installs - which also target modern laptops - still generally use ext4. ext4 provides a very familiar, well-known environment.

On an average desktop PC, the advantages of XFS do not necessarily apply. ext4 might have advantages, including performance advantages. Although if you take the figures above at face value, they suggest XFS might have an advantage on fast modern laptops!

Currently, the ext4 maintainer is employed by Google. ext4 is used in Google's Android OS. So ext4 is used in many phones and tablets, which have less powerful hardware.[1][2]

I also find ext4 convenient because you can shrink the filesystem partitions. This is potentially useful when you want to manage the space used by different installs on a single disk. XFS does not have support for shrinking, only growing. (In principle, this can be addressed within LVM, using "thin provisioning". See Stratis Storage, which uses XFS together with thin provisioning. Perhaps in future Stratis will take off, and all distros will be installable to Stratis).

In some cases, the ext4 design has been described as old and messy. XFS clearly managed a bit better here: Simple file copy (or write) causes ten second+ latency on Linux filesystem. UPDATE: this link now mentions patches which have been submitted to improve ext4 here, probably for v5.3 of the Linux kernel. And there could still be significant improvements in future.

XFS "small file performance"

XFS performance when dealing with many small files was originally a major weakness, relative to other filesystems. Improvements have been made over time.

A big change to be aware of is delayed logging, sometime around 2010-2012. I.e. in case you see any small-file performance comparisons which pre-date this feature, they are no longer relevant. The delayed logging design was heavily based on ext3 logging :-). Nevertheless, there were still performance differences between the two in different cases. See: https://lwn.net/Articles/476263/

(Before that, apparently "the version 2 log format was added in 2002, which helped make metadata performance much better". But this probably does not help answer this question :-).

There are some further changes since then. E.g. the Red Hat document might not reflect all the most recent changes. I noticed this quote:

[...] free inode B+ trees (finobt) for better performance on "aged" filesystems, and file types are now stored in the directory by default (ftype=1) which greatly improves performance in certain scenarios with lots of (usually small) files.

-- comment on What is the most high-performance Linux filesystem for storing a lot of small files (HDD, not SSD)?

Share:
58,129

Related videos on Youtube

Admin
Author by

Admin

Updated on September 18, 2022

Comments

  • Admin
    Admin over 1 year

    According to this blog,

    XFS is old file system and works slowly with small files.

    My first impression when reading this was XFS was not good.

    However someone told me that XFS makes disk perform better and this benchmark doesn't make sense.

    enter image description here

    So I did more research on this and found the following facts.

    wikipedia says that

    XFS is a high-performance 64-bit journaling file system created by Silicon Graphics, Inc (SGI) in 1993. It was the default file system in SGI's IRIX operating system starting with its version 5.3. XFS was ported to the Linux kernel in 2001; as of June 2014, XFS is supported by most Linux distributions, some of which use it as the default file system.

    wikipedia again ...

    Metadata operations in XFS have historically been slower than with other file systems, resulting in, for example, poor performance with operations such as deletions of large numbers of files.

    And howtogeek says that

    XFS has good performance when dealing with large files, but has worse performance than other file systems when dealing with many small files. It may be useful for certain types of servers that primarily need to deal with large files.

    Are those facts and the benchmark correct?

    • Admin
      Admin almost 5 years
      Filesystems change... kernel schedulers change... storage itself changes. Different applications have different requirements. It all depends on too many variables to count, and performance is not everything - you also have to be able to trust it and know how to handle it when things go south. In the end, you have to run your own benchmarks, and make your own choice...
    • Admin
      Admin almost 5 years
      Everything you have said is consistent, there are no contradictions. However You will need to test for your work loads. Optimisation assumptions often slow a system down. Always measure.
    • Admin
      Admin almost 5 years
      EXT4 is also using a certain amount of space for inodes compared to XFS. And as frostschutz said... everything changes in time. When BTRFS arrived on the market, it supposed to be a fantastic FS but it looks like things changed
    • Admin
      Admin almost 5 years
      I've only seen good performance from XFS, both in benchmarks and in practice. I doubt there exists benchmarks that shows otherwise (for recent versions of XFS). Specialized file systems might beat XFS for specialized tasks, but XFS should have performance comparable to the other performant file systems.