Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

mongo db --smallfiles switch drawbacks

Tags:

mongodb

I want to use mongodb for my new project. the problem is, mongo use pre-alocate files :

Each datafile is preallocated to a particular size. (This is done to prevent file system fragmentation, among other reasons.) The first filename for a database is .0, then .1, etc. .0 will be 64MB, .1 128MB, et cetera, up to 2GB. Once the files reach 2GB in size, each successive file is also 2GB. Thus, if the last datafile present is, say, 1GB, that file might be 90% empty if it was recently created.

from here : http://www.mongodb.org/display/DOCS/Excessive+Disk+Space

And its normal to have many 2GB files with nothing in it. there is a --smallfiles switch, to limit this files to 512MB

--smallfiles => Use a smaller initial file size (16MB) and maximum size (512MB)

I want to know using smallfiles is good for production? and what's its drawbacks.

there is noprealloc switch but its not good in production. but there is no note about smallfiles.

like image 371
fzerorubigd Avatar asked Jul 23 '12 13:07

fzerorubigd


2 Answers

You would usually only use smallfiles if you are creating a whole bunch of databases, if you're only operating out of a few databases it doesn't save you enough to mess with.

We haven't seen any performance problems with it for customers that have many, many DBS (and actually benefit from small files). Their activity level is normally somewhat low compared to other installs, though. Based on what Mongo is doing, it might be slightly slower to do some operations but I don't think you'll ever notice.

like image 57
MrKurt Avatar answered Oct 19 '22 11:10

MrKurt


Additionally, if running in AWS cloud and using the m3.small instances with SSDs, you are limited to 4GB storage. Setting this option will allow you to have a small SSD-backed mongodb node. Could be sufficient for small tasks

like image 28
Cmag Avatar answered Oct 19 '22 10:10

Cmag