image/svg+xml Openclipart 2007-11-20T10:29:44 Some shapes from photos. http://openclipart.org/detail/8766/tree-silhouettes-by-chrisdesign-8766 Chrisdesign clip art clipart image media nature png public domain shape silhouette svg tree

zzolo

Moving to Mecury

21 Apr 2010

I have always dreamed of going into space. I often ask people if they would go out into space if given the chance; I think it gives a small bit of insight into someone’s personality. I doubt I will be able to make it into space in my lifetime, though I think it’ll be close. But, if I can’t go, this site can still move to Mercury.

Pretty cheesy intro, I know. What this actually means is that I just moved this site from being hosted at DreamHost to Amazon Cloud AWS with Chapter Three’s Pantheon Mercury. The main reason to do this was performance, but I will discuss the pros and cons of this switch below.

Performance

I have done some very basic benchmarking with AB (Apache Benchmarking). By no means is this a rigorous test, but it does add some insight into the performance increase. I ran ab from a third-party server that had more consistent bandwidth and each test is for the homepage; I am running a small (default) instance. A very rough way to read all this is to say I get 50x the performance with Mercury.

Test and MetricDreamHostMercuryIncrease
ab -n 100 -c 10
  _Failed requests_290~2,900%
  _Requests per second_0.9819.812,021%
  _Time per request_1024.6ms50.490ms2,029%
ab -n 1000 -c 10
  _Failed requests_3210~32,100%
  _Requests per second_0.8741.094,723%
  _Time per request_1150.489ms24.335ms4,728%
ab -n 1000 -c 50
  _Failed requests_70~700%
  _Requests per second_44.86112.15250%
  _Time per request_22.292ms8.916ms250%
Average
  _Failed requests_1190~11,900%
  _Requests per second_15.5757.68370%
  _Time per request_732.46ms21.91ms3,343%
Increase average5,204%

What is Mercury?

Mercury is a set of server configurations, most commonly in the form of an AMI, that creates a web host for a Drupal site that focuses on performance and uses other technologies such as Pressflow, Varnish, and Apache Solr.

In a more basic sense, if you wanted to set up a server to host a Drupal site and you wanted to get the most performance out of it (as if someone didn’t want to); Mercury does all the initial configurations for you.

Why Mercury?

Well, obviously the performance is a big deal. But in reality, this blog doesn’t see that much traffic, so there are other reasons as well. Overall, its the combination of AWS and Mercury.

I wanted control, but I am lazy. I now have complete control over the server that my site lives on, for better or for worse. This is a big change form DreamHost as I was just a small user on a big server there. The control and flexibility is great. But I also don’t want to spend a lot of time doing systems administration for my blog, hence why I had chosen DreamHost in the first place. But Mercury provides a great middle ground: it supports the cloud infrastructure giving me the flexibility of my own server, but it does all the hard parts of configuring the server to host a Drupal website.

Why DreamHost?

I still like DreamHost. I think they are a good company and offer some of the best services for their price range. I have heard a lot of different opinions about DreamHost but I still stand by them.

For your 5 USD a month you get a fancy interface with lots of goodies and lots of features, and practically unlimited space and transfer rates (though it doesn’t work out to be as good as it sounds). They also give you lots of control over your account considering that it is shared hosting.

Making the Switch

Overall, this was really easy. As this was my first use of AWS, most of my time was just figuring out the basics of the cloud. Here are the rough steps to migrating a site (see this documentation).

  1. Backup your site and database.
  2. Create AWS account.
  3. Make Key Pair.
  4. Create an instance with the Mercury AMI.
  5. Log into the instance and read the included /root/README.txt file. For those new to AWS, you have to use your key pair file to ssh in, for instance: ssh -i /path/to/local/pem/file [email protected]
  6. The default site is found at /var/www/, I would suggest copying this somewhere just in case.
  7. Create a root password for MySQL. Set up a new database and put in your database dump.
  8. Copy your files, modules, and themes over the existing site.
  9. Update settings.php.
  10. Run Druapl update: drush updb
  11. This should do it. Use your public DNS for your instance to view the site.
  12. Set up an Elastic IP (a.k.a. dedicated IP) and update DNS and other things as needed.

Final Thought

Overall, Mercury is awesome and really takes out a huge amount of work in setting up an environment for Drupal with some great services that focuses on performance and I can really tell the difference in making the switch.

Do note, I have switched from an environment where I don’t have to worry about much, to having to know about it all. Don’t try to switch to AWS and Mercury unless you know how to set up a web server from scratch; Pantheon may do a lot of the heavy lifting, but there is no GUI for it. If you are not that technical, go with hosting that takes care of these things. If you have the knowledge and the resources, definitely use Mercury to get the most performance out of Drupal.