Database as a Service: MySQL in the Cloud

Jacco Blankenspoor

With everything hosted in the cloud nowadays, why wouldn’t you host your database in the cloud as well? In this article I will take a look at cloud providers offering MySQL cloud hosting. I will discuss their features, ease of use and price. This article will cover:

  • two providers offering just MySQL in the cloud: ClearDB and Xeround (Xeround is closing down as of May 15th, 2013. Read here).
  • two major cloud providers that offer hosted MySQL as part of their total offering: Amazon RDS for MySQL and Google Cloud SQL.

Features

Even though all providers offer a hosted MySQL database, there are some differences. You will find limitations with:

  • Xeround: Limitation in full MySQL compatibility, like ALTER table functions, log files and more. See release notes. These limitations are mostly in place to make dynamic scalability possible.
  • Google Cloud SQL: Limitation in full MySQL compatibility, and features like user defined functions and MySQL replication. See FAQ.

Amazon RDS for MySQL and Google Cloud SQL are pretty straightforward cloud-based MySQL instances, without much juice to it but with the added benefit of being in the cloud (when it comes to scaling up or down, easy cloning etc.). They simply allow you to host your database in their cloud infrastructure, with the above limitations. Amazon RDS for MySQL also has the option to have a replication standby in case of failure of your main database, and offers automated backups.

Selecting one of them depends mostly on which infrastructure you use to run your main applications. Amazon RDS would be the best fit if you host them on EC2 for example, because of low latencies. But the combo isn’t required, you can host a Google Cloud SQL database with an EC2 server.

Xeround en ClearDB take it up a notch, by providing high availability (100% uptime), easy backups and geo-distribution. Xeround tops it off with dynamic scalability for keeping up with size and throughput requirements. They both try to make it much easier for you to host your database in the cloud, without worrying about what happens when a node fails. They both run on Amazon AWS, as well as Rackspace Cloud and HP Cloud (Xeround) or Microsoft Azure (ClearDB).

Ease of Use and Specific Functionality

Now let’s have a look at how simple it is for each provider to get your database up and running.

Amazon RDS

Amazon RDS

You launch an Amazon RDS for MySQL instance like any other AWS instance, and within minutes you can access it. It does require you to have an active AWS account. Amazon offers a lot of options like automated backups, Multi-AZ deployment (standby replicated version of your database for fail-over) and Provisioned IOPS (I/O optimization) right from the set up, which is very convenient.

Amazon uses a database security group for your database instance, for which you need to authorize your server’s IP. Once it’s done, use your DB instance endpoint as the database server along with the login credentials you specified in your setup, and you’re done. You can also grant access to a specific EC2 security zone. Monitoring is running right away, and gives you insight into usage metrics like CPU, memory, latency etc. You can also set up alarms, to notify you whenever one of these metrics is crossing a specified threshold.

Amazon RDS

ClearDB

ClearDB

Setting up ClearDB is literally done in a minute, but has one downside. You can only set it up from one of their partners, being Heroku, Microsft Azure Cloud or Appfog. I’m using the last one, Appfog. But it’s almost as easy with Heroku, where you can connect it with your app. Appfog uses its own environment variables for you to connect to your database with your app/site, which includes the database location and login credentials.

ClearDB doesn’t offer much fancy monitoring, just query performance and database growth (MBs). It allows you to make a backup yourself, but it automatically keeps track of the last five days of your database as part of its service.

ClearDB

Google Cloud SQL

Google Cloud SQL

Starting up a Google Cloud SQL database is done from the Google API site, and requires you to have an active account (confirmed with billing).  You spin up a new instance, and choose the settings you like. Google Cloud SQL offers automated replication of your database, where you can choose between synchronous replication (when updating your database you have to wait for replication to finish) or asynchronous replication (you don’t have to wait for update, which is faster but can cause problem with outages during backup).

You can connect your database to your Google App Engine app, or from an external resource. They offer a range of options to connect for management (Java based command line tool), or for your application (JDBC). Google Cloud SQL offers all the basic monitoring options, like reads, writes, queries and more. Google Cloud SQL automatically sets up a daily backup, and you can save up to 7 days of backup for free.

Google Cloud SQL

Xeround

Xeround

Just like ClearDB you can start up a Xeround database from Appfog and Heroku, but also as a stand-alone service. You simply sign up for Xeround, and add a new database. After a few minutes, it’s running. You will then be given two addresses for you to use as database location. One is internal, for if your site is in the same datacenter as your database, and one is an external address in case you’re hosted elsewhere.

