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.
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.
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.
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/220.127.116.11/magento-18.104.22.168.tar.gz tar -zxf magento-22.214.171.124.tar.gz mv magento /var/www/ #get Magento Sample Data wget http://www.magentocommerce.com/downloads/assets/126.96.36.199/magento-sample-data-188.8.131.52.tar.gz tar -zxf magento-sample-data-184.108.40.206.tar.gz mv magento-sample-data-220.127.116.11/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-18.104.22.168/magento_sample_data_for_22.214.171.124.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
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://126.96.36.199/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://188.8.131.52/magento. Now let’s run some tests – you’ll need a google sitemap if you’re following along at home.
So, how do the servers perform? Let’s see.
Starting with tiny
512MB RAM server – let’s see what it’s capable of.
|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.
|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!
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:
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.