Tell me more ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

My company has one EC2 server running on AWS with a MYSQL-DB and Apache on the same instance. This one instance hosts a website built on PHP Zend Framework.

The site runs like crap when it starts to get busy with a lot of traffic so I'm looking for some advice on how to set up something that can handle the load better.

My first question is should I move the mysql DB on to a separate EC2 instance or perhaps use AWS's RDS service which looks like a nice option.

I'm sort of new to some of this but I'm guessing I'll need at least two EC2 instances for serving the website from and some sort of load balancing mechanism to distribute traffic. But maybe not, I'm not sure.

Also what are some best practices for how to replicate the data so that they stay in sync on both instances?

Okay I know these are a lot of questions. But I don't know where to start so any advice will help.

share|improve this question
2  
Start by reading some of the previously posted questions and answers, such as this one. – Michael Hampton Oct 26 '12 at 23:48
In addition to what @MichaelHampton suggests, some logging or performance metrics seem like a good idea... how else do you expect to figure out what's limiting performance and correct it? – HopelessN00b Oct 27 '12 at 0:20
He guys. This is makes sense. I'm sort of new to metrics, so is there someplace you can point me to as to get started? Again, I feel like I'm sort of a little out of my depth here. – Philip Isaacs Oct 27 '12 at 2:19

closed as not constructive by EEAA, HopelessN00b, rnxrx, Ward, SvW Oct 28 '12 at 0:33

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or specific expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, see the FAQ for guidance.

2 Answers

Instead of taking a look at performance metrics, it's easier in this case to try out with a bigger machine. Ideally, you would separate the DB from the rest, either by running MySQL on EC2, or with Amazon RDS (managed MySQL). If you still want to optimize, take a look at Amazon CloudWatch metrics (or add custom metrics for the Memory use, see http://aws.typepad.com/aws/2011/05/amazon-cloudwatch-user-defined-metrics.html ) and get a sense if it's the CPU or memory that are slowing you down. You can pick High-CPU instances, or High-Mem instances, to optimize for the bottleneck that you're currently experiencing.

You can also try out phpcloud.com, where you can deploy the Zend Application Fabric on Amazon Web Services using Cloud Formation: http://www.phpcloud.com/deploy/amazon

Best,

Simone

share|improve this answer

From my years of experience running web-based applications within AWS I would suggest following Simone's advice to move your MySQL off of the EC2 instance and use RDS. I do this myself using a multi-AZ RDS instance and have had great results.

As for the instances, I go against Simone's suggestion of moving to a larger EC2 instance unless there is obvious need for more RAM and more CPU cores. I find in most cases upgrading the instance size either wastes processor power or memory and the cost is better spent on multiple smaller instances running behind an ELB. If your application is properly designed to be ran on multiple servers than this topology works great and as you notice your instances are getting close to being overloaded can simply bring another instance online and add it to the ELB.

In most cases I find the I/O performance is different with MySQL and the application running on Apache. By utilizing the clouds ability to easily separate you can optimize and gain the best results. As well if you bring up the additional EC2 instances to add to the ELB in different availability zones you get the added advantage of optimizing the high-availability of your application as well.

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.