chapter 7 optimizing the scalability and performance …
TRANSCRIPT
CONTENTS¢:Assigning Primary Key Values to Entities, ¢Handling Associated Entities, ¢Taking Advantage of Entity¢Group Transactions,¢ Uploading the table data, ¢ Uploading the table data, ¢Displaying the Data from Heterogeneous
Tables in Grids.
2
ASSIGNING PRIMARY KEY VALUES TO ENTITIES
¢ SQL Azure Database (SADB) offers most of the relationaldatabase management features of SQL Server 2008Enterprise, but Azure Tables come to the fore whenscalability is the criterion.
¢ Azure tables’ composite primary key, which consists of concatenated Partition Key and Row Key property
¢ It provides a unique entity ID, also called an object ID, to identify and sort entities within an Azure table.
¢ Partition Key values identify table partitions for load balancing across storage nodes.
¢ Azure stores entities with the same PartitionKey value in a single location
3
¢ Entities in a table having the same Partition Key value are saidto be in a locality, a locality has no partition.
¢ If a table contains multiple entities with the same PartitionKey value, unique RowKey values are required to provide aunique entity ID; otherwise, RowKey values can be emptystringsstrings
4
CHOOSING PARTITION KEYS
¢ Partition Key values can be strings having a Length property value of 0KB to 32KB and cannot contain any of the following characters:
¢❑ Forward slash (/)
¢❑ Backslash (\)
¢❑ Number sign (#)¢❑ Number sign (#)
¢❑ Question mark (?)
5
ADDING ROW KEYS
¢ Multiple child entities, such as OrderDetails, can occur for a single parent entity ID value (OrderID), so they require RowKey values to maintain uniqueness.
7
TAKING ADVANTAGE OF ENTITY GROUP
TRANSACTIONS
¢ Early Azure Table versions provided support for ACID(atomic, consistent, isolated, and durable)
transactions for single entity types with a commonPartitionKey only.
¢ More recent table versions support Entity-GroupTransactions (EGTs).
¢ EGTs support ACID transactions for create, update, anddelete operations on batches of parent and child entities withthe same PartitionKey value 8
RULES FOR PERFORMING ENTITY GROUP
TRANSACTIONS
¢ The transaction can include at most 100 entities, and its total payload may be no more than 4 MB in size.
¢ The Table Service doesn’t support linking operations in a change set.
¢ An entity can appear only once in the transaction, and ¢ An entity can appear only once in the transaction, and only one operation may be performed against it.
¢ All entities subject to operations as part of the transaction must have the same PartitionKey value.
¢ A single batch supports multiple Insert Entity, Update Entity, Merge Entity, and Delete Entity operations, which may occur in any order
9
UPLOADING TABLE DATA
¢ Azure Tables support a simplified version of the ADO.NET Data Services
¢ Supports client API for create, retrieve, update, and delete (CRUD) operations by means of the Client Services library.
¢ The create operation with the POST method returns a confirmation of the data inserted
10
COMPARING PERFORMANCE OF HOMOGENEOUS
AND HETEROGENEOUS TABLE OPERATIONS
¢ The following table compares the time in seconds to upload and delete 100 OrderType entities
11
DISPLAYING PARENT AND ENTITIES
¢ The Data uploads, downloading data from heterogeneoustables requires only a minor change to the LINQ to RESTquery to filter out unwanted entities
¢ The Parent can be displayed on The upper part of Data Grid¢ The Parent can be displayed on The upper part of Data GridView while child can be displayed on The lower part of DataGrid View
¢ In above table Order type is parent entity While quantities
are child entities.
12
¢ The homogeneous table scan covers only 30 percent of the entities of the heterogeneous table. So they are faster than heterogeneous table
14