Category Archives: Cloud Computing

Cloud Computing

Get Your Hands on SQL Server 2012 CTP3 in Five Minutes

SQL Server 2012 in AWS - It's like a cupcake kebob... but nerdier

I really hate waiting for software to download. It’s a first world problem and I’m an impatient guy. Thankfully, you don’t have to wait through the hour long download of a SQL Server 2012 CTP3 ISO, Windows installation, and SQL Server installation and configuration. You can now just fire up a browser, connect to AWS, and fire up a SQL Server 2012 CTP3 instance.

Microsoft and Amazon have, in their own words, “collaborated to allow customers to easily deploy and run SQL Server Code Named “Denali” on Amazon Web Services in 5 minutes with no additional Microsoft software licensing costs” (barring the cost of Windows). It’s available right now, with no SQL Server licensing costs, and little to no set up overhead. Earlier this week I convinced Brent to set up a SQL Server 2012 instance for testing and he was cursing my cunning plan within 5 minutes.

Sometimes, new AMIs may not make it into every Amazon region, which means you might not get it close to your customers, close to your current location, or on the hardware that you want. In this case the SQL Server 2012 CTP3 AMI is present in all of the current Amazon regions. This means that you can spin up SQL Server 2012 on anything as small as a Micro instance (1.7GB of memory, 1 core, shared gigabit ethernet) or as large as a cc1.4xl (2 x Intel Xeon X5570, 22GB of RAM, and 10 gigabit ethernet). Developers, DBAs, and ISVs take note: this means you can start testing your applications now before SQL Server 2012 is released. There’s no reason to delay your upgrade planning.

Read the press release, get the AMI, have fun.

Jeremiah Peschka

Jeremiah Peschka has worked as a database and emerging technology expert at Quest Software where he researched new trends and technologies in the world of data storage. Over the course of his career he’s worked with companies across many industries as a system administrator, developer, and DBA. He’s been involved with all aspects of application development and deployment. He likes cheesecake, coffee, and ice cream.

Website - Twitter - Facebook - More Posts

Configuring SQL Server in Amazon EC2: Training Video

Sure, the cloud is a cheap and easy way to spin up more servers and spin up more servers faster, but what do you do when performance problems hit? There’s no SAN team to blame and no infrastructure team to move you to a new server. This talk will expose some common performance complaints about moving SQL Server to the cloud and provide explanations and mitigations to keep you floating along on cloud 9.

This talk is for DBAs, developers, and managers who are considering moving their infrastructure into EC2. If you’re already running in EC2 and you haven’t solved some of your performance problems, this might help you out too, but I wouldn’t count on it.

To learn more, check out Jeremiah’s post on Configuring SQL Server in EC2. It covers who’s deploying EC2 VMs with SQL, what problems they’re running into, and how to improve performance.

Jeremiah Peschka

Jeremiah Peschka has worked as a database and emerging technology expert at Quest Software where he researched new trends and technologies in the world of data storage. Over the course of his career he’s worked with companies across many industries as a system administrator, developer, and DBA. He’s been involved with all aspects of application development and deployment. He likes cheesecake, coffee, and ice cream.

Website - Twitter - Facebook - More Posts

SQL Server in EC2

The cloud is robust and reliable. The cloud solves all of our scaling needs. The cloud makes my poop smell like roses. While all of these statements are theoretically true it takes some effort to make them true in reality, especially when a database is involved.

Who Is Deploying SQL Server in EC2?

A question I hear a lot is, “Who is putting SQL Server into EC2?” Sometimes there’s a hint of incredulity in that question, hinting that people can’t seriously be deploying SQL Server into EC2. That’s far from the truth: many companies, large and small, are deploying SQL Server into Amazon’s cloud, with varying degrees of success.

Back to the question of who’s deploying SQL Server in EC2…

I work with a start up building a platform on a Microsoft stack. The front end is hosted on mobile devices, the middle tier is written in .NET, and the database is SQL Server. They’re just starting out and they don’t have the time to spend speccing out servers, ordering them, and waiting for delivery. It’s easy to spin up servers to test new features and functionality and if a feature doesn’t catch on the servers are turned back off. Traditional hosting facilities didn’t offer the the flexibility or response times that they were looking for, so they chose Amazon EC2.

Another company I work with is a ISV transitioning to a Software as a Service (SaaS) model. The ISV works in an industry where there is a lot of specialized knowledge and technical ability, but that knowledge and ability doesn’t have anything to do with keeping a server up and running. In the past they’ve added additional maintenance routines to the software that they sell to customers, but sometimes customers don’t have anywhere to host this mission critical software. The ISV has hosted a few customers on their own servers, but they don’t want to keep buying new hardware in response to customer demands – what happens when a customer leaves? The ISV hasn’t made the move to cloud computing yet, they’re feeling out the different options available, but EC2 provides a level of flexibility that they won’t get through traditional IT solutions.

What are some of the problems?

There are, of course, problems with every way that you can possibly deploy SQL Server. When you deploy on premises, you have to purchase hardware, wait for it to arrive, set it up, and then you have to maintain it. When you host your database with another hosting provider, you’re limited by the amount of server space they have available. When you host in EC2 there are a different set of problems.

Cost

One of the perceived problems with deploying into the cloud is the cost. You’re renting something by the hour (like that “friend” your uncle brought to Thanksgiving last year); and renting something by the hour can get really expensive when you want that something to be up and running all the time.

How much would it cost to keep a reasonable SQL Server running 365 days a year? $10,862.40 assuming that you’re using a Double Extra Large Hi-Memory instance (that’s 4x 2.61GHz Xeons with 34.2 GB of memory). You can really kick out the jams and get yourself a Quadruple Extra Large Hi-Memory instance (8x 2.66 GHz Xeons and 68.4GB of memory) for twice the price. Yeah, that’s expensive. Of course, you can also reserve the instance and just buy it outright for a fraction of that cost, but who wants to do that?

What would a similar server cost you from HP? You can get an HP ProLiant DL380 G7 with a pair of fancy pants Intel E5640 CPUs (that’s right around the same speed as the EC2 instance), 32GB of RAM, and 1.2TB of in chassis storage for about $8,600. That price doesn’t include an OS or any other licensing costs. It also doesn’t include power, cooling, or even a spare server sitting around ready to pick up the load if your primary server fails.

