Introducción a conceptos de SQL Server Secure Enclaves
Tablas y almacenamiento en windows azure
1. Ing. Eduardo Castro, PhD
Comunidad Windows
ecastro@grupoasesor.net
http://ecastrom.blogspot.com
2. 1. Overview of Windows Azure Tables
2. Patterns and Practices for Windows Azure
Tables
3. Overview of Windows Azure Queues
4. Patterns and Practices for Windows Azure
Queues
5. Q&A
2
3. Tables – Provide structured storage. A TableProvide structured storage. A Table
is a set of entities, which contain a set ofis a set of entities, which contain a set of
propertiesproperties
Queues – Provide reliable storage and delivery of
messages for an application
Blobs – Provide a simple interface for storing
named files along with metadata for the file
Drives – Provides durable NTFS volumes for
Windows Azure applications to use (new)
3
4. Provides Structured Storage
Massively Scalable Tables
Billions of entities (rows) and TBs of data
Can use thousands of servers as traffic grows
Highly Available & Durable
Data is replicated several times
Familiar and Easy to use API
ADO.NET Data Services – .NET 3.5 SP1
.NET classes and LINQ
REST – with any platform or language
4
5. Email =…
Name = …
Email =…
Name = …
Genre =…
Title = …
Genre =…
Title = …
5
6. Table
A storage account can create many tables
Table name is scoped by account
Set of entities (i.e. rows)
Entity
Set of properties (columns)
Required properties
PartitionKey, RowKey and Timestamp
6
7. PartitionKey & RowKey
Uniquely identifies an entity
Defines the sort order
Use them to scale your application
Timestamp
Read only
Optimistic Concurrency
7
8. PartitionKey
Used to group entities in the table into
partitions
A table partition
All entities with same partition key value
Unit of scale
Control entity locality
Row key provides uniqueness within a partition
8
9. PartitionKey
(Category)
RowKey
(Title)
Timestamp ReleaseDat
e
Action Fast & Furious … 2009
Action The Bourne Ultimatum … 2007
… … … …
Animation Open Season 2 … 2009
Animation The Ant Bully … 2006
PartitionKey
(Category)
RowKey
(Title)
Timestamp ReleaseDat
e
Comedy Office Space … 1999
… … … …
SciFi X-Men Origins:
Wolverine
… 2009
… … … …
War Defiance … 2008
PartitionKey
(Category)
RowKey
(Title)
Timestamp ReleaseDat
e
Action Fast & Furious … 2009
Action The Bourne Ultimatum … 2007
… … … …
Animation Open Season 2 … 2009
Animation The Ant Bully … 2006
… … … …
Comedy Office Space … 1999
… … … …
SciFi X-Men Origins:
Wolverine
… 2009
… … … …
War Defiance … 2008
9
11. Define the schema as a .NET class
11
[DataServiceKey("PartitionKey", "RowKey")]
public class Movie
{
/// <summary>
/// Category is the partition key
/// </summary>
public string PartitionKey { get; set; }
/// <summary>
/// Title is the row key
/// </summary>
public string RowKey { get; set; }
public DateTime Timestamp { get; set; }
public int ReleaseYear { get; set; }
public string Language { get; set; }
public string Cast { get; set; }
}
12. 12
StorageCredentialsAccountAndKey credentials = new StorageCredentialsAccountAndKey(
“myaccount", “myKey");
string baseUri = "http://myaccount.table.core.windows.net";
CloudTableClient tableClient = new CloudTableClient(baseUri, credentials);
tableClient.CreateTable(“Movies");
TableServiceContext context = tableClient.GetDataServiceContext();
CloudTableQuery<Movie> q = (from movie in context.CreateQuery<Movie>(“Movies")
where movie.PartitionKey == “Action" && movie.RowKey == "The Bourne Ultimatum"
select movie).AsTableServiceQuery<Movie>();
Movie movieToUpdate = q.FirstOrDefault();
// Update movie
context.UpdateObject(movieToUpdate);
context.SaveChangesWithRetries();
// Add movie
context.AddObject(new Movie(“Action" , movieToAdd));
context.SaveChangesWithRetries();
13. 1. Overview of Windows Azure Tables
2. Patterns and Practices for Windows Azure
Tables
3. Overview of Windows Azure Queues
4. Patterns and Practices for Windows Azure
Queues
5. Q & A
13
17. PartitionKey
(Account name)
RowKey
(Title)
Category …
moviesonline 12 Rounds Action …
moviesonline A Bug’s Life Animation …
100,000,000 more rows … … …
moviesonline Office Space Comedy …
moviesonline Platoon War …
50,000,000 more rows … … …
moviesonline WALL-E Animation …
ClientClientClientClient
17
18. PartitionKey
(Category)
RowKey (Title)
Action Fast & Furious
… 10000 more Action movies
Action The Bourne Ultimatum
… 100000 more Action & Animation movies
Animation Open Season 2
… 100000 more Animation movies
Animation The Ant Bully
Comedy Office Space
… 1000000 more Comedy & SciFi movies
SciFi Star Trek
… 100000 more SciFi & War movies
… 100000 more War movies
War Defiance
ClientClientClientClient
18
PartitionKey
(Category)
RowKey
(Title)
Action Fast & Furious
… 10000 more Action movies
Action The Bourne Ultimatum
… 100000 more Action & Animation movies
Animation Open Season 2
… 100000 more Animation movies
Animation The Ant Bully
Comedy Office Space
… 1000000 more Comedy & SciFi movies
SciFi Star Trek
… 100000 more SciFi & War movies
… 100000 more War movies
War Defiance
23. PartitionKey
(Category)
RowKey (Title)
Action Fast & Furious
… 10000 more Action movies
Action The Bourne Ultimatum
… 100000 more Action & Animation movies
Animation Open Season 2
… 100000 more Animation movies
Animation The Ant Bully
Comedy Office Space
… 1000000 more Comedy & SciFi movies
SciFi Star Trek
… 100000 more SciFi & War movies
… 100000 more War movies
War Defiance
ClientClient
23
24. ClientClient
PartitionKey
(Category)
RowKey
(Title)
Rating
Action Fast & Furious 5
… 999 more movies rated > 4 …
… Action and Anim. movies here with
rating < 4
…
Animation A Bug’s life 2
… 100 more movies < 4 here …
Animation The Ant Bully 3
Comedy Are we there yet? 2
… More movies here …
Comedy Office Space 5
… 800000 more movies here …
Drama A Beautiful Mind 5
… 1200000 more movies here …
War Defiance 4
24
Returns 1000 movies
Partition range boundary hit
Return continuation
25. ClientClient
PartitionKey
(Category)
RowKey
(Title)
Rating
Action Fast & Furious 5
… More movies here …
Comedy Office Space 5
… More movies here …
Documentary Planet Earth 4
… More movies here
Drama Seven Pounds 4
Horror Saw 5 3
… More movies here …
Music 8 Mile 2
… More movies here …
SciFi Star Trek 5
… More movies here …
25
33. 1. Overview of Windows Azure Tables
2. Patterns and Practices for Windows Azure
Tables
3. Overview of Windows Azure Queues
4. Patterns and Practices for Windows Azure
Queues
5. Q & A
33
34. Queue are performance efficient, highly
available and provide reliable message
delivery
Simple, asynchronous work dispatch
Programming semantics ensure that a
message can be processed at least once
Access is provided via REST
34
36. An account can create many queues
Queue Name is scoped by the account
A Queue contains messages
No limit on number of messages stored in a queue
Set a limit for message expiration
Messages
Message size <= 8 KB
To store larger data, store data in blob/entity storage,
and the blob/entity name in the message
Message now has dequeue count
36
38. 38
CloudQueueClient queueClient = new CloudQueueClient(baseUri, credentials);
CloudQueue queue = queueClient.GetQueueReference("test1");
queue.CreateIfNotExist();
//MessageCount is populated via FetchAttributes
queue.FetchAttributes();
CloudQueueMessage message = new CloudQueueMessage("Some content");
queue.AddMessage(message);
message = queue.GetMessage(TimeSpan.FromMinutes(10) /*visibility timeout*/);
//Process the message here …
queue.DeleteMessage(message);
39. 1. Overview of Windows Azure Tables
2. Patterns and Practices for Windows Azure
Tables
3. Overview of Windows Azure Queues
4. Patterns and Practices for Windows Azure
Queues
5. Q & A
39