Tools

SQL Server Solutions in the Cloud

There are two types of SQL Server solutions in the cloud right now, and they're as different as espresso and instant coffee

Brent Ozar is a SQL Server Expert with Quest Software, and a Microsoft SQL Server MVP. He blogs at www.brentozar.com.

If you need all the power and features of Microsoft SQL Server, you can get the real thing in the cloud. Providers like Amazon EC2 and Terremark offer Microsoft SQL Server (including 2008) in virtual machines for rent by the hour.

The biggest advantage of these full-strength cloud databases is that they're 100-percent compatible with SQL Server -- you can take existing applications and simply deploy them to the cloud without changes. Any application that connects to SQL Server can work with a database stored on an Amazon EC2 or Terremark server. Just as developers can reuse their skills as-is, DBAs can administer their cloud-based SQL Servers without a steep learning curve.

Database administration is slightly different in the cloud, however, because the DBA has to account for some new dangers. Amazon's virtual machines can drop offline at any time, and the DBA needs to plan for that by using a combination of high availability and disaster recovery. One method is to use conventional log shipping, but, instead of log shipping within the same datacenter, use an Internet-based file storage service to another provider. Even though Amazon offers its own file storage services (Amazon S3), and network traffic is free between EC2 and S3, it represents a single point of failure. If Amazon S3 is unavailable, then both the EC2 virtual machines and the backups will be unavailable. Instead, consider backing up to a second provider.

There is some debate as to whether this type of solution really qualifies for the term "cloud," or whether it's more akin to traditional virtual server hosting. To add more CPU power or memory to a server, the server must be reprovisioned from scratch. The user must create a brand-new SQL Server and move the data from the old server to the newer, faster server. All OS and SQL Server configuration changes are lost. With careful scripting and planning, DBAs can minimize the work involved, but this work still doesn't line up with the public's perception of cloud scalability.

If you don't need the fully-caffeinated strength of SQL Server, though, you can compromise on power to gain scalability with the other cloud-based database option.

SQL Azure: Instant Coffee

Just as instant coffee sacrifices flavor for portability, Microsoft's own cloud-based database solution, SQL Azure, sacrifices features in exchange for easier deployments. SQL Azure isn't completely compatible with SQL Server, and most applications that were already built to store their data in SQL Server probably won't work as-is in Azure. SQL Azure offers fewer datatypes, stored procedure options, and cross-database querying, and less of what SQL Server has built up over the years.

Unfortunately, one of the things it sacrifices is the ability to handle large databases. Azure's database size is capped at 10GB per database. When the developers need to store more than that, they have to buy multiple databases and figure out how to spread data between each of them. This presents challenges for typical SQL Server developers who are used to simply pouring all their data into a single database. Sharding, the technique of splitting data across databases, isn't an easy skill to master and presents plenty of design challenges.

The production DBA will have challenges as well, since Azure doesn't support the BACKUP command. It's up to the DBA to figure out how to get the data out of Azure consistently and reliably. If Azure becomes unavailable -- as it has for short times in the past -- either the application will be completely unavailable, or the DBA will have to create a failover option using SQL Server.

The two options both have their own pros and cons, and the best way to illustrate that is to show a use case for each technology.

Dr. Dobb's encourages readers to engage in spirited, healthy debate, including taking us to task.
However, Dr. Dobb's moderates all comments posted to our site, and reserves the right to modify or remove any content that it determines to be derogatory, offensive, inflammatory, vulgar, irrelevant/off-topic, racist or obvious marketing or spam. Dr. Dobb's further reserves the right to disable the profile of any commenter participating in said activities.

Video

This month's Dr. Dobb's Journal

This month,
Dr. Dobb's Journal is devoted to mobile programming. We introduce you to Apple's new Swift programming language, discuss the perils of being the third-most-popular mobile platform, revisit SQLite on Android
, and much more!