Storage isn’t tremendously expensive in Amazon’s cloud – 10 cents per GB per month of provisioned storage. Over the course of a year, 1 terabyte of storage is only $102.40 a month, and that storage is fairly redundant within a single data center.

Despite the cost, Amazon’s cloud is still incredibly popular with many businesses. Why? Simple: it’s easy to start with a small amount of resources and rapidly scale in response to customer demands. If something doesn’t pan out, you just stop the servers and delete the storage and you don’t have to worry about it anymore. The costs go away as soon as you stop using the compute cycles.

Noisy Neighbor

I used to live in an apartment. It wasn’t a great apartment. In fact, it wasn’t even a nice apartment. I could hear everything that my neighbors did. After a while, I knew about their girlfriends, their love of Super Tecmo Bowl, and I learned that they liked to listen to loud music on week nights when they didn’t have to work the next day.

My noisy neighbors made it difficult for me to get things done. When you’re sharing a host, noisy neighbors can make it difficult to get things done, too. This sort of thing can happen on a server right now – when one program is aggressive writing to disk, read performance will suffer. If you’re sharing a physical server with another guest operating system, you have no idea what that other OS is doing. It could be sitting there doing nothing, it could be chugging along doing 3d rendering, or it could be a BitTorrent server. You have no idea what’s going on in the next room and how it could be affecting your performance.

Unfortunately, there’s not a lot that you can do about noisy neighbors apart from moving. In the real world, you move to a new apartment or buy a house. It takes time and money to get a new place, but it’s feasible. In EC2 it’s a lot easier to get a new place: you just upgrade your instance. You pay more by the hour, but it’s easy to get a bigger place.

Crashes in general

To be fair, you can’t do much about crashes if you’re using someone else’s hosting service; when the data center loses power your server is going to go down. So, how do you protect yourself from crashes? Redundancy, of course.

Unfortunately, redundancy gets expensive fast. If you want a redundant mirror for that 10k a year server, you need a second 10k a year server. If you want multiple servers spread across the country, you’re paying for each one. Thankfully the cost of the servers includes the Windows license, but it’s still a large cost for many people to stomach.

SQL Server has a number of options to help you keep your servers up and running in case something horrible happens. Traditional database mirroring will work in EC2. You are free to implement whatever Rube Goldberg machine you want. It’s important to keep in mind that you have little control over your storage (there are no SAN snapshots or SAN mirroring that you can control) and there is no dedicated network that you can rely on. All of your connectivity goes over the open infrastructure within Amazon’s data centers. You’re fighting for bandwidth with Amazon, Netflix, Heroku, and everyone else in the cloud.

Limits: Number of Drives

How many drives can you connect to an installation of Windows locally? 26 or so, right? That’s how many letters there are in the alphabet. You can go beyond that using mount points to boost the amount of storage you have. For most purposes, though, you effectively can attach an unlimited number of drives to a Windows machine. Certainly more than you’ll need. SANs make it easy to create huge volumes, after all.

In EC2, that’s not quite the case. You can only attach 16 drives (Amazon call them volumes) to a server. It’s important to keep this limitation in mind when designing your strategy to move into Amazon’s cloud. If you need to store more than 16 terabytes of data, you’ll need to find a way to spread that data out across multiple EC2 instances. Considering some of what we’ll cover later on, this is going to be a really good idea.

Limits: Network Throughput

Did you know that there’s a pretty solid limit on network throughput in EC2? I didn’t either until I start performing some storage benchmarks (more on this soon). It turns out that there’s a single active gigabit connection into each host. That’s right: a gigabit connection per host. You might be sharing that server with a lot of other servers. If there are 4 other SQL Servers sharing the same gigabit connection, you could end up with some very poor performance.

Amazon recently added instances with 10 gigabit network cards, but they’re limited to Linux machines in the US-East region right now. In the future there might be instances with 10 gig connections that run Windows, but there’s nothing in EC2 right now to make the path between a Windows server and the storage any faster. To keep up to date on which instances have 10 gigabit ethernet, visit the list of EC2 Instance Types and search for “I/O Performance: Very High”.

In short, if your applications are chatty, you’re going to need to learn to break them apart into many smaller pieces to keep throughput high.

Limits: Instance Sizes

We just briefly touched on this in the last section – not every size of instance is available in every region. Typically, the US-East region gets the newest fanciest servers, at least as far as I can tell. Other regions slowly get new hardware over time. The name of the instance type (m1.small, m2.4xlarge) will stay the same over time, but it may not be possible to bring up instances of the same size in every region.

Performance: Instances

Just like any other computer, there are a finite number of resources available on any host. Likewise, the VMs that you spin up have a finite amount of resources available to them. Unlike your local data center, you have no control over which VMs share the same host.

Normally you could put different machines together and stagger their functionality around the clock so that guests that did bulk processing at night would be on the same host as machines that record orders during business hours. When everything is under your control, it’s very easy to make sure that any host isn’t overcommitted during a certain time window.

The only way that you can guarantee performance is to allocate larger instances that take up all of the physical resources of the host but cost more. By doing this you’re able to eliminate the effect of noisy neighbors. It’s important to understand how to get the best performance out of your resources.

Performance: Storage

If you want to keep data around for any length of time, it’s important to persist it somewhere. Persisting your data means that you have to write it and, if you aren’t writing it to your users’ computers you have to write it to the database. Hiding beneath all of that fancy database software is something as simple as a pile of disks for storing data in rows and tables. Making sure the disks are working as fast as they can is critical to keeping a database running at peak performance.

A Note About How Gigabit Ethernet Sucks and Infiniband is Your Friend

Gigabit ethernet sucks. If disk I/O is your absolute bottleneck, you only have two options – you need to write to as many drives as possible. We’ll find out why that isn’t entirely possible in EC2. The other option is to make the connection between your database server and the storage as fast as possible. Since you can’t get super fast storage in EC2, you’ll have to find another way to make your database fast.

Just How Fast is Gigabit Ethernet?

