Programming - - By Jacco Blankenspoor

Database as a Service: MySQL in the Cloud

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.

Sponsors