MongoDB Fail – databases reserve disk space

I made a stupid error recently, so I thought I’d document it in case anyone else was planning on going the same way.

Parts of Loco are backed with MySQL, but it uses MongoDB to store isolated ‘project’ data. Loco projects are per ‘account’ and the data is totally fenced off from other projects, so I thought it was neat to use a separate database for each account and namespace a bunch of collections for each project. I was fairly pleased with myself and off I went.


I hadn’t done my research. MongoDB reserves rather a lot of disk space when you create a database. Even if your collections are empty. With my particular setup I was looking at over 200MB per account. Do the math[s] – My 16GB Linode was only going to fit about 80 customers even if they don’t do anything. It got full. I stayed up late.

Read about Datafile Preallocation.