MongoDB storage size before/after dump

18 views
Skip to first unread message

Chris W

unread,
Aug 27, 2015, 11:51:28 AM8/27/15
to mongodb-dev

I have a question regarding MongoDB's collection size. I did a small stress test in which my MongoDB server was constantly inserting, deleting and updating data for about 48 hours. The documents were only of small size, simply a numerical value and a timestamp as well as an ID.


Now, after those 48 hours, the collection used for inserting, deleting and updating data was 98.000 Bytes and the preallocated storage size was 696.320 Bytes. It has become that much higher than the actual collection size because of one input spike during an insertion phase. Due to following deletions of objects the actual collection size decreased again, the preallocated storage size didn't (AFAIK a common database management problem, since it's the same with e.g. MySQL).


After the stress test was completed I created a dump of my MongoDB database and dropped the database completely, so I could import the dump afterwards again and see how the stats would look then. And as I suspected, the collection size was still the same (98.000 Bytes) but the preallocated storage size went down to 40.960 Bytes (from 696.320 Bytes before).

Since we want to try out MongoDB for an application that produces hundreds of MB of data and therefore I/O traffic every day, we need to keep the database and its occupied space to a minimum. And preferably without having to create a dump, drop the whole database and import the dump again every now and then.


Now my question is: is there a way to call the MongoDB garbage collector functionally from code? The software behind it is a Java software and my idea was to call the garbage collector after a certain amount of time/operations or after the preallocated storage size has reached a certain threshold. Or maybe there's an ever better (more elegant) way to minimize the occupied space?


Any help would be appreciated and I'll try to provide any further information if needed. Thanks in advance.

Asya Kamsky

unread,
Aug 30, 2015, 4:36:26 AM8/30/15
to mongo...@googlegroups.com
Hi Chris,

This question is more appropriate to the MongoDB-user Google group - this group is for developers *of* MongoDB. 

Be sure to mention versions and all other relevant details when you repost this there. 

Asya

--
You received this message because you are subscribed to the Google Groups "mongodb-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mongodb-dev...@googlegroups.com.
To post to this group, send email to mongo...@googlegroups.com.
Visit this group at http://groups.google.com/group/mongodb-dev.
For more options, visit https://groups.google.com/d/optout.

Chris W

unread,
Sep 3, 2015, 3:35:35 AM9/3/15
to mongodb-dev
Thanks for the hint. I wasn't sure if developers were meant as "of" MongoDB or "with" MongoDB, so I posted it in both groups. Thanks for clearing that up, Asya.
I got a (hopefully) solution from one member of the users-group.
To unsubscribe from this group and stop receiving emails from it, send an email to mongodb-dev+unsubscribe@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages