Sampat Singh
Sampat Singh

Reputation: 273

XFS or ext4 filesystem mongodb server on Ubuntu machine?

As XFS is the recommended by MongoDb from following link : https://docs.mongodb.com/manual/administration/production-notes/

MongoDB on Linux

Kernel and File Systems

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.

With the MMAPv1 storage engine, MongoDB preallocates its database files before using them and often creates large files. As such, you should use the XFS or EXT4 file systems. If possible, use XFS as it generally performs better with MongoDB.

And from Ubuntu link : https://askubuntu.com/questions/690360/help-me-choose-the-best-filesystem-for-my-pc

Ext4 file system is recommended for all Linux operating systems because has backwards compatibility with its predecessors, you can mount Ext2 and Ext3 as an Ext4 file system Ext4

reduces file fragmentation
employs delayed allocation which helps with flash memory life as well as fragmentation.
Good choice for SSDs and HDD

XFS

Good for a media file server because of constant throughput for large files.
Most distributions require separate /boot partition because XFS and GRUB can be unpredictable
Performance with small files is not as good.

So which one is better to use for mongodb on ubuntu 16.04 .

Upvotes: 22

Views: 14591

Answers (2)

Vaibhaw
Vaibhaw

Reputation: 646

XFS is better in general with WT, as the MongoDB production notes suggest.

I ran performance benchmarks comparing XFS with EXT4 for MongoDB on AWS EC2 to find out exactly what you were wondering about. Here are my results. The observation was that XFS is useful when your machine has multiple cores and fast disk that XFS can utilize. On low to mid end systems the filesystem did not make a difference.

Upvotes: 23

PhoneixS
PhoneixS

Reputation: 11026

As you have said in your question, you should use XFS for MongoDB but for the general system is better ext4, so what I recommend is to have two partitions (or better two disks) one with ext4 for the system and general use, and one with XFS for MongoDB and storage of big files.

Upvotes: 1

Related Questions