Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Should I be running MongoDB on it's own EC2 instance?

I'm just getting started with Amazon EC2 and trying to get my head round how the databases should work. If I have a high traffic site and want to load balance traffic over multiple instances I'm guessing these instances will have to be retrieving and saving data to a single separate instance to avoid data being fragmented across multiple machines.

Should I in that case install and run mongoDB on its own instance and have all other instances connect to this single data store? Or should I just run mongo and my http server on the same instance?

Would love to hear some of your best practices.

like image 826
wilsonpage Avatar asked Jan 05 '12 12:01

wilsonpage


Video Answer


1 Answers

Maybe it's not necessary while you're developing, but you should do it once you go to production.

Even more, if you are running production data, probably you want to run a replica set to have a backup in case something fails, to not lose your data and not interrupt your service.

DBs are hungry for memory, so having to share it with other processes it's a bad idea. On an application server you probably need more CPU than memory, so you can use High-CPU instance types (c.medium, c1.xlarge) and use High-Memory types for your DB (m2.large, etc) (High-CPU instances are cheaper)

Also, from architectural point of view, it's better to be able to scale the number of app servers independently from the DB. If you put the app servers and the DB on the same machine, that could lead to problems if you have to migrate to a different one later.

like image 87
Khelben Avatar answered Sep 16 '22 21:09

Khelben