MongoDB SERVER-24384 bit me.
RSpec tests in Mongoid/MongoDB projects would take forever to run, spending multiple seconds creating collections or indexes. Typically, projects using MongoDB (I have a list of at least two dozen here) use database_cleaner to drop the entire database before each test and re-create all indexes to mimic a clean production-like environment. This would now take 5-10 seconds per test.
I opened SERVER-24384, which was closed as a duplicate of SERVER-17675. Turns out, WiredTiger uses one file per collection and one file per index, so in this workload the system is very busy creating and removing files, which explains why it’s so slow.
The workaround is to use the
mmapv1 storage engine in development. Here’s my
You’ll have to stop MongoDB, then clear all your data in
/usr/local/var/mongodb/ before restarting it.