The question isn’t rhetorical. It’s important to understand how fast gigabit ethernet is. Gigabit ethernet can really only transfer, at most, 120 megabytes per second. That’s the theoretical maximum assuming that everything along the line is operating perfectly and there is no latency or additional hops to make.

We’re not likely to see this in the real world. You’re not likely to see this in your own server room and you’re sure as hell not going to see it in EC2.

Why is your storage going to be slow? You have keep in mind that not everything involved may be able to push data at 120 MB/s; the drives could be slow, fragment, or you could be sharing space with someone else who is doing a lot of reading and writing. Other people could be reading from the same host as you or they could be streaming movies from the host to a customer in the suburbs.

In an attempt to find an answer, I conducted several tests on an EC2 instance over the course of several days to answer the question, “Just how fast is gigabit ethernet?”

Testing Methodology

For all of the tests, I used the same m2.4xlarge instance. I installed it from a standard Windows Server 2008R2 SP1 AMI that Amazon supply. Nothing was changed with the operating system. This Windows was about as vanilla as it gets.

For my tests with the drives, I used EBS volumes that were allocated in complete 1TB chunks. I made two rounds of tests. In both cases, the drives were formatted with a 64k sector size. The first round of tests was done with drives that were quick formatted. The second round of tests were performed with drives that were not quick formatted. FYI, formatting 10TB of drives in EC2 takes about 2 days. I used a Large Windows instance to format the drives at a cost of about $26 in CPU time plus another $57.20 in I/O cost just to format the drives.

The first set of tests I ran involved using CrystalDiskMark. I used the default configuration and ran it across the quick formatted drives. Drives were configured with 1 EBS volume, 2 EBS volumes, 3 EBS volumes, and 4 EBS volumes. I conducted a second set of CrystalDiskMark tests using fully formatted drives with 1, 2, 3, 4, and 10 EBS volumes in a single drive.

The second set of tests was more complex and involved using SQLIO to simulate sequential and random reads from SQL Server over a period of time. All tests were performed on a single EBS volume, two striped EBS volumes, four striped EBS volumes, and a pair of striped four EBS volumes.

EC2 Storage Test Results

CrystalDiskMark Results - Quick Format

Right away, we can see that performance quickly spikes for sequential reads and writes. While the results for read decrease, this isn’t a reflect of the storage itself so much as it is a reflection of trying to cram a lot of data through a tiny ethernet pipe. Overall, the quick formatted drives don’t show a lot of performance improvement no matter how many spindles we throw at the problem.

CrystalDiskMark Results - Full Format

There are some things that we can conclude about the performance of disks in Amazon’s platform. First and foremost: format your drives. Don’t just use a quick format; use the slow format. The downside is that it takes time to format disks and time is money, especially in the cloud.By using a full format, disk performance improved by 30% for 4K writes with a queue depth of 32 and improved, on the whole, by around 15%. There were a few anomalies – specifically the 4k write performance spike with 4 EBS volumes and the sequential read performance spike for 2 and 4 EBS volumes. The only conclusion I can come to is that reads were cached and did not hit disk.

SQLIO - IOPS

The SQLIO tests show a different story. Right away we can see that sequential I/O performance peaks with a maximum of two volumes, but random reads and writes keep scaling right up until the tests stop – the more spindles that were used, the more random I/O that we could perform. And here’s where things get interesting again. Looking at the graphs you can see that sequential I/O falls apart a little bit north of 1000 IOPS. That’s not a limit of the underlying disks, we’re just maxing out the ethernet connection. When there’s a finite pipe limiting how fast we can read, of course the number of IOPS is going to stop pretty quickly.

SQLIO - MB per second

Looking at the throughput in terms of the amount of data (rather than the number of reads and writes) that we can move through EC2, it’s very easy to see where we hit the ceiling. With a theoretical maximum of 120 MB/s, it’s easy to see that sequential read and write max out when two volumes are use. It’s clear, though, that random reads and writes continue to scale as we add more drives. I suspect that if I had been able to add more spindles, the random write performance would have continued to scale up to 120 MB/s.

What does this mean for SQL Server in EC2?

You can get the random I/O performance that you want, but sequential read/write performance is not going to be good. Taking that a step further, here’s what you don’t want to do in EC2:

  • Data warehousing
  • Large ETL
  • Bulk data processing that requires sequential reads
  • Anything else that requires a lot of sequential read and write

On the flip side, what should you use SQL Server in EC2 for?

  • OLTP
  • Off site processing that isn’t time sensitive
  • Distributed write loads (sharding)

SQL Server hosted in EC2 is going to be very effective for highly random loads and especially for loads where data can be kept in memory (currently less than 68.4 GB).

A Sidebar about Ephemeral Storage

Don’t use it. It goes away and may never come back. Well, it goes away when your instance reboots.

Because it’s the drives that live in your server chassis. You can’t predict where your server is going to be when you turn it back on again, so you can’t predict if that data is going to stay with you or not. This is a best practice for virtualization, if you think about it. When you’re setting things up using VMware or Hyper-V you don’t want to attach long-term storage that’s in the server chassis, it makes your virtualization more brittle. Using local storage, if any thing happens (a motherboard fails, a drive fails, a CPU fan goes out, or memory fails) you’ve lost that host. You can’t bring that VM up on another server because the OS is still on hard drives in that broken server.

Local storage is great for temporary (ephemeral) things. Make sure that you take that into account when you’re designing your infrastructure. Fast, cheap, temporary storage is great for fast, cheap, temporary operations like TempDB or local scratch disks.

First Touch Penalty

Amazon mention in a lot of their documentation that there’s a penalty, and potentially a large one, for the first write to a block of storage. When you look at the numbers below you’ll realize that they weren’t kidding. Amazon further go on to claim that if you benchmark the storage (as I did) you’ll be horrified by the results (as I was) but that you shouldn’t worry because the first write penalty is only really obvious during benchmarking and will be amortized away for time in the real world.

Here’s where I have to call bullshit. If your workload consists almost entirely of writing new data, you’re going to see a first touch penalty until the drive is full. It won’t end. Writes will suck until your drive is full. Then you’ll add more drives and the suck will continue. This is compounded for relational databases where the currently accepted best practice is to ensure sequential writes by clustering on an arbitrarily increasing integer.

