Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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 .

like image 779
Sampat Singh Avatar asked Feb 24 '17 06:02

Sampat Singh


People also ask

Should I use XFS or Ext4?

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.

Can Ubuntu read XFS?

XFS was created at Silicon Graphics, Inc and currently supported by Red Hat. However, XFS is not the default file system for Debian or Ubuntu Linux based system.

Is Ext4 same as XFS?

In terms of XFS vs Ext4, XFS is superior to Ext4 in the following aspects: Larger Partition Size and File Size: Ext4 supports partition size up to 1 EiB and file size up to 16 TiB, while XFS supports partition size and file size up to 8 EiB. Please note that XFS is a 64-bit file system.

What is XFS file system used for?

XFS is supported by most Linux distributions, and is even used as the default filesystem for some Linux distributions. XFS supports large files and large file systems. Therefore it can be used as Linux filesystem solution to store file contents for a FileNet® repository (File Storage Area).


2 Answers

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.

like image 108
Vaibhaw Avatar answered Oct 20 '22 17:10

Vaibhaw


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.

like image 1
PhoneixS Avatar answered Oct 20 '22 17:10

PhoneixS