The
Table service component of the Windows Azure storage services (which
includes the BLOB service, Table service, and Queue service) is a very
simple, highly scalable, cost-effective solution that can be used to
store data. In many scenarios it can replace traditional SQL
Server–based designs.
Note
Like all other storage
services, the Table service is hosted within the Windows Azure data
centers, leveraging the web role infrastructure. Access to the service
is provided through an HTTP-based REST API.
The Table service provides
you with the ability to create very simple tables that you can use to
store serialized versions of your entities. Figure 1 shows how entities are stored in the Table service.
In figure 1
you can see that there are two tables (Products and ShoppingCart) in a
storage account (silverlightukstorage). The Products table could
represent the product list for the Hawaiian Shirt Shop website ,
and each entity stored in the Products table (Red Shirt, Blue Shirt,
and Blue Frilly Shirt) would represent different types of shirts.
It’s important to point out
that although the Table service offers the ability to store data in
tables, it’s an entity storage mechanism, not a relational database.
That means it doesn’t offer the sort of functionality that you may be
used to:
It can’t create foreign key relationships between tables.
It can’t perform server-side joins between tables.
It can’t create custom indexes on tables.
If
you do require relational database storage, you can look at SQL Azure,
which is a Windows Azure platform–hosted SQL Server database.
We’ve become a little conditioned to store data in a relational form, even when it’s not strictly necessary.
If you can expand your mind
and accept that there are other ways of storing data, you can use the
Table service to store your data in a highly scalable (and cheaper)
fashion.
As you’ll see later in this
book, many applications (including shopping carts, blogs, content
management systems, and so on) could potentially use the simple Table
service rather than a relational database.
|
Now that you know what the
Table service is and isn’t, it’s nearly time to look at how entities are
stored in the Table service. But before we do that, let’s take a look
at how we’d normally represent data in non-Windows Azure environments.