The only way to guarantee acceptable performance is to format your drives and write to them block by agonizing block until the storage is full formatted.

Staying Up in the Clouds – HA/DR Options

Clustering: Sad Trombone of the Cloud

You can’t cluster in EC2. Don’t try. There’s no shared storage. EBS volumes can only be attached to a single server at a time. You could share the drives, but you really shouldn’t do that. You could use some Windows based SAN system that mounts drives and pretends it’s a SAN, but without any guarantees of performance or longevity, why would you want to?

We’ll just leave this one as: You can’t cluster in EC2.

Availability zones and regions

In case you didn’t know, Amazon’s magical cloud is divided up into regions. Each region is made up of multiple availability zones. They’re all right next door to each other, but they’re in separate buildings with separate internet access and separate power.

Availability zones exist to protect users from localized failure. Hopefully, if there’s a problem in a data center, it’s only going to be a problem in one data center (one availability zone). If that zone goes down, the others should be up and running. If you want to keep your server up and running through local failures, you need to make sure you keep a copy of your data in multiple availability zones. If you want to keep your business up and running in the event of a regional failure (the smoking crater scenario), you need to keep copies of your data in multiple regions.

Region – national level.

Availability zone – local level.

Got it? Good.

Mirroring SQL Server in EC2

One of the easier ways to keep things up and running in the event of a failure is to use SQL Server’s mirroring. Using synchronous mirroring with a witness is going to put you in a great place in terms of disaster recovery. It’s both possible and advisable to put the primary in one zone, the secondary in another, and the witness in a third zone. We can feasibly survive some pretty heavy duty hardship by configuring SQL Server mirroring in multiple availability zones. The applications talking to SQL Server need to be able to fail over between the mirrors but that should be pretty easy for today’s modern developers to handle, right guys?

SQL Server Replication in EC2

Replication is always an option and is probably a better option when you want some kind of geographic fail over. Instead of diving into contentious issues around designing a replication topology, I’m going to hit on the pros and cons of replication in the cloud.

We’ve already seen that there significant limits to network throughput in EC2. We’re limited to, at most, a gigabit of storage throughput. We’re also limited by our ability to write to disk in 64k chunks – only a little bit more than 1000 IOPS are possible at a 64k write size. These limitations become a problem for transactional replication. In an on premise set up, transaction log performance is frequently a problem when replication is involved. If you think that the performance of the transaction log won’t be an issue in the cloud, think again. The I/O characteristics of Elastic Block Storage guarantee that the performance of the transaction log will become a problem under heavy load.

Replication latency is another concern for DBAs in EC2. Not only do reads and writes occur slower, but that read/write slowness means that transactions will be committed to the subscriber further and further behind the publisher. Of course most applications aren’t writing constantly, but it’s important to consider what might happen if the subscriber isn’t able to commit the load that’s being written throughout the business day – will it be able to catch up after hours? If it can catch up today, will it be able to catch up tomorrow?

Crashes happen in EC2, entire regions have gone offline. Unfortunately, at any kind of scale something is bound to be broken right now. What do you do when that happens? What do you do when that happens to the distribution database? (You are running the distributor on a separate server, right?) What do you do when the distributor goes offline and never comes back up, drives corrupted irreparably?

I don’t have the answers, but that’s something your recovery model must take into account when you’re deploying into the cloud.

SQL Server Backups in the Cloud

You gotta keep that data safe, right? Taking backups and hoping for the best isn’t going to cut it once you’ve moved all of your data up into the cloud. You need a retention and recovery strategy.

EBS Data Protection

Amazon’s Elastic Block Storage (EBS) looks like some kind of SAN drives that you can attach to your server. When you look more closely at the disks themselves, they look like drives attached to some kind of storage device powered by Red Hat Enterprise Linux. I’m overusing the phrase “some kind” because you just don’t know what’s back there.

There are, however, some certainties around EBS. An EBS volume lives within a single availability zone. There are multiple drives involved and multiple block level copies of your data. There could be a failure of a back end drive and you’ll never know about it.

The downside of EBS is that there’s no global availability of your data. There is no SAN replication, no global single back up of your data. If you want that, you’ll need to look into using Amazon S3 to provide greater safety.

Be Safe with S3

Amazon Simple Storage Service is a very simple storage service indeed. It’s a block level data store that refers to big binary chunks of data by name. It’s like a filesystem that exists everywhere. Sort of. The important part of S3 is that your data can be persisted at a very paranoid level over a very long period of time. In their own words S3 is “Designed to provide 99.999999999% durability and 99.99% availability of objects over a given year.”

Why mention S3 at all? It’s not very fast and it’s not very easy to mount S3 storage to Windows. There are two things you can do with S3:

  1. Store SQL Server backups.
  2. Snapshot EBS volumes.

Storing SQL Server backups in S3 should be a no brainer for anyone. S3 storage is cheaper than EBS storage and it’s far more durable. Since S3 is global, it’s also possible to push data up to S3 from one region and pull it down in another. Your servers will live on.

S3 can also be used to store snapshots of EBS volumes. Don’t be fooled by the word “snapshot”. The first time you take a snapshot you will likely make a very bad joke about how this isn’t a snapshot, it’s an oil painting. Don’t do that.

The first EBS snapshot to S3 is going to be slow because there is a block level copy of the entire EBS volume happening in the background. All of your data is zipping off into the internet to be safely stored in a bucket somewhere. The upside is that only the blocks of data that get changed are going to get snapshotted. If you perform frequent snapshots then very little data will need to be sent to S3, snapshots will be faster, and recovery should be a breeze. Keep in mind, of course, that these are not crash safe SAN snapshots, so they shouldn’t be used for live databases. I’m sure you can think of cunning ways to work with this.

A Plan for Safe & Secure SQL Backups in EC2

What’s the safe way to manage backups in EC2? Carefully.

Were it up to me, here’s what you’d do:

  1. Backup your data to an EBS volume.
  2. Mount an S3 drive to your Server.
  3. Copy the data to the S3 drive using xcopy with the /J flag