Xeround offers four metrics for monitoring, in both numbers and graphs. You can’t make an backup with their free plan, but there’s always an automated copy standby for redundancy.

Xeround

Pricing

All providers (currently) provide a free plan:

Amazon RDS: Micro DB instance (630 MB RAM) with 20 GB storage, 20 GB backup space and 10M I/Os a month (low IO capacity), as part of their free tier.

ClearDB: Free plan offers 5 MB of storage, max. 10 connections, daily backups, low IO performance.

Google Cloud SQL: One cloud instance with a small (unspecified) amount of RAM, 0.5 GB storage and a “reasonable” IO performance (Google intentionally remains vague about what you get: it’s a trial plan).

Xeround: Free plan offers 10 MB of storage, max. 5 connections, max. 1 MB/s throughput, and no backups.

But what if you run a highly popular, database intensive site? How much would that cost? ClearDB and Xeround work with DB size, max. connections and IO performance, while Google Cloud SQL and Amazon RDS use the traditional instance size (where RAM comes in play). Here are some examples for each of the medium plans:

Amazon RDS: Medium DB instance, 3.75 GB RAM, moderate I/O capacity, 5 GB storage, $129,60 per month.

ClearDB: Scream DB, database size up to 10 GB, max. 40 connections, high I/O performance, $99.95 per month.

Google Cloud SQL: D4, 2 GB RAM, 1.7M I/O per day, 5 GB storage, $175.80 per month.

Xeround: PRO, database size up to 3 GB, up to 4,800 connections, unlimited throughput, daily backups, auto-scaling, $453.60 per month.

As you can see, Amazon RDS offers the most bang for the buck, but is conservative in guaranteeing I/O performance (although they are rolling out provisioned IOPS storage, which gives you more control of I/O). Google Cloud SQL has this more specified, but offers lower RAM for a higher price than Amazon RDS. A Google Cloud SQL instance will cache your storage in its RAM, reducing I/Os and improving load times. For Amazon RDS you’ll need Amazon ElastiCache, which is a paid service in its own right.

ClearDB and Xeround start alike, but differ a lot when more storage is used. To be fair, Xeround does offer a cheaper plan (BASIC), but it’s limited to 0.5 GB storage. This plan costs $17 per month, and ClearDB would cost $9.95 per month for 1 GB storage. And ClearDB has a dedicated environment starting at $399.95 per month, but that doesn’t compare to Xeround since the latter always uses a multi-tenant environment. Xeround PRO has an expensive SLA, and offer auto-scaling. But the price is steep, and is something which can influence your decision even if your database if just a few MBs when you start.

Conclusion

In this article I wanted to give you an impression of what is available in Database-as-a-Service. As with most cloud based services, the possibilities are endless. But Amazon RDS comes off as a good allrounder, with competitive pricing and a whole range of features. You can easily build a high availability database yourself, with automated replication and lots of monitoring options. What helps is that you probably are already at least a bit familiar with Amazon AWS if you’re into cloud computing, and RDS uses the familiar instance methods.

Google Cloud SQL provides an impressive offering, but can be a bit harder to set up. It helps if you are already familiar with the App Engine, but since Google Cloud isn’t as widely used as Amazon AWS it has a higher learning curve. They used the experience gained from running Google search to build their infrastructure, so it’s proven and fast. But you do pay the price for this speed.

ClearDB and Xeround seem like competitors at first, but they clearly want to distinguish themselves from each other, in both pricing and features. Their starter plans are mostly alike, but Xeround’s PRO plan is in a league of its own. It’s very pricey, but highly reliable and scalable. This doesn’t mean ClearDB isn’t reliable, but their approach is different and they know their limitations (being scalable is what makes Xeround not able to offer the full MySQL package, as described in their limitations at the beginning of this article).

They both do make a high availability MySQL database accessible, easy to setup (Xeround more universal than ClearDB) and affordable (if you keep it small), making full use of the cloud’s abilities. And for that achievement, they both are the winners in this comparison.

Free book: Jump Start HTML5 Basics

