Load Testing Drupal in the Cloud

In this article we will talk through setting up a simple load testing scenario for Drupal applications using Amazon’s Elastic Cloud computing. Amazon EC2 will enable you to easily set up testing scenarios for a relatively low cost, e.g. you can find out what the effect of adding an additional database server will make without actually buying one! JMeter will allow us to create complex test plans to measure the effect of our optimisations, we’ll set up a remote JMeter load generator on EC2 that we’ll control from our desktop.

Improving Drupal’s performance is beyond the scope of this article, but we’ll talk more about that in future. If you need some suggestions now then check out the resources section for links to good Drupal optimisation articles.

Setting up your test site on EC2

If you don’t already have an account then you’ll need to sign up for Amazon Web Services. It’s all rather space-age and if you haven’t been through the process before then it can be a bit confusing. We want to set up a working copy of our site to test on EC2, so once you have your AWS account, the process goes something like this:

ssh -i /path/to/your/private/key.pem user@el.as.tic.ip

apt-get install apache2 php5 php5-mysql php5-gd mysql-server php5-curl

http://foo-control.bar.com -> /mnt/sites/foo/control/ -> DB = foo_control http://foo-optimised.bar.com -> /mnt/sites/foo/optimised/ -> DB = foo_optimised

Setting up JMeter to generate load

We don’t want fluctuating network bandwidth to affect our results, so it’s best to run a JMeterEngine on a separate EC2 instance and control that from JMeter running on our local machine. First we’ll get JMeter generating load from our local machine, then we’ll set up a remote JMeterEngine on EC2.