Durable data storage is a key component of any cloud computing offering. The Windows Azure Platform offers many options, which can be used alone or in combination. Windows Azure itself offers ready-to-use and lightweight storage in the form of tables, blobs, and queues. Another choice for storage is SQL Azure, a true relational database in the cloud. In this session, we’ll explore the highlights of these implementations and how to both create and use storage in each form. We’ll give you guidance on choosing the right forms of storage for your application scenarios.
· Programming against table & blob storage
· Working with queue storage
· Scaling and configuration
· Understanding SQL Azure databases versus local SQL Server databases
Welcome back to session 2 of our 3 part presentation! In case you are just joining us, my name is <name> and we’re going to be talking about data storage options on the Windows Azure platform.
We’ll take a tour of SQL Azure as a data storage option and then we’ll look at the various types of data storage offered with Windows Azure… in particular, Blobs, Tables, and Queues. I will also make reference to additional materials regarding a new type of data storage that was recently added called Drives.We’ll also learn how to inspect the contents of Windows Azure Data Storage.
It’s my intention that when we have completed this session, you’ll have a good understanding of the various data storage options, and you’ll be able to make informed decisions about which types are best for a given storage requirement.
We’ll start with SQL Azure... This will give most of developers a common frame of reference as most developers are comfortable with relational databases.In a short while, I will introduce Blobs, Tables, Queues, and DrivesSQL Azure can be thought of as your SQL Server in the cloud. It is based on a subset of SQL Server 2008.Blobs are a means of storing unstructured data, such as pictures, movies, PDF’s, Word documents, and the like.Tables are a means of storing semi-structured or tabular data. Tables are similar to an Excel spreadsheet in the sense that data is tabular and there is no strict type cohesion as there would be in a SQL Server table column. Data stored in tables is partitioned and keyed for retrievalQueues are a means of buffered message delivery. There are very useful for communicating data between our Windows Azure service instances. As our service instances do not have to wait around for the I/O of delivering the message or the result of the message processing, they can dramatically improve the scalability of our software system.Drives are a recently added feature announced at the Los Angeles PDC in November 2009. Drives provide durable storage that appears to our application as an NTFS volume. The drive itself is an abstraction over the same Windows Azure Data Storage used for Blobs. You can get more information on Drives by visiting the PDC site on my slide.Applications may use multiple types of data storage at the same time. In fact, this is quite common. When we do our first Windows Azure Data Storage demo together, I will be showing you an application that uses Blobs, Tables, and Queues in concert.
As I stated earlier, SQL Azure is based on SQL Server 2008. At this time it is only a subset of the features of the server product.My intention here is to convey the high level features that are supported and the ones that are not.SQL Azure will support most of the things we need… Tables, Index, Views, Stored Procedures, Triggers, and Constraints… in my book… that’s all the functionality that I need for most of my applications.There are some other adjunct technologies that ship as part of SQL Server 2008 such as SQL Reporting Services and Analysis Services which are not supported. The Service Broker is also not supported.
The current offering of SQL Azure provides just core relational database services.In the future, Microsoft will be offering Data synchronization based on the Sync framework so that on premise and mobile databases can be synchronized with databases in the cloud.Business Intelligence and SQL Reporting will be available as an SaaS (Software as a Service)And some new services will be unveiled such as Reference Data and Secure Data Hub. These our outside the scope of this presentation though, so feel free to point your favorite search engine at these terms for more information.
So let’s assume that we have designed our relational database with local developer and data modeling tools.We can begin our story then by assuming that we want to get our database deployed to the cloud.There are some tools that will expedite this process which I will show you later, but for now lets assume that we have scripted our database schema. We apply this script to SQL Azure which speaks native TDS.If you created your database through the SQL Azure Portal, then SQL Azure will have created one master database and three replicas of that database. If you create your database with the script the same will be true.These replicas are stored in different database centers from the master to provide redundancy and protection against geographical catastrophe.
Configuring our application to use SQL Azure storage instead of SQL Server is simply a matter of modifying the connection string in our application’s configuration file.When our application requests data, ADO.NET speaks to the TDS which directs our queries to the master database server. The master database server performs our query and returns the results to our application.
From our application’s point of view, there is only one SQL Azure database.As we make updates to our database, those updates are replicated to other copies stored in other data centers so that in the event that our database fails for any reason, the other databases will be standing by ready to take its place.
But what if that master database server fails for some reason?TDS is receives notification of the database failure and automatically redirects the call to the replica!The Azure Cloud Fabric is self-healing… and the details are outside the scope of this presentation; however, the fabric will get busy repairing itself like drones on a Borg mother ship… essentially with the objective of keeping three replicas online at a time.
I will demonstrate creating a SQL Azure account in session 3 where I will walk you through the entire process.For now I simply want to give you some background information to prepare you for our first demonstration.When we create our SQL Azure database server, we’ll be prompted for an Administrator’s name and a password.This username and password will be the granted a system administrator role that is similar to the “sa” account on a local SQL Server 2008 box. The account has permission to create and drop databases and database ownership authority in any databases that you create with this account.
After creating your SQL Azure database server, you will want to grant appropriate access through the SQL Azure firewall.SQL Azure provides a very simple and easy to maintain firewall. The firewall is so easy to use that it’s only going to get one slide in my deck!The firewall allows us to expose our database to Windows Azure services via a checkbox and to add ranges of IP addresses such as your home office and your business… or possibly the address of a 3rd party server hosting some application that needs data access.I’ll do a thorough demo of this feature in session 3…
When you created your SQL Azure database server, you supplied an administrator’s user name and password. I have named my user accordingly… to remind me of its power.The SQL Portal will offer you the ability to copy these credentials in connection string format to your clip board… tempting you into believing that you should just paste this into your configuration file.This is terrific for demos like mine… BUT you should NEVER, EVER do this…A database server system administrator password placed in a configuration file in clear text format… there has got to be something naive in the extreme going on here… and worse… no way to create non-sa-like users through the UI… you must script your database users and then apply the script to the database. And to anticipate your question… no… you can’t use SQL Server Management Studio to do this either.I will demo this as well in session 3… so hang tight…
There are a number of techniques for getting data migrated from an existing database into a SQL Azure database.One very effective technique is to script the database schema and any stored procedures or views and then apply these scripts to the SQL Azure database. Once the schema has been deployed to the cloud, BCP can be used to copy the data in.Another effective technique is to utilize SQL Server Integration Service which will transfer the Schema and the Data.
I think that I saved the best for last here… The SQL Server Migration Wizard is available for download from the CodePlex website at the URL on this slide.To quote the website, “The SQL Azure Migration Wizard helps you migrate your local SQL Server 2005 / 2008 databases into SQL Azure. The wizard walks you through the selection of your SQL objects, creates SQL scripts suitable for SQL Azure, and allows you to migrate your data.”I will demonstrate this tool in session 3 when I use it to migrate an application and associated database from the local desktop to the cloud.
Although some things can be done with SQL Server 2008 Management Studio, I highly recommend that you use the 2008 R2 Nov CTP as it is SQL Azure aware.After you have created your system administrator account for SQL Azure, you can use SQL Server Management Studio R2 CTP to make connections to the database and execute scripts such as the one that I am showing in this slide.
Okay… That’s all about SQL Azure for now… we’ll come back to this topic in Session 3…Keep in mind that SQL Azure is a separate product from Windows Azure…. And that Windows Azure includes Windows Azure Data Storage, which we are going to talk about now. We will be using the Windows Azure Data Storage directly in demos, so these slides will provide more of a brief and high level overview.To get Windows Azure Data Storage setup, we simply create a new Storage Account from the Windows Azure Portal.
Our Windows Azure Data Storage will be accessible via RESTful queries at the endpoints you see on this slide, or via the API in the Windows Azure SDK library.We’ll be using the Windows Azure library in our demo.
Also provided on our data storage setup screen is the Account Name and a Primary and Secondary Access Key.Our Account name uniquely identifies our Data Storage locationThe Access Keys are a small chunk of encrypted data that prove our identity to Windows Azure Data Storage. We’ll use the Primary Access Key to access and update data stored in Data Storage.
It’s time now to introduce Windows Azure Data Storage Blobs.Blobs are for storage of unstructured data.We partition our data by creating Blob containers which we give names to.We can create an unlimited number of Blob Containers.We then simply place our blob data into the blob containers, supplying a unique identifier.When we want to retrieve our data, we simply provide the container and the unique identifier.
Windows Azure Data Storage Tables are how we get massively scalable and highly available databases.Although there are some similarities, these tables are very different from relational database tables.Data in Windows Azure Data Storage Tables is semi-structured; The concept of a Windows Azure Data Storage Table is similar to how a spreadsheet is used to provide tabularized organization to data without strongly enforcing data cohesion.… Data is indexed in Tables for high performance retrieval, but there are no relationships between Tables.The tables support ACID transactions over single entities and rich queries over the entire table.
The PartitionKey combined with the RowKey uniquely identifies an entity in a table.
We have included this feature comparison table in anticipation of your likely questions about differences between using a relational database table as you may be currently doing with your SQL Server databases and the new Windows Azure Tables included in Windows Azure.
Queues are a means of buffered message delivery. There are very useful for communicating data between our Windows Azure service instances.
Here is a list of resources that will allow you to follow up with us on any of the features you’ve seen today as well as become part of our development community!
Windows Azure DiagnosticsLogging and Monitoring in the Cloud
Windows Azure Platform Storage
Windows Azure Platform Data Storage<br />David Robinson<br />Senior Program Manager<br />Microsoft<br />firstname.lastname@example.org<br />
Agenda<br />Windows Azure Platform Data Storage Options<br />Getting Started with SQL Azure Data Storage<br />Getting Started with Windows Azure Data Storage <br />Blobs<br />Tables<br />Queues<br />Drives<br />Inspecting the contents of Windows Azure Data Storage<br />
Objectives<br />Learn the data storage options offered by the Windows Azure Platform and become familiar with choosing and using the appropriate one for your application<br />
Azure Platform Data Storage Options<br /><ul><li>SQL Azure
Durable NTFS volumes that Windows Azure applications can use. See: http://microsoftpdc.com/Sessions/SVC14</li></li></ul><li>SQL Azure Features<br />Supported<br />Tables, Indexes, Views<br />Stored Procedures<br />Triggers<br />Constraints<br />Table Variables<br />Temp Tables (#Name)<br />Not Supported<br />Physical Server Access <br />Catalog DDL<br />Common Language Runtime<br />Service Broker<br />Distributed Transactions and Queries<br />
SQL Azure<br />Initial Services<br />Database – Core SQL Server database capabilities <br />Future Services<br />Data Sync – Enables the sync framework<br />Additional SQL Server capabilities available as a service: Business Intelligence and Reporting<br />New services: Reference Data and Secure Data Hub<br />
Easy one-screen portal maintenance</li></li></ul><li>SQL Azure Database Connection String<br />An administrative user is created with the server<br />User has system administrator permissions likesa<br />Server=tcp:itte80vcfq.database.windows.net; Database=FabrikamAzureDB;User ID=davidrob;Password=myPassword;Trusted_Connection=False;Encrypt=True;<br />
Database Migrations<br />Scripts<br />Transfer Schema<br />BCP<br />Transfer Data<br />SSIS (SQL Server Integration Service)<br />Transfer Schema and Data<br />
Database Migrations (Cont.)<br />The SQL Azure Migration Wizard helps you migrate your local SQL Server 2005 / 2008 databases into SQL Azure. The wizard walks you through the selection of your SQL objects, creates SQL scripts suitable for SQL Azure, and allows you to migrate your data.”<br />http://sqlazuremw.codeplex.com/<br />
Database Management using SQL Management Studio<br />
Getting Started with Windows Azure Data Storage<br />
Account Name / Key<br />AccountName<br />A unique name identifying the Azure Data Storage<br />AccountKey<br />A blob of encrypted data used for authentication<br />
Windows Azure Data Storage - Blobs<br />Unstructured data storage<br />Partitioned by container<br />Unlimited containers<br />
Windows Azure Data Storage - Tables<br />Windows Azure Table provides scalable, available, and durable structured (or semi-structured) storage in the form of tables.<br />The tables contain entities, and the entities contain properties.<br />The tables are scalable to billions of entities and terabytes of data, and may be partitioned across thousands of servers.<br />The tables support ACID transactions over single entities and rich queries over the entire table.<br />Simple and familiar .NET and REST programming interfaces are provided via ADO.NET Data Services. <br />http://go.microsoft.com/fwlink/?LinkId=153401<br />
Windows Azure Data Storage – Tables (Terms Part 1)<br />Table – contains a set of entities. <br />Entity (Row) – Entities are the basic data items stored in a table. <br />Property (Column) – This represents a single value in an entity. <br />PartitionKey– The first key property of every table. The system uses this key to automatically distribute the table’s entities over many storage nodes.<br />
Windows Azure Data Storage – Tables (Terms Part 2)<br />RowKey– A second key property for the table. This is the unique ID of the entity within the partition it belongs to. <br />Timestamp – Every entity has a version maintained by the system.<br />Partition – A set of entities in a table with the same partition key value.<br />Sort Order – There is a single index provided for the CTP, where all entities in a table are sorted by PartitionKey and then RowKey<br />