0 votes
1 view
in AWS by (19.2k points)

I recently experienced a flood of traffic on a Facebook app I created (mostly for the sake of education, not with any intention of marketing)

Needless to say, I did not think about scalability when I created the app. I'm now in a position where my meager virtual server hosted by MediaTemple isn't cutting it at all, and it's really coming down to raw I/O of the machine. Since this project has been so educating to me so far, I figured I'd take this as an opportunity to understand the Amazon EC2 platform.

The app itself is created in PHP (using Zend Framework) with a MySQL backend. I use application caching wherever possible with Memcached. I've spent the weekend playing around with EC2, spinning up instances, installing the packages I want, and mounting an EBS volume to an instance.

But what's the next logical step that is going to yield good results for scalability? Do I fire up an AMI instance for the MySQL and one for the Apache service? Or do I just replicate the instances out as many times as I need them and then do some sort of load balancing on the front end? Ideally, I'd like to have a centralized database because I do aggregate statistics across all database rows, however, this is not a hard requirement (there are probably some application-specific solutions I could come up with to work around this)

1 Answer

0 votes
by (44.6k points)

In terms of scaling, you have a few options.

The first is to start with a single box. You can scale the single box by making it more powerful. EC2 have various sized instances. This involves a server migration on every occasion you wish an even bigger box.

Easier is to add servers. You can begin with one instance for Apache & MySQL. Then when traffic increases, create a separate instance for MySQL and point your application to this new instance. This creates a nice layer between the application and the database. 

Next, you will likely need more application power (web servers) or more database power (MySQL cluster etc.). You can have your DNS records pointing to a handful of front boxes running some load balancing software system (try Pound). These load balancing servers distribute requests to your webservers. EC2 has Elastic Load balancing which is an easy alternative to managing this yourself and is probably easier.

Something else to remember of - EC2 has no persistent storage. You have to manage persistent data yourself using the EBS.

I recommend that you simply purchase some reserved instances if you choose EC2 is the way forward. You'll save yourself about 50% over 3 years!

Finally, you'll be interested in services like Flexera which provide management services at a cost. There are other providers available.

Related questions

Welcome to Intellipaat Community. Get your technical queries answered by top developers !


Categories

...