- Don't turn off MongoDB journaling unless you really 100% sure -- the degree of comfort it provides you after your server restarts non-gracefully, is enough to warrant it's usage even within a replica set.
Use ext4 file system, mounted with "noatime,data=writeback,nobarrier" (nobarrier didn't give measurable differences on our workload, but others say it's still a good thing). ext4 is fast when allocating files (see 3. below), along with allowing you to delay file metadata updates (reliability is already covered by MongoDB journals).
Correction from the year 2019: just use XFS.
- Enable MongoDB options smallfiles and noprealloc (unless you're writing an application that is very heavy on inserts that is going to push the SSD to it's limits). SSDs still cost a lot of money and if you're installing 120GB or 160GB ones as we do, you don't want five empty databases occupy a gigabyte of that precious space (we run with directoryperdb=true also, it's handy for management). With smallfiles=true, noprealloc=true works just fine -- 512MiB files that get created by MongoDB are allocated in abour 300-600ms even under load, thus saving you even more space.
Personal technical blog of Aristarkh Zagorodnikov. Topics covered include (or at least plan to include) C++, C#, MongoDB, NGINX and other development technologies.
Basic SSD tuning for MongoDB
We explored several options when using MongoDB on an SSD and came to following conclusions:
Subscribe to: Post Comments (Atom)
Just curious ... So you used SSD as the storage of mongoDB?ReplyDelete
We run it on SSD right now and it works perfectly.Delete
This comment has been removed by a blog administrator.ReplyDelete