4

From the mongo official site, xfs is highly recommended,

Linux/Unix: format your drives into XFS or EXT4. If possible, use XFS as it generally performs better with MongoDB. With the WiredTiger storage engine, use of XFS is strongly recommended to avoid performance issues found when using EXT4 with WiredTiger. If using RAID, you may need to configure XFS with your RAID geometry.

I have a ext4 format drive mounted on the root path(/) and plan to add another xfs drive to hold all the mongo data. Do I also need to format my root drive into xfs format or not?

2

1 Answer 1

2

To answer the question directly, I would say not to change your root partition (which, I'm assuming, contains all of your OS files - i.e. your kernel) file system to XFS. By all means, use XFS on your new disk system for your Mongodb data.

I'm not sure of your exact disk setup, but if you have multiple disks, I would recommend OS on one (set), swap/tmp on another, database software on another, and actual data on yet others - that way you don't have OS calls blocking db stuff and vice versa. This also helps with restoring in the (unlikely) event of a disk (set) failure.

From here, you are correct in saying that

When running MongoDB in production on Linux, you should use Linux kernel version 2.6.36 or later, with either the XFS or EXT4 filesystem. If possible, use XFS as it generally performs better with MongoDB.

With the WiredTiger storage engine, use of XFS is strongly recommended to avoid performance issues that may occur when using EXT4 with WiredTiger.

From here (generally a good site), you can see that xfs is good for large files:

XFS was developed by Silicon Graphics in 1994 for the SGI IRX operating system, and was ported to Linux in 2001. It’s similar to Ext4 in some ways, as it also uses delayed allocation to help with file fragmentation and does not allow for mounted snapshots. It can be enlarged, but not shrunk, on the fly. 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.

Now, I'm not sure about Mongodb, but as a database system, it probably has large files :-) - however, the kernel itself is primarily developed on ext4 and it is the default for a reason.

Remember that a recommendation is just that: a recommendation for an average set of databases with an average set of requirements! You should, if possible, benchmark with your own data on your own machines (prod and test!).

Another thing I've noticed about database file system benchmarks is that there's normally not a huge difference between them for a given task - obviously some are better than others in a given set of circumstances, but it seems to me that if one team makes a "breakthrough", others aren't far behind!

So, I would keep my kernel on ext4 and use xfs for my mongodb storage (again, with the caveat about your own benchmarking, to the extent that this is possible).

To answer @NeilLunn 's point: well, yes (what I wrote is essentially an opinion), but I like to think it is a reasonably educated one! Basically, there are lies, damned lies, and statistics! And then, there are database benchmarks :-)

Anything anyone writes on this topic will contain an element of opinion - the thing which separates the wheat from the chaff is those which take information from reputable sites, and those which urge the user to benchmark for their own apps on their own machines with their own realistic data sets and usage patterns.

I believe that I have done that - I'm not going to gainsay Mongodb about whether their systems work work better with file system x, y or z, but I also know that gainsaying Linus Torvalds on which is the best file system for the kernel is also fraught with peril!

2
  • Honestly sounds more like an opinion than grounded in facts. Added the facts as links in commentary to the question asked.
    – Neil Lunn
    Commented Sep 11, 2017 at 6:00
  • I have responded to this, not entirely unfounded, point in an edit to my answer!
    – Vérace
    Commented Sep 11, 2017 at 12:48

Not the answer you're looking for? Browse other questions tagged or ask your own question.