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

1

6

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.

Pyrrhonism answered 5/1, 2012 at 12:7 Comment(0)
Y
9

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.

Ylla answered 5/1, 2012 at 12:23 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.