Upload
eric-nelson
View
828
Download
1
Embed Size (px)
DESCRIPTION
Delivered on 29th March 2010
Citation preview
Page 1
Introduction to SQL Azure
Eric NelsonMicrosoft UKhttp://bit.ly/ericnel | http://twitter.com/ericnel | http://ukazure.ning.com
Page 2
Session Objectives
• SQL Azure vs Windows Azure Storage• Drill into SQL Azure• Leave feeling confident you know
when and how to build applications for SQL Azure
Page 3
New online communityhttp://ukazure.ning.com/
3
Page 4
Windows Azure Platform
Page 5
Windows Azure Platform
• Windows Azure – Your code and data
• SQL Azure Database – Your relational data
• AppFabric* – Your messages
Code Data RelationalData
Page 6
Windows Azure Platform for Application Developers
Software Development Kit
Code
Data
RelationalData
Portal
ApiApi
Page 7
Software Development Kit
Page 8
Your Service
Azure Application = WebRole + Worker Role + Storage
LB
Web Site(ASPX, ASMX,
WCF)
Web Site(ASPX, ASMX,
WCF)Web Role
(ASPX, WCF)
Worker Service
Worker Role
LB
SQL AzureSQL Azure
Internet
Page 9
Azure Storage
Page 10
Tables
Page 11
Windows Azure and SQL Azure
Azure Storage SQL Azure
Vision
Access
Relational? (today)
Relational? (tomorrow)
Analogy
Page 12
Windows Azure and SQL Azure
Azure Storage SQL Azure
Vision Highly scalable, highly available store in the Cloud
Access Uses ADO.NET Data Services - REST
Relational? (today)
No
Relational? (tomorrow)
No
Analogy
Page 13
Windows Azure and SQL Azure
Azure Storage SQL Azure
Vision Highly scalable, highly available store in the Cloud
Scalable, highly available relational store in the Cloud
Access Uses ADO.NET Data Services - REST
SqlClient + TSQL(Use Azure Web Role + ADO.NET Data Services if REST is required)
Relational? (today)
No Yes – but with some limitations
Relational? (tomorrow)
No Yes – with less and less limitations
Analogy
Page 14
Windows Azure and SQL Azure
Azure Storage SQL Azure
Vision Highly scalable, highly available store in the Cloud
Scalable, highly available relational store in the Cloud
Access Uses ADO.NET Data Services - REST
SqlClient + TSQL(Use Azure Web Role + ADO.NET Data Services if REST is required)
Relational? (today)
No Yes – but with some limitations
Relational? (tomorrow)
No Yes – with less and less limitations
Analogy File System RDBMS – as it is
Page 15
Windows Azure and SQL Azure
Azure Storage SQL Azure
Maximum Amount of data in a single “database”
Price per GB per month
Price to store 1KB per month
Page 16
Windows Azure and SQL Azure
Azure Storage SQL Azure
Maximum Amount of data in a single “database”
100TB 10GB (50GB this summer)
Price per GB per month
Price to store 1KB per month
Page 17
Windows Azure and SQL Azure
Azure Storage SQL Azure
Maximum Amount of data in a single “database”
100TB 10GB (50GB this summer)
Price per GB per month
£0.09 £6.06
Price to store 1KB per month
Page 18
Windows Azure and SQL Azure
Azure Storage SQL Azure
Maximum Amount of data in a single “database”
100TB 10GB (50GB this summer)
Price per GB per month
£0.09 £6.06 *
Price to store 1KB per month
£0.00 £6.06 *
Page 19
SQL Azure
Page 20
SQL Azure
+
Page 21
SQL Azure Application Architectures
T-SQL (TDS)
Application / ToolsApplication / Tools
SQL Azure access from outside
Code Far
SQL AzureSQL Azure
SOAP/RESTHTTP/S
SQL Azure access from within Datacenter
Windows Azure
T-SQL (TDS)
Web RoleWeb Role
ADO.NET Data Svcs/REST - EFHTTP/S
SQL AzureSQL Azure
Application/ BrowserApplication/ Browser
Code Near
Page 22
Demo
Page 23
Server: Network Access Control
• Each server defines a set of firewall rules– Determines access policy based on client
IP– By default, there is NO ACCESS to server
• Controlled using Firewall API (masterDB)– sys.firewall_rules,
sys.sp_merge_firewall_rule and sys.sp_delete_firewall_rule
Page 24
Server: Billing and Reporting
• Usage metrics from views:– sys.bandwidth_usage– sys.database_usage
• Bandwidth shows ingress/egress/type in KB
• Database shows number/type
Page 25
UK Pricing
• SQL Azure–Web Edition (1 GB) £6.06 per month – Business Edition (10 GB) £60.60 per
month
• Data Transfers into and out of the cloud– £0.06 per GB in – £0.09 per GB out
Page 26
Summary
• Understand you have SQL Azure and Windows Azure Storage
• Self-provisioning with automatic high-availability and fault tolerance
• Built on SQL Server foundation (T-SQL/TDS)• High compatibility at database scope
– Automatic physical data administration
• UK Site http://bit.ly/landazure• UK Community http://bit.ly/ukazure /
http://ukazure.ning.com
• My blog http://bit.ly/ericnel
Page 27
My SQL Azure screenshots
Page 28
Page 29
Page 30
Page 31
Page 32
Page 33
Page 34
Appendix
Page 35
Connection Management
• Applications connect directly to a database– No support for context switching (USE <db>)
• Connection may drop due to:– Network connectivity blips– Idle connection– Long running transactions (holding resources)– Throttling (taking too many resources)– Database failover activity– Firewall policy/rules
Page 36
Connection Policies
• Current policies– Idle connection if > 5 minutes– Long running transaction if > 5 minutes– Throttling policy determined by amount
of I/O load on the service at each node• Load balancing used to ensure ‘fairness’
across service
• Goal is to return actionable error– Only received if client is ‘pulling’ on
connection
Page 37
Tracing Connectivity Problems
• Each session assigned a unique ‘sessionId’– Tracks session state and service errors– Can help to uniquely identify root cause
• Retrievable from CONTEXT_INFO()• Save this with each connection• Helper class makes this simple and
accessible
Page 38
Connections: Retry on failure
• Buffer application from transient failures• What to do on failure?– Reconnect immediately (if idle or network
blip)– Back off (delay) after failure– Breakup workload (if it takes too long)
• What about repeated failures?– Increasing delay between retries ex: 5s,
10s, 30s, … – Check on service health (via. Portal)
Page 39
Connectivity: Network Latency
• Connections across Internet– high latency with lower reliability– Consider impact on coding patterns
• Can run in either ‘code near’ or ‘code far’– Only difference is latency tolerance
• SQL supports batching and pooling– Consider implications of many small
interactions vs. batching patterns