Grab a free copy of one our latest ebooks! Packed with hints and tips on HTML5's most powerful new features.

  • Liam Potter

    Can someone, please, for the love of god, finally define what the cloud actually really is?

    From my understanding, it’s just the same tech we’ve been using for ages given an all encompassing name. Just a mix of virtualisation and distributed computing.

    What possible benefits can I possibly gain from adding yet another third party (read point of failure) to my infrastructure?

    • http://www.heathrow-jobs.com/tesco-jobs/ Jacco Blankenspoor

      Hi Liam,

      you’re basically right about the technology, and sometime the word “cloud” is just used for marketing (I hear it all the time around me, like a guy who talked about putting Tweets in the cloud…). To me it’s combining multiple servers to provide a product or service, where the virtual server is separated from the physical server. In the old days when you had a high traffic website, you added more servers (or more memory in your current servers) to keep up with the load. You had your own cloud.
      But with services like EC2 or RDS, an extra layer is added on top of this cloud of real servers to enable you to launch virtual servers. You are still doing the same, adding more servers or memory (or even more CPU, which is a bit harder with physical servers). But it’s all done with touching anything, right from your dashboard. And I believe that’s the real benefit of the cloud.

      The benefits you gain by adding a database in the cloud can best be explained with an example: Your database is more important than your webserver, since the latter is basically a collection of files, while your database if the core of your business. If you host your webserver and database server together, it all goes down in case of an outage. And than you have to rely on a backup to spin up a new server, and should hope your backup is up-to-date (which in case of a database, is very difficult). If you separate the two, it’s much easier to bring your webserver back alive, have it connect to your database and be up and running again. A webserver is much more likely to go down due to traffic spikes or hacking, while your database server is kept safely in the back.

      I hope I made the concept a bit more clear.

      Jacco

  • Anna

    Excellent article Jacco.

    We’re currently running a hostgator VPS for an application that takes listings and runs analysis from shopping sites.

    I’m new to the whole cloud computing idea. Would it give a substantial increase in performance to switch to something like Amazon RDS rather than stick with the hostgator provided MySQL database?

    • http://www.heathrow-jobs.com/tesco-jobs/ Jacco Blankenspoor

      Hi Anna,

      well, that depends on the load you need, and the VPS you are using. I would certainly reduce the load on your VPS if that’s what you after, since you will be basically sharing the load on 2 servers. But if your have a high database load, you should take an proper server with Amazon, because else it just becomes your bottleneck. It should be tested to be certain. And while you’re at it, you might try out one of the other Amazon AWS products for your application itself, since Amazon is well fitted for that purpose, like Amazon Elastic MapReduce (I’m sorry if I sound like an Amazon salesguy :-)

      Jacco

  • http://www.bitmaiden.com oscar

    I’ve put up a couple projects with both Xeround and ClearDB. I find Xeround is more straightforward to set up and easier to monitorize, although ClearDB through a Heroku app is a breeze.
    Amazon looks the cheaper, but even in the micro (free) instance it ends up being expensive; it’s free for a limited amount of usage of everything -disk I/O, network I/O, etc. Amazon is the best if the objective is to do anything out of the norm due to the huge amount of personalization options from developers, but it’s also the most expensive when they add random costs.

    • http://www.heathrow-jobs.com/tesco-jobs/ Jacco Blankenspoor

      Hi, thank you for your additional comments. Amazon is definitely not cheap, but they are a developers heaven. You can do basically anything with it and there is a certain form of cost control. The free plans for both Xeround and ClearDB are limited to be hosted on Amazon by the way.

  • QED

    Is anyone else worried about what this would mean for businesses that handle sensitive data deciding to put that information in the cloud? Sure, we are all responsible programmers, but there are bound to be some who don’t consider the security ramifications of putting financial, health, or other sensitive data on replicated, distributed systems that are not under their control.

    A few years back, Google was talking about crawling private databases to make that information accessible for correlation. I would have a hard time trusting data to a Google server that was not explicitly intended to be publicly accessible.

    • http://www.heathrow-jobs.com/tesco-jobs/ Jacco Blankenspoor

      Well, it depends. There are requirements for certain types of data when it comes to security (HIPAA compliance for example, for medical data), so you should consider how sensitive your information is. But with any shared hosting you have these issues, and even if you are hosting your own server with a co-location facility there’s the risk someone just hacks into your server (I know, it’s a low risk, but still). It’s always your own responsibility to make it secure, but I agree with you not everyone is as responsible with data protection as they should be.

  • Bas

    Good article! Thanks. I am currently running a local mysql db on the same server as apache for multiple websites (medium load) Is it a good idea, from a performance perspective, to use a separate db server?

    • http://www.heathrow-jobs.com/tesco-jobs/ Jacco Blankenspoor

      Hi, it’s certainly a good idea to reduce the load on your webserver that way. Do keep in mind that ClearDB and Xeround only allow you to run one site per database with their free plan.

      Jacco