How many AMAZON EC2s should I start with for a Facebook Application?

7 points by badmash69 ↗ HN
So I am in the midst of doing a very private MVP type of roll-out of an application: I need to run Apache + Glassfish + PostGre + MongoDB + Memcache + ActiveMQ ( a java messaging server). I fully realize that I might have gone overboard: I started with Memcache + PostGres and then I started dabbling with MongoDB and liked what it did especially for social graph data. Should I put it all in one big EC2 or should I split it among multiple EC2. MongoDB pretty much mandates at least 2 EC2 instances ( for replication). Any suggestions ?

10 comments

[ 4.2 ms ] story [ 38.5 ms ] thread
It depends. For a new application, you have no estimates about the number of users, number of pageview, response times and so on.

I would start with one instance. When the load gets high you can switch to a larger model. When you have collected some performance data, you can better decide how to scale.

To give you some idea. I have a fb app running on my platform, that got 82000 visits last month. The avg response time is under 500ms. The instance runs on 2 cores.

whats about things like firewall etc. ?
you can use a standard rule set: http 80, 443 + ssh 22 for administration
(comment deleted)
From what I can tell EC2 instances are pretty under powered for the price. There are a lot of good things about EC2, but the small instances are not that great. The good thing is you can start small and quickly grow. You are right about needed 2 instances for Mongo. Design it so that you can turn on new front end instances to handle the load as needed. This way you can start as cheap as possible and add servers (and cost) as you grow.
Start small with two maybe three micro instances. Try to scale out rather than up. When the time comes you can step up to the larger instances. You might want to separate some of your services into clusters and run them from a couple sets of instances. A couple of micros for the front end and a couple for the back end. You will probably save a few $$$ and have more control of your growth.
For your Mongo db, you could start with MongoHQ - the first 16MB are free. They are hosted on EC2, so bandwidth should not be a problem.

https://mongohq.com

The curiosity is killing me. And besides this might help better answer your questions.

So a few questions: 1) Can you vaguely tell us the nature of the app you are building? 2) Is it transaction heavy? How much data do you expect? 3) How many users are we talking about?

EDIT: Curiosity is due to the software stack being used.

Start with 1, backup to S3 or EBS. Figure out how to overload that server. Once you have over 10,000 users start worrying about backups etc. If you server dies and nukes all their data just start over no one will even notice. (Yes, your users may but if you have 10,000 users, its 10,000 out of 300 million accounts, just get new users)