Monday, September 12, 2011

Magento on Rackspace Cloud - Update

At the beginning of the year, I posted about my experience running Magento on the Rackspace cloud infrastructure.  The gist of that post was that Magento does in fact run quite well, as long as you use a minimum of the 2GB instance provided by Rackspace.  (Original Article Here)

Since then, I have been migrating several sites to this infrastructure.  Initially, I figured it would be easy to put 5 or even 10 sites on one instance, and scale it up to 8GB or 16GB or whatever was needed.  Vertical scale with a single cloud server appeared to be a quick and simple deployment plan.  Unfortunately, this all came crashing down on me when I went to add the sixth site.

Rackspace kindly informed me that they could only assign a total of 5 IP addresses to a single CloudServer instance.  This really makes no sense to me, since I can get 5 more just by adding another server, but that's their policy anyway.

In case you didn't know, every site that has its own SSL certificate requires its own dedicated IP address.  This includes all of the Magento sites that we currently manage at 4word systems.

Forced to deal with the reality of spinning up several 2GB+ instances to support a larger number of sites, I got to thinking about my original strategy.  After all, to keep on the planned path would turn out to be expensive as hell.

What if I offloaded the database activity to a separate server?  How might that impact the performance / hardware requirements for the web server?  How big would the DB server need to be?

Through a good amount of trial-and-error I have discovered the following (so far).

1:  The database server can be surprisingly small if properly tuned.  MySQL database tuning and maintenance can be a tricky thing, but currently I am supporting around 10 Magento databases on a 1GB CloudServer instance with no performance problems whatsoever.  I will again mention that this absolutely requires a well-tuned MySQL installation.

2:  The web server size requirement also drops considerably.  Previously, I had a single Magento site that was so busy most of the time, I needed to upgrade from 2GB to 4GB to prevent heavy swapping to disk.  After offloading the database to the new 1GB instance, I was able to reduce the web instance from 4GB to 1GB.  This is a remarkable improvement.  2 servers at 1GB is half the cost of a single 4GB instance, and the 1GB database server is able to service at least 9 more websites.

The long and short of it is this:  If you plan to host Magento on CloudServers, do yourself (and your budget) a favour.  Split the database on to a different server.  Even if you are only managing a single site, you will get more performance for less money any way you cut it.

5 comments:

  1. Would you be able to share your my.ini and apache2.conf for 1GB instances? Has your perspective changed since this post or are things still running smoothly?

    Either way thanks for the post.

    ReplyDelete
    Replies
    1. Things are definitely still running well, though I have scaled up to bigger instances. Send me an email and I'll shoot you some config guidelines. Also, check out these 2 posts I recently published about tuning Apache / PHP and MySQL.

      http://www.4wordsystems.com/techtalk/web-hosting-infrastructure-part-2/
      http://www.4wordsystems.com/techtalk/web-hosting-infrastructure-part-3/
      And for a little bit of a background / intro:
      http://www.4wordsystems.com/techtalk/web-hosting-part-1/

      Delete
  2. Hi Steve. I too have a Magento store running on a Rackspace Cloud Server. It took a few days in the beginning to get everything working under the Load Balancer, but for the past month, everything has worked well. We have a single Database instance and 4-6 web instances running all the time. We have spun up as high as 22 web instances. Unfortunately, the last few weeks, a problem has popped up. Whenever we spin up new web instances now, there seems to be a problem with sessions. A customer will select products for their cart, but when they go to checkout, the cart will suddenly empty. When we remove the new servers, everything seems to go back to normal. Rackspace can't find any problems with the new servers. We do store Sessions in the database. Sorry for the long comment, but I was wondering if you experienced any similar problems and if you found a way to solve them. Thanks for any help you can provide!

    ReplyDelete
  3. agree with this post. talked with Chris from rackspace, who is a Cloud advisor and he told me that industry standard for things like these ex. magento sites, should require at least 1 server for the database, 2 servers for the web w/ syncing and 1 load balancers.

    Have yet to try this, which led me to your post. I'm curious, do you happen to have a magento tutorial specifically for setting up in the rackspace cloud?

    ReplyDelete
  4. I'm extremely impressed along with your writing skills as smartly as with the structure for your blog. Is this a paid theme or did you modify it yourself? Anyway stay up the nice high quality writing, it is rare to see a nice weblog like this one today.
    Magento Developers

    ReplyDelete