MongoDB on ext4

I"m new to MongoDB and deploying an application on a Linode server running Ubuntu 20.04. By default, Linode’s distros are created using ext4. I noticed the mongod service issued a warning indicating that XFS is strongly recommended for the wiredtiger storage engine.

Will running this on ext4 cause problems for us? Can someone shed a bit more light on the possible pitfalls of running things in this environment?

Also, I’m a bit unsure about where the filesystem is coming into play. Is this only affected where the database is stored? If spin up a block storage device formatted with XFS, mount it as an external disk and point my Mongo config there, will that be adequate?

I guess I’m basically wondering how significant of a performance hit we will be taking running this on ext4 and if it’s worth the trouble the try and reconfigure the server for this one application.

Hi @billy_noah welcome to the community!

When MongoDB first uses WiredTiger as its storage engine, Ext4 was observed as having a specific behaviour that in pathological cases, resulted in multiple stalls (see SERVER-18314). I believe this issue is still present in one way or another with Ext4.

Specifically, the production notes mentions:

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, using XFS is strongly recommended for data bearing nodes to avoid performance issues that may occur when using EXT4 with WiredTiger.

Since WiredTiger is the only storage engine shipped with MongoDB presently, XFS remains the recommended filesystem for WiredTiger until today.

Since the recommended setup is to have a node wholly dedicated to MongoDB for performance reasons, it’s probably easier maintenance-wise to just use XFS exclusively for the node hosting MongoDB so you don’t have to deal with multiple disks and different filesystems within a node (my opinion).

It is not recommended to run MongoDB together with other servers within the same node (e.g. app servers, web servers, another mongod processes, etc.) since the mongod process was designed to utilize all the node’s resources so that it can maximize the throughput of the hardware you have. Having another resource-intensive process running on the node may interfere with mongod’s need for resources and may result in suboptimal performance. Having said that, not all application need the utmost performance, so depending on your use case, some compromise may be acceptable.

I would encourage you to read through the production notes in detail and follow all the recommended settings there. Additionally, please read through the security checklist as well to ensure your environment is secure.

Best regards
Kevin

2 Likes

Thanks for your response. I’m a bit unclear about what you mean when you use the term “node”. Are you referring to the entire server? Since I’m running a Debian based distro and don’t realistically have the option of deploying an XFS based OS, I went ahead and added an external block storage device formatted with XFS and moved our data there. It seems reasonably fast and I"m hopeful this will work for what we need it to do. This instance will have to live alongside Node.js and Apache since those are the other components of the application we’re runnign (Rocketchat). I think given the size of our team this will work fine.

Thanks also for suggesting the security checklist!

2 Likes

Yes sorry. When I say “node” I meant the hardware/VM running the mongod process.

Glad you sort this out! Best of luck with your deployment.

Best regards
Kevin

2 Likes

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.