MongoDB temporary video storage and repair database

285 views Asked by At

We are using MongoDB as an intermediate storage for an application that allows the user uploading downloading video files. We are using GridFS API from a Java applications , as is very convenient for the case (We found it more appropriate, faster and reliable than storing the files in a table in a relation database).

Once the videos have been processed from the DB (and stored into physical files) we can remove them, but we have the problem that the new space is not just reallocated and is instead "used" without any util data. We have tried to repair the database, as suggested in posts like Auto compact the deleted space in mongodb? but this had the database down for few days! , which is not ideal as it needs to be running 24/7. (We have come accoss this recently when the DB was without free space).

I am not very knowledgeable in this topic and so would like to get opinions for a solution you know/use that would be efficient: Allow the storage in blocks and be easy to reallocate memory once the blocks/chunks are not needed. Some options are:

1) Have two Mongo DB: from time to time export and import data(all except the tables used by GridFS that contain the videos) from one db to the other. First db can be dropped and space defragmented again. This seems a bit complex and not good if it needs to be done frequently as we don't have much total space for the DB.

2) Store them in a relational database (for a table without relation and these special characteristics does not seem ideal but works if other solutions don't)

3) ...

If it serves, the application is deployed in a J2EE infrastructure.

Thanks.

0

There are 0 answers