www.microsoftsrb.rs

Download Report

Transcript www.microsoftsrb.rs

On-Premises
Servers
• Bring your own
machines, connectivity,
software, etc.
• Complete control
• Complete responsibility
• Static capabilities
• Upfront capital costs for
the infrastructure
Hosted
Servers
• Renting machines,
connectivity, software
• Less control
• Fewer responsibilities
• Lower capital costs
• More flexible
• Pay for fixed capacity,
even if idle
Cloud
Platform
• Shared, multi-tenant
infrastructure
• Virtualized & dynamic
• Scalable & available
• Abstracted from the
infrastructure
• Higher-level services
• Pay as you go
Period
Usage
Average
Compute
Compute
Inactivity
Time
Time
Compute
Compute
Time
Average
Usage
Average
Usage
Average
Usage
Time
Fabric
Controller
Compute
Developer SDK
• Windows Azure SDK
– Local compute environment & Mock Storage
Compute
Storage
– Command
line tools
– Small Managed API
• Logging, working storage
• Microsoft Visual Studio 2008/10 add-in
The Portal and Dev Environment
− Blobs
− Drives
− Tables – Provide structured storage. A Table is a
set of entities, which contain a set of properties
− Queues
http://<account>.blob.core.windows.net/<container>/<blobname>
Account
Container
Blob
PIC01.JPG
images
PIC02.JPG
cohowinery
videos
VID1.AVI
Blob Storage
StorageCredentialsAccountAndKey credentials =
new StorageCredentialsAccountAndKey(accountName, key);
string baseUri = string.Format("http://{0}.blob.core.windows.net", accountName);
CloudBlobClient blobClient = new CloudBlobClient(baseUri, credentials);
// Create Container
CloudBlobContainer cloudContainer = blobClient.GetContainerReference(containerName);
bool hasCreated = cloudContainer.CreateIfNotExist();
// Access Blob in the Container
CloudBlob cloudBlob = cloudContainer.GetBlobReference(blobName);
//BlobRequestOptions has retry policy, timeout etc.
BlobRequestOptions options = new BlobRequestOptions();
//Upload the local file to Blob service
cloudBlob.UploadFile(uploadFileName, options);
//Download to local file name
cloudBlob.DownloadToFile(downloadFileName, options);
ServicePointManager::DefaultConnectionLimit
blocks
pages
− Blobs
− Drives – Provides durable NTFS volumes for
Windows Azure applications to use
− Tables – Provide structured storage. A Table is a
set of entities, which contain a set of properties
− Queues
Windows Azure
>
>
>
>
>
CloudStorageAccount account =
CloudStorageAccount.FromConfigurationSetting("CloudStorageAccount");
//Initialize the local cache for drives mounted by this role instance
CloudDrive.InitializeCache(localCacheDir, cacheSizeInMB);
//Create a cloud drive (PageBlob)
CloudDrive drive = account.CreateCloudDrive(pageBlobUri);
drive.Create(1000 /* sizeInMB */);
//Mount the network attached drive on the local file system
string pathOnLocalFS = drive.Mount(cacheSizeInMB, DriveMountOptions.None);
//Use NTFS APIs to Read/Write files to drive
…
//Snapshot drive while mounted to create backups
Uri snapshotUri = drive.Snapshot();
//Unmount the drive
drive.Unmount();
− Blobs
− Drives
− Tables – Provide structured storage. A Table is
a set of entities, which contain a set of
properties
− Queues
Account
Table
Entity
Name =…
Email = …
customers
Name =…
Email = …
cohowinery
Photo ID =…
Date =…
winephotos
Photo ID =…
Date =…
PartitionKey
PartitionKey
(Category)
(Category)
RowKey
RowKey
(Title)
(Title)
Timestamp
Timestamp
ReleaseDate
ReleaseDate
Action
Fast
Fast &
& Furious
Furious
…
…
2009
2009
Action
…
…
The Bourne Ultimatum
…
2007
…
…
…
…
…
…
Animation
Animation
Animation
Animation
Open Season 2
Open Season 2
The Ant Bully
The Ant Bully
…
…
…
…
2009
2009
2006
2006
PartitionKey
Comedy
(Category)
Office Space
RowKey
(Title)
…
Office Space
…Timestamp
1999
ReleaseDate
…
…
…
1999
……
2009
…
SciFi
…
X-Men Origins:
…
Wolverine
X-Men Origins:
…
Wolverine
…
…
2009
…
…
War
…
Defiance
……
…
2008
War
Defiance
…
2008
…
Comedy
SciFi
…
[DataServiceKey("PartitionKey", "RowKey")]
public class Movie
{
/// Movie Category is the partition key
public string PartitionKey { get; set; }
/// Movie Title is the row key
public string RowKey { get; set; }
public DateTime Timestamp { get; set; }
}
public int ReleaseYear { get; set; }
public double Rating { get; set; }
public string Language { get; set; }
public bool Favorite { get; set; }
string baseUri = string.Format("http://{0}.table.core.windows.net", accountName);
CloudTableClient tableClient = new CloudTableClient(baseUri, credentials);
// Create Movie Table
string tableName = “Movies“;
tableClient.CreateTableIfNotExist(tableName);
TableServiceContext context = tableClient.GetDataServiceContext();
// Add movie
context.AddObject(tableName, new Movie("Action", “White Water Rapids Survival"));
context.SaveChangesWithRetries();
// Query movie
var q = (from movie in context.CreateQuery<Movie>(tableName)
where movie.PartitionKey == "Action" && movie.Rating > 4.0
select movie).AsTableServiceQuery<Movie>();
foreach (Movie movieToUpdate in q)
{
movieToUpdate.Favorite = true;
context.UpdateObject(movieToUpdate);
}
context.SaveChangesWithRetries( SaveChangesOptions.Batch );
− Blobs
− Drives
− Tables – Provide structured storage. A Table is a
set of entities, which contain a set of properties
− Queues – Provide reliable storage and delivery
of messages for an application
Account
cohowinery
Queue
order
processing
Message
customer ID
order ID
http://…
customer ID
order ID
http://…
Input Queue (Work Items)
Azure Queue
Input Queue (Work Items)
Azure Queue
string baseUri = string.Format("http://{0}.queue.core.windows.net", accountName);
CloudQueueClient queueClient = new CloudQueueClient(baseUri, credentials);
//Create Queue
CloudQueue queue = queueClient.GetQueueReference(queueName);
queue.CreateIfNotExist();
//Add Message
CloudQueueMessage message = new CloudQueueMessage(“some content");
queue.AddMessage(message);
//Get Message
message = queue.GetMessage(TimeSpan.FromMinutes(3) /*Invisibility timeout*/);
// Process Message within the Invisibility Timeout
//Delete Message
queue.DeleteMessage(message);
DequeueCount
−
−
−
−
Blobs
Drives
Tables
Queues
http://www.microsoft.com/windowsazure/
4 Microsoft Confidential
5
Change the Rules
TDS
Database
Database
Database
SQL Azure Database
An illustration
SQL Azure Database
Others (Future)
Information Service
What do you mean?
−Commercial & trusted public domain
−Relational, blob, web services
5 Microsoft Confidential
3