VineetChirania
VineetChirania

Reputation: 871

Should I use different databases or different collections in same database in mongodb?

I have 2 collections in mongodb - one involves only read operations while the other involves both read and write operations. The read operations are more than write (read: 20 per minute, write: 10 per minute)

I have heard that mongodb puts a lock on the whole db and not only collection during a write operation. So is it wiser to put both these collections into separate databases?

mongodb - 2.6

OS - ubuntu 12.04 LTS

Upvotes: 1

Views: 94

Answers (1)

John Petrone
John Petrone

Reputation: 27487

I'd put both collections in a single database. You have what would be considered very light read and write volume. While it all depends on the hardware you use, you schema, types of indexes, etc you are a long way away from having to worry about database locks. I have several production databases that run at 1000X that volume with no issues with database locks. As you scale up you can also shard your larger high volume collections to spread the load out across more servers.

http://docs.mongodb.org/manual/sharding/

Upvotes: 2

Related Questions