Of course, if it really were up to me, you’d have mirroring set up with a primary in one availability zone, a secondary in another, and the witness in a third. Oh, and you’d be using synchronous mirroring.

Scaling SQL Server in EC2: Scaling Up

This is, after all, why we’re here, right? You’re not just reading this article because you want to learn about database backup best practices and how many IOPS some magical storage device can perform. You want to know how to give your SQL Server some more zip in EC2. There’s a finite limit to how much you can scale up SQL Server in EC2. That limit is currently 8 cores and 68.4GB of RAM. Those 8 cores currently are Intel Xeon X5550s that clock in at 2.66 GHz, but that might change by the time you’re reading this.

In EC2, there’s a limitation on how much we can scale up. Commodity hardware really does mean commodity hardware in this case. If you can’t scale up, the only thing left is to scale out.

Scaling SQL Server in EC2: Scaling Out

It’s incredibly easy to create more instances of SQL Server in EC2. Within a few clicks, you’re most of the way there. You can automate the process further using Amazon’s developer tools to script out additional configuration, attach local storage, and attach EBS storage. The developer tools make it a breeze to create and deploy your own custom images so you have pre-configured instances up and running. You can even use tools like Puppet or Chef to completely automate adding more servers to your environment.

Summing It Up

So, there you have it – it’s possible to get great performance for certain types of SQL Server operations in EC2. If you’re looking for a cheap way to set up a data warehouse, you should look elsewhere. You might be able to slap something together in EC2 that performs well enough, but there will be a lot of man power involved in making that solution work. If you’re looking for a quick way to scale your application up and out without worrying about buying hardware and making sure it’s being used appropriately, then you’ve come to the right place.

Want to read it later? Download the PDF.

Jeremiah Peschka

Jeremiah Peschka has worked as a database and emerging technology expert at Quest Software where he researched new trends and technologies in the world of data storage. Over the course of his career he’s worked with companies across many industries as a system administrator, developer, and DBA. He’s been involved with all aspects of application development and deployment. He likes cheesecake, coffee, and ice cream.

Website - Twitter - Facebook - More Posts

I’m on RunAsRadio Talking SQL Azure and SSDs

At the Connections conference in Orlando, I had the opportunity to sit down with Richard Campbell, host of RunAs Radio, and talk shop.  I love conversations with Richard because he gets to travel and touch all kinds of cool systems, so as a result we end up jumping off-topic all over the place, talking about the neat stuff we’ve seen and the way it changes IT jobs.

In the podcast, we talked about the two extremes of IT: seems like half the people are excited to cut their costs by going to the cloud, and the other half are excited to raise their performance by switching to solid state drives.  No matter which way you want to go, databases (and database performance tuning) techniques are changing.

Head over to RunAsRadio.com and listen.  Enjoy!

Brent Ozar

Brent specializes in performance tuning for SQL Server, VMware, and storage. He's one of the very few Microsoft Certified Masters of SQL Server, a published author, and a Microsoft MVP. He likes travel, Jeeps, Apple gear, jokes, and writing about himself in the third person. Read more and contact Brent.

Website - Twitter - Facebook - More Posts

Jeremiah Peschka & Buck Woody Talk Database Communities

Two of my favorite members and best speakers in the SQL Server community have made big changes – they’re refocusing their careers and their community work outside of SQL Server.  Is it the beginning of a trend?  What’s going on in the NoSQL and cloud database world that’s so attractive to these guys?  I interviewed them to find out.

Brent Ozar and Buck Woody

Me, Buck Woody, and the coolest quilt ever.

Buck Woody (Blog@BuckWoody) has worked for Microsoft since 2006, and until recently, he was our Inside Man – a fighter for the SQL Server data professional.  He switched roles over to the Azure team a couple of months ago.

Jeremiah Peschka (Blog@Peschkaj) joined Quest Software this year as a sort of technology evangelist, working with NoSQL and cloud databases.  Prior to that, he’s worked with SQL Server as a developer, database administrator, and consultant.  He just resigned from the PASS Board of Directors to spend more time working with the NoSQL communities.

Brent: Question 1. WHAT, SQL SERVER ISN’T GOOD ENOUGH FOR YOU?  Okay, well, if I’m honest, it isn’t good enough for me either, because there’s always more stuff I wish it did.  But what is it about these other database movements that excited you enough to focus more on those?  Give me your elevator pitch.

Buck: No – it isn’t good enough :) . But then, nothing ever is when you’re a curious person – and I’m one of those! I feel that utility-based computing is inevitable, and it’s all just data anyway – so Azure was a slam-dunk for me, a natural progression in my career. The tougher part was actually getting the position, since lots of really smart folks at Microsoft wanted the job. But I have those pictures….

Jeremiah: I’m excited because these new databases focus on one thing and doing it well. They each scratch a particular itch. SQL Server is a great general purpose database, but there are some things it doesn’t do very well – batch processing, massive parallelism, and scale out.   Many of these databases build on the skills that developers already have (object-oriented programming) to create complex solutions for ETL, analytics, and distributed storage – they’re good frameworks for complex tasks.

Brent: You’ve both been transitioning away from SQL Server for a few months.  What’s the state of these new database communities?  What are they like compared to the SQL Server community today?

Buck: Vague, undefined, and unordered. No, wait, that’s the cloud! So of course the audience mimics the product structure. Since Azure is essentially an online operating system that you write almost any code you want against, the users have a huge – I mean absolutely huge – range of skills, ages, interests and so on. So the community isn’t anywhere near as defined as SQL Server is. Not only that, it’s a new product, so the community hasn’t had time to define itself. I think over time we’ll get enough vertical interest groups that communities will form. It will just take time.

SQLSaturday Chicago

Me, Aaron Nelson, and Jeremiah Peschka at SQLSaturday Chicago

Jeremiah: The emerging database communities are very young right now. It’s difficult to figure out which databases will stick around for a while, but the communities are vibrant, changing, and open to new ideas. There’s a lot of energy, enthusiasm, and passion. People want to share what they know.

Brent: What can the SQL Server community learn from the NoSQL and cloud communities?

Jeremiah: The biggest thing that I’ve had to re-learn is that it’s important to look at every problem fresh and evaluate all of the options available before determining what to use. Sometimes it only needs to be a cursory glance, but other times it’s worth really examining what’s going to be happening and figuring out the best solution for the problem.

Buck: Agility and adoption, and focus on solving a problem, regardless of the technology. I don’t see nearly the stratification of the developers as data professionals, and the developers seem very willing to try anything new, as long as it solves their problem. They are also ready to move to the latest technologies.

Brent: How far away are we from the time when European or financial customers can adopt these new technologies?

Jeremiah: A number of European and financial customers are already using a variety of NoSQL databases. Booz Allen Hamilton are providing consulting services around Hadoop and Bank of America is also using Hadoop. a number of companies are using other NoSQL databases – ComCast are using Riak, and the New York Times and Intuit are using MongoDB. There are a bunch of NoSQL conferences happening in Europe – NoSQL:EU and Business Cloud 9.  I think that some aspects of cloud computing are further away in Europe due to EU regulations, but I could be wrong. I’m not as familiar with cloud databases as I am with the NoSQL space.

Buck: They are doing it now. In fact, after I type this I’m off to meet with a financial firm on their latest Azure application. It’s moving faster than most people realize, to Azure, Google, and Amazon.

Brent: If I wanted to keep an eye on the databases you’re working with, what are the top few blogs I should check out?

Jeremiah: I’d keep your eye on the NoSQLPedia blog aggregator, for starters. We’re adding more people on a weekly basis. Outside of that site specifically, things are still pretty fragmented at the moment.   In general, I watch Lars George for Hadoop and HBase news, the Basho blog for Riak, MongoTips and Snail in a Turtleneck for MongoDB news, Planet CouchDB for CouchDB, antirez.com for Redis, and http://facility9.com (of course) for my take on the entire thing.

Buck: I tend to like http://blogs.msdn.com/buckwoody :) , but anything Wayne Walter Berry writes is tres-awesome.

Brent: If – okay, when – I talk to you again in a year about you’re doing, what do you hope to have pulled off?

Buck: A significant growth in the “Azure Marketplace” – a site where you can sell your Azure “Apps” to other devs or even end-users. I’d like to see that thing eventually become the iTunes of the cloud.

Jeremiah: I want to see people actively using hybrid database solutions in their production environments. If I hear about someone using SQL Server for their RDBMS, Hadoop for batch processing, Hive for analytics, and Riak for caching and data distribution, I’ll be a very happy guy.

Brent Ozar

Brent specializes in performance tuning for SQL Server, VMware, and storage. He's one of the very few Microsoft Certified Masters of SQL Server, a published author, and a Microsoft MVP. He likes travel, Jeeps, Apple gear, jokes, and writing about himself in the third person. Read more and contact Brent.

Website - Twitter - Facebook - More Posts

Sharing Big Files Easily with Amazon S3

Email servers restrict how big your file attachments can be.  I frequently ask my clients to send me trace files and diagnostic logs that are hundreds of megabytes (even compressed), and doing this over email just doesn’t work.  In the old days, we set up FTP servers to move files around, but FTP uploads aren’t intuitive for most users.

Web services like Filedropper.com and drop.io sprouted up to help alleviate this pain.  Users just go to those sites, upload the file, and they get a URL they can share with anyone to download the file.  They’re easy and useful, but they reserve the best features – like big file sizes or privacy – to paying users.

Now you can host your own file-upload service on your web server and use Amazon S3 for the cloud back end.  The whole thing is pretty simple:

Step 1 – get an Amazon S3 account. I’ve long been a fan of Amazon’s Simple Storage Service (S3), a cheap cloud file server.  Bandwidth is free until November 1st, 2010, after which it’s just $.15 per GB, and storage costs are $.15 per GB.

Step 2 – download the HTML files – Ricky Matata did the hard work of building a form with a Flash-based file upload component and hooking it up to Amazon S3.

File Upload Example

File Upload Example

Step 3 – edit the parameters in the files – there’s a few parameters for things like the maximum file size you’ll allow, the number of files you’ll allow, and your Amazon S3 credentials.  If you wanna get fancy, you can also edit the form itself – I simplified mine so that it only shows a file upload and nothing else.

Step 4 – upload the files to your web site & S3 – and presto, you’re done.  You can point your clients to the web page whenever they need to send you files.  As users upload files, they’ll be available in your Amazon S3 account – you can download them via the web.  Depending on how you set up your privacy on your S3 folders (aka buckets), the public can also download those files – handy if you want to share files with multiple people.

Good coders might add things like email alerts so that they get an email whenever someone uploads a file for them, or perhaps automatic deletion of the uploaded files after X days.  I’m not a good coder, and I’m quite happy with this setup.  I just tell the clients to let me know after they’ve sent me the files I needed.

Brent Ozar

Brent specializes in performance tuning for SQL Server, VMware, and storage. He's one of the very few Microsoft Certified Masters of SQL Server, a published author, and a Microsoft MVP. He likes travel, Jeeps, Apple gear, jokes, and writing about himself in the third person. Read more and contact Brent.

Website - Twitter - Facebook - More Posts

SQL Azure Frequently Asked Questions

On Monday 2/1, SQL Azure goes commercially live.  Microsoft’s charging for service now, and that means it’s officially official.

I talk to a lot of enterprise DBAs, project managers, and developers about SQL Server in the cloud.  Here’s some of the questions I get asked most often.

What is SQL Azure?

SQL Azure is Microsoft’s solution for SQL Server in the cloud.  It has a few key differences from traditional SQL Server:

  • Database maximum size is 1GB or 10GB based on your price plan, but no larger
  • You can have as many databases as you want, but they may not be on the same server
  • There’s no cross-database querying
  • There’s no SQL Azure encryption
  • It supports a subset of SQL Server’s T-SQL commands, but not all of them
  • It supports a subset of SQL Server’s datatypes, but not all of them

I like to think of it as SQL Server Lite – it’s an excellent stepping stone to the real thing.  Build your app from the ground up for SQL Azure, and it’s pretty easy to support full-blown SQL Server down the road if your needs change.

How does SQL Azure pricing compare to SQL Server costs?

Azure is a lot cheaper if you only need one database – $10/month for 1gb of data, and $100/month for 10gb of data. Pricing is per database, not per application – you can write multiple applications to query the same database.  Price is only one part of the equation, though.

The more databases you need, or the larger databases you need, the more it makes sense to have your own SQL Server.  Generally speaking, I tell companies that if you have any of these requirements, SQL Azure probably isn’t for you:

  • More than one department that needs to store data in SQL Server permanently
  • You don’t have at least 2 very senior-level programmers who understand the concept of sharding
  • You face security concerns involving HIPAA, SOX, or PCI compliance
  • You’ve already built a schema and/or an application

I’m not saying you can’t meet those needs with SQL Azure, but generally speaking, you’re not the target market for Azure v1.0.  On the other hand, if you have the following requirements, Azure might be a very good fit for you:

  • No full-time IT staff, no DBAs
  • No datacenter (or maybe not even an office)
  • No (or very, very little) legacy code, and you’re building a new app from scratch
  • You don’t mind putting in extra man-hours in the beginning to avoid capital investments

In that situation, Azure might make good sense, but you’re going to have to plan your way around Azure’s limitations.

Why does SQL Azure have a 10GB limit?

I can’t speak for Microsoft, but it would make sense to put a small database size limit to make sure queries run fast.  If you’ve got a 10GB database, it’s easy to make sure every query runs blazing fast.  Throw hardware at the problem, throw a lot of indexes at it, and you’ll get good performance.  Keeping things small also makes backup & recovery easier, and makes high availability design easier.

There are no SQL Azure RAM limits or CPU limits.  You have no control over how much CPU power or memory your database gets.  SQL Server 2008 has a Resource Governor that allows database administrators to throttle queries based on login or database, but Azure doesn’t support those features.

How can I load balance SQL Azure or do cross-database joins?

Since SQL Azure databases max out at 10GB, it would be great if we could create several databases on the same server and use a view to select from all of them.  No dice – that’s not supported.  As of February 2010, your application has to know which databases to query.  If you need to combine results from multiple databases, you’ll need to do that processing inside the application by querying all of the databases and then joining the results together in the app.

Scaling SQL Azure this way is called sharding – partitioning your data into different shards, each stored in a different database (or even different servers.)  Design your app like this, and it will scale like crazy.  If you’re the kind of coder who loves reading the stories on HighScalability.com, you’ll love sharding.  If you’ve never heard of HighScalability.com, you don’t want to architect your own sharded database – bring in somebody who lives this stuff.

How do I handle the SQL Azure backup process?

Unfortunately, right now, you have to build one yourself.  SQL Azure does not support the BACKUP command.  You’ll need to figure out how to sync your data out to an external database, and while you’re doing that design, keep in mind that you pay Microsoft for data transfers in & out of SQL Azure.

Microsoft states that Azure is highly available and contains its own backups across multiple servers.  However, just as RAID is not a backup, high availability is not a backup either.  You need backups if you want protection from any of these scenarios:

BSOD-T

BSOD-T - get yours today!

  • Your app might accidentally delete or modify data
  • Your users might accidentally delete or modify data
  • A hacker might purposely delete or modify data
  • Or believe it or not, Microsoft services just might go down.

Remember, folks, as much as I love Microsoft, we’re talking about the company that brought you the Blue Screen of Death.  You would be irresponsible not to back up your data for your own protection.  (T-shirt available for around $25, and if you want different colors or shirts, click the Customize button after the link.)

How good is SQL Azure performance?

The biggest SQL Azure bottleneck is your bandwidth, because all Azure queries go from your application to Microsoft’s servers and back.  Azure developers report that they’re very satisfied with the query speed, and usually report that it’s faster than servers they’ve built themselves.

The problem will arise when you’re not satisfied with SQL Azure’s performance.  You’ll want to ask these questions:

  • What else is querying my database right now?
  • What does my query execution plan look like?
  • What indexes could I add to make this query run faster?
  • Is another Azure database hammering the server right now?

Unfortunately, SQL Azure doesn’t support any commands, dynamic management views (DMVs), or functions that will help you answer those questions.

Can I use SQL Azure as a backup with log shipping or database mirroring?

No.

Don’t think of SQL Azure as your disaster recovery solution – it doesn’t work that way.  If you design your database for sharding, then you can work out a method to sync between Azure and full-blown SQL Server, but right now you’re very much inventing the wheel.  Your next question would be how to run Azure inside your own datacenter so that you could keep an identical environment between production (Azure) and disaster recovery (your place.)

How do I run Microsoft SQL Azure on commodity hardware?

You can’t run SQL Azure in-house on your own hardware.  It only runs in Microsoft’s datacenters.  If you want to develop against Azure but you don’t want to pay for Azure, you have two options.

Option #1 is to buy SQL Server Developer Edition for under $50.  It’s functionally equivalent to SQL Server Enterprise Edition, but the license prohibits using it in production.  You’ll have to restrict yourself to only using the Azure-level features, though – if you accidentally design your schema to use, say, full text search, it’ll work fine on Developer Edition, but it won’t work in Azure.

Option #2 is to get an MSDN subscription with Azure benefits.

What SQL Azure plans do MSDN subscribers get for free?

It depends on your level of MSDN/Visual Studio:

That pricing is retail pricing, and volume license users get Visual Studio & MSDN cheaper.  Obviously you wouldn’t buy an MSDN subscription just to get $360 worth of SQL Azure databases ($30 * 12 = $360) but it’s part of the picture.  MSDN subscriptions also come with other Azure benefits too, and those Azure benefits stay live as long as you maintain your MSDN subscription.

Got a SQL Azure question I didn’t answer?

Leave it in the comments and I’ll track down the information for you.

Brent Ozar

Brent specializes in performance tuning for SQL Server, VMware, and storage. He's one of the very few Microsoft Certified Masters of SQL Server, a published author, and a Microsoft MVP. He likes travel, Jeeps, Apple gear, jokes, and writing about himself in the third person. Read more and contact Brent.

Website - Twitter - Facebook - More Posts

SQL Server in the Cloud article at Dr. Dobb’s Journal

When You Care Enough to Spend The Very Least

When You Care Enough to Spend The Very Least

Dr. Dobb’s Journal just published an article of mine about SQL Server in the cloud.  In it, I cover:

  • The full espresso-strength option for SQL in the cloud
  • The “instant coffee” version that might just meet your needs
  • Two real world use cases – one that needed espresso, and one that ended up with Nescafe

You can read the article, and then let me know what you think here.  (They don’t have discussions on articles.)

Brent Ozar

Brent specializes in performance tuning for SQL Server, VMware, and storage. He's one of the very few Microsoft Certified Masters of SQL Server, a published author, and a Microsoft MVP. He likes travel, Jeeps, Apple gear, jokes, and writing about himself in the third person. Read more and contact Brent.

Website - Twitter - Facebook - More Posts

Cloud-based database thoughts before #SQLPass

Next week at the PASS Summit, I’m presenting a session called “Yes, I’m Actually Using The Cloud.” I’ll be talking about what’s out there, why I use it, and why you might want to use it too.

Brendan Cournoyer of SearchSQLServer.com interviewed me recently about the topic and asked questions like:

  • For those who are relatively unfamiliar with cloud computing, what is the case for cloud-based databases? Is it all about performance?
  • Aside from questions about security, what are some other reasons why folks might be hesitant to deploy cloud databases?
  • What about other cloud database options? Relational databases in the cloud are rare. From a SQL Server perspective, how does Azure compare to the other options that are available?

You can read my answers in the interview at SearchSQLServer.

Amazon RDS: New Azure Competitor

Today, Amazon announced a new competitor to SQL Azure: Amazon Relational Database Service.  It’s got some compelling advantages:

  • It’s basically MySQL with some added goodies. If you already know and love MySQL (I don’t know it well, so I don’t love it – yet), it’s easy to love RDS.
  • Amazon handles basic management. They do patch management, backups, restores, and export performance statistics to Amazon CloudWatch for free.  To some extent, they’re providing production database administration as part of the cost.
  • It leverages Amazon’s storage for snapshots. You just tell Amazon how many days of history you want to keep, and they handle it for you without you understanding anything about recovery.
  • Coming soon: high availability with replication. You’ll be able to replicate your MySQL databases between Amazon’s different datacenters without a fancypants database administrator.

If I was a MySQL production DBA, you’d hear my eyebrows raising.  I’d be worried about my long-term job prospects.  From here, it’s a race to the bottom.  Suddenly there’s a service out there that provides some of the same functionality that production DBAs provide, except it’s available by the hour.

What’s the Cheapest Way to Solve a Problem?

How Low Can You Go?

How Low Can You Go?

If I was the project manager for an app with a MySQL back end, you’d hear my sigh of relief.  If I could move my app to Amazon RDS, suddenly performance issues have a completely different solution.  I could either pay a MySQL DBA to find the root cause, or I could simply choose a faster/stronger/better Amazon instance size.

A “small” instance is 1 core with 1.7GB of memory.

A “quadruple extra large” instance is 8 cores with 68GB of memory.

The price difference between these two is roughly $3 per hour.

How much do you think a MySQL DBA costs?  It’s gotta be more than that.  Why would you pay a DBA if you can simply ramp up hardware capacity?  Now, of course as DBAs, we know that model doesn’t scale forever.  You can still run into performance problems at the Quadruple Extra Large instance level, but project managers will gamble that their apps will still survive long enough for Amazon to introduce faster instance power.

The Best Kind of Cloud Service

This is my favorite kind of cloud service.  It’s not vendor-specific, so you can build your app with a MySQL back end without committing to using Amazon RDS.  If Amazon pulls the plug on RDS next year, no biggie – you can still run it on any hosted MySQL service.  You can’t do that with Amazon SimpleDB, which is proprietary. Even better, Amazon RDS is full-blown MySQL, not hobbled in any way.

SQL Azure falls into an odd niche, because you can develop for it without worry.  If Microsoft pulls the plug on Azure, you can still use your app with “real” SQL Servers, because Azure is just a crippled SQL Server implementation. (That’s a good thing and a bad thing.)  However, if Azure dies off, you’re stuck with moving to SQL Server, not exactly the cheapest solution around.  Microsoft offers free-for-a-while licensing with BizSpark and WebSpark, so you can at least buy time, but sooner or later you’re going to face licensing costs.

I love announcements like this because I see it as an exciting time to be a solutions provider.  Like I blogged yesterday, DBAs are always consultants, and we need to view ourselves as providing a service.  Amazon RDS, like other tools, is something that can either compete with us or be part of our toolset.  Figure out how to use it as part of your skillset, or else you risk getting displaced by it.

Brent Ozar

Brent specializes in performance tuning for SQL Server, VMware, and storage. He's one of the very few Microsoft Certified Masters of SQL Server, a published author, and a Microsoft MVP. He likes travel, Jeeps, Apple gear, jokes, and writing about himself in the third person. Read more and contact Brent.

Website - Twitter - Facebook - More Posts

PASS Session Preview: Yes, I’m Actually Using the Cloud

In this session at the PASS Summit in Seattle, I’ll talk about the options for SQL Server in the cloud today and how I’m using them for my projects.  I’ll talk about how to choose the right cloud-based solution for your needs, and I’ll do a live demo of working with SQL Server in the cloud.

Here’s a video preview of me walking through the first several slides in the deck:

[media id=23 width=640 height=500]

I’ll be giving this session on Thursday, November 5th at 1:00pm – 2:15pm in room 201.  This is the smallest capacity room at the summit, fitting only 128 people as opposed to 300-500, and I got a huge laugh out of that.  Tells you something about the demand for SQL Server in the cloud knowledge or my presentation skills – or both!

Update: SearchSQLServer.com published an interview with me about using SQL Server in the cloud.

Brent Ozar

Brent specializes in performance tuning for SQL Server, VMware, and storage. He's one of the very few Microsoft Certified Masters of SQL Server, a published author, and a Microsoft MVP. He likes travel, Jeeps, Apple gear, jokes, and writing about himself in the third person. Read more and contact Brent.

Website - Twitter - Facebook - More Posts