Posted on

Running Magento on Digital Ocean – A Review and Benchmarks

I’d recently seen a few people mention Digital Ocean, and their $5/month SSD-based VPS offering. I read about it, and was interested to know if Magento would run on their plans, and how well. But at the time I couldn’t be bothered actually doing any testing.

However, thanks to the wonders of Google’s re-marketing every site I visited on the internet for the next couple of weeks reminded me about them and so I finally decided to throw up a quick test site and run some benchmarks.

In this post I’ll run through a quick setup guide using Digital Ocean to run Magento, and then the results of a few simple benchmark tests using my Magento Speed Test service.

Digital Ocean

Objectives

I’ll preface this whole article by saying I’m not going to be trying to do any tuning, it’s a totally vanilla setup all the way through.

My goal here is not to try and get Magento running really fast or in really low memory environments, it’s to see if it can run OK and what basic performance profile it has on the Digital Ocean plans. I’m 100% sure that with some tweaking it could be optimized to run in the limited memory servers better, and to be much faster on the larger servers.

If you were planning to run production servers on Digital Ocean, you’d need to put in a lot of work tuning and tweaking to get that optimum level of performance, that’s why I normally suggest you get better value from a specialist Magento host, they’ve already put in the hard yards doing the tuning for you.

Interestingly, Digital Ocean can also be used as a Vagrant provider, which means they may be an excellent low cost service for development environments.

With that in mind, let’s get started.

Setup and Getting Started

First, we’ll sign up, and setup a basic Magento server on Digital Ocean.

Signing Up
This is made super easy, just an email, password and credit card/paypal deposit to begin. You’ll be up and running in a couple of minutes.

LAMP setup
Thankfully the folks at Digital Ocean provide a few pre-configured images, one is an ubuntu 12.04 LAMP stack, which is pretty much ready to use except for a few tweaks below.

First, do as they suggest and change the mysql password.

mysqladmin -u root -p'password' password newpassword

Then following along fairly closely with the Magento SSH install instructions.

#get Magento
wget http://www.magentocommerce.com/downloads/assets/1.7.0.2/magento-1.7.0.2.tar.gz
tar -zxf magento-1.7.0.2.tar.gz
mv magento /var/www/
 
#get Magento Sample Data
wget http://www.magentocommerce.com/downloads/assets/1.6.1.0/magento-sample-data-1.6.1.0.tar.gz
tar -zxf magento-sample-data-1.6.1.0.tar.gz
mv magento-sample-data-1.6.1.0/media/* /var/www/magento/media/

Now create the database and import the sample data:

mysql -u root -p
mysql> create database magentotest;
mysql> grant all on magentotest.* to 'magentotest'@'localhost' identified by 'magentotest';
mysql> quit
 
mysql -u magentotest -pmagentotest magentotest < magento-sample-data-1.6.1.0/magento_sample_data_for_1.6.1.0.sql

And then fix up the permissions:

cd /var/www/magento/
chmod -R o+w media var
chmod o+w app/etc

Before you actually install Magento, the LAMP stack needs a couple of tweaks gd, curl and mod_rewrite:

apt-get update
apt-get install curl libcurl3 libcurl3-dev php5-curl
apt-get install php5-gd
 
a2enmod rewrite
#edit the config to allow Magento rewrites
vi /etc/apache2/sites-enabled/000-default
# edit the line AllowOverride None in the <Directory /var/www/> to say AllowOverride All
 
# and bounce Apache
/etc/init.d/apache2 restart

Now you can run the Magento install from your server such as http://192.20.200.10/magento. You’ll use the database name, user and password you created earlier.

If it all worked you should get a Magento store running with mod_rewrite at http://192.20.200.10/magento. Now let’s run some tests – you’ll need a google sitemap if you’re following along at home.

Benchmarks

So, how do the servers perform? Let’s see.

Starting with tiny 512MB RAM server – let’s see what it’s capable of.

Test Parameters Results
3 users for 15 seconds 1.11 trans/sec @ 1.90 secs each
10 users for 15 seconds 0.67 trans/sec @ 11.48 secs each
20 users for 15 seconds Test Failed
30 users for 30 seconds Test Failed

So you can see the smallest server can only really handle a few concurrent users before it crashes, in this case MySQL was the first to die, there simply isn’t enough memory. It could certainly be tuned to work in these environments, but you will never get very good performance. That said, when it costs hundreds of dollars to upgrade your MacBook HDD and RAM, this looks like a pretty good option for Magento development at only a few cents a day. Plus you can turn it off when not in use.

One of the good things about Digital Ocean is it’s very easy to resize your droplets – so now let’s see how it performs with a bit more memory and CPU power.

Now using the bigger 16GB RAM droplet. Again its un-tuned – this sort of hardware could normally support a number of optimizations and you could eek a lot more performance out of this, think of this as a base line – but it’s not taking full advantage of the underlying computing power.

Test Parameters Results
3 users for 15 seconds 2.72 trans/sec @ 0.59 secs each
10 users for 15 seconds 7.92 trans/sec @ 0.74 secs each
30 users for 15 seconds 10.28 trans/sec @ 2.13 secs each
50 users for 15 seconds 10.89 trans/sec @ 3.54 secs each
100 users for 60 seconds 9.80 trans/sec @ 8.70 secs each

You can see the server is much faster when responding to 10 or less concurrent users, beyond 10 users you start to notice response time failing away. This is encouraging for a system that’s completely untuned, using more of the memory and software improvements to caching could make a big difference.

Out of curiosity I also tried a simple DB + single web node cluster on Digital Ocean, but in vanilla configurations like this there’s simply no improvements until you start tuning the Apache and MySQL parameters to use more of the CPU and memory available, so thorough benchmarking on that will have to wait for another day!

Conclusions

On the Digital Ocean service in general, I’m impressed, the UI and sign up flow is very slick, they have created a backend interface that’s clean and simple to use, blending some great ‘cloud’ features into a more traditional VPS service.

I think what they’ve done with hosting, could be applied to a lot of industries, basically re-package up a product or service with a slick interface, user friendly approach to pricing and service delivery. Imagine if it was this easy to rent cars or bikes, for example?

They also have an API that’s super easy to use, for example:

https://api.digitalocean.com/droplets/[droplet_id]/power_off/?client_id=[your_client_id]&api_key=[your_api_key]

After my initial testing I think there’s two valid use-cases for Digital Ocean for Magento developers and merchants. The first is as a quick, easy to use development server host – the on-demand, by the hour nature of the servers makes them perfect to use for testing and development, while not super powerful, a single developer could comfortably test new features using these servers. The fact you can use the service with Vagrant already is a great head start for this use-case.

Secondly, I also think that Digital Ocean could host a performant Magento store if tuned specifically for the size plan you are using. The problem is that having to custom tune a server puts you in the AWS territory, as opposed to the off-the-shelf or managed hosting – although they’re much cheaper than AWS, they lack some of the really slick features that make AWS worth the time and effort in setting it up (ELB, autoscaling etc).

If someone made a pre-configured, tuned Magento image for specific sizes of Digital Ocean server – that’d be awesome. Until then though, I’d probably spend a bit extra each month to have my store hosted on a professional Magento host and save the server admin burden.

3 thoughts on “Running Magento on Digital Ocean – A Review and Benchmarks

  1. I want to try Nginx with Magento on DigitalOcean. Will post some updates soon.

  2. Interesting read I’m just trying the same thing here and trying to create a optimised cloud infra on top of opendigital cloud with Magento in mind

  3. Very interesting post. What hosting company do you recommend for Magento?

Comments are closed.