Advice on using GridFS: one vs multiple collections

171 views
Skip to first unread message

Octavian Covalschi

unread,
Nov 2, 2011, 5:47:46 PM11/2/11
to mongod...@googlegroups.com
Hi there,

I'm looking into creating an app that would store files in Mongodb (through GridFS). Files can have different sizes, 1MB - 1000MB or even more, I don't want to put any restrictions, but I'm worried that if majority of files would have of few hundred of megs or few gigs, it will impact overall performance and/or scalability... 

Should I be worried and split those into multiple collections or store everything in one?

Thank you in advance.

Bernie Hackett

unread,
Nov 2, 2011, 6:20:43 PM11/2/11
to mongodb-user
There is no performance reason to store different size files in
different collections. The files are chunked the same way no matter
the size of the file.

On Nov 2, 2:47 pm, Octavian Covalschi <octavian.covals...@gmail.com>
wrote:

Noah McIlraith

unread,
Nov 2, 2011, 7:42:25 PM11/2/11
to mongod...@googlegroups.com
You'll likely see marginally better performance by keeping all the chunks in the same collection.

Octavian Covalschi

unread,
Nov 3, 2011, 9:55:17 AM11/3/11
to mongod...@googlegroups.com
Thanks guys! This means less headache... 

On Wed, Nov 2, 2011 at 6:42 PM, Noah McIlraith <noah.mc...@gmail.com> wrote:
You'll likely see marginally better performance by keeping all the chunks in the same collection.

--
You received this message because you are subscribed to the Google Groups "mongodb-user" group.
To view this discussion on the web visit https://groups.google.com/d/msg/mongodb-user/-/MnHmzFf2oF0J.

To post to this group, send email to mongod...@googlegroups.com.
To unsubscribe from this group, send email to mongodb-user...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/mongodb-user?hl=en.

WEN Jinchao

unread,
Nov 3, 2011, 11:30:33 AM11/3/11
to mongodb-user
I do not think it's a good idea t store big file into gridfs.
Just think about read the a file from lots of different BSONs,
performance issues must be there.


On Nov 3, 9:55 pm, Octavian Covalschi <octavian.covals...@gmail.com>
wrote:
> Thanks guys! This means less headache...
>

Octavian Covalschi

unread,
Nov 3, 2011, 11:47:18 AM11/3/11
to mongod...@googlegroups.com
I agree with you, speed is not as fast as it would be consumed directly from file system(even through http), however it all depends on the way these files will be used. An easy fix for consuming performance would be to implement some kind of local cache... I see GridFS as a safe, permanent and flexible storage.. that will allow to make backups/snapshots... 

I was more concerned about having 1 huge collection... though after thinking a bit more on this It looks like that in order to store 1TB file we need about 4mil of records (4194304) in fs.chunks collection... that shouldn't be too bad, since Mongo is designed to work with much more.. 
Reply all
Reply to author
Forward
0 new messages