sql azure eric nelson application architect, microsoft //bit.ly/ericnelson |

41
SQL AZURE Eric Nelson Application Architect, Microsoft http://bit.ly/ericnelson | http://twitter.com/ericnel [email protected]

Upload: luca-passey

Post on 01-Apr-2015

216 views

Category:

Documents


2 download

TRANSCRIPT

Page 1: SQL AZURE Eric Nelson Application Architect, Microsoft //bit.ly/ericnelson |

SQL AZUREEric NelsonApplication Architect, Microsoft http://bit.ly/ericnelson | http://twitter.com/ericnel [email protected]

Page 2: SQL AZURE Eric Nelson Application Architect, Microsoft //bit.ly/ericnelson |

SQL AZUREExtending SQL Server to the Cloud

SQL Azure DatabaseFamiliar SQL Server relational database modelSupport for existing APIs & toolsBuilt for the cloud with high availability & fault toleranceEasily provision and manage databases across multiple datacenters

Data Sync Service (CTP)Provides two-way sync of SQL Azure Databases across datacentersExample service available in the SQL Azure Labs environment

SQL Azure Reporting (CTP)Reporting Services running on the Windows Azure Platform

Database Sync Service Reporting

Page 3: SQL AZURE Eric Nelson Application Architect, Microsoft //bit.ly/ericnelson |

SQL AZURE DATABASE

Page 4: SQL AZURE Eric Nelson Application Architect, Microsoft //bit.ly/ericnelson |

SQL AZURE DATABASE SERVICE

• SQL Azure provides logical SQL Server• Looks like SQL Server to TDS Client• Actual data stored on multiple backend data nodes

• Logical optimisations supported• Indexes, Query plans etc..

• Physical optimisations not supported• File Groups, Partitions etc…

• Transparently manages physical storage

Page 5: SQL AZURE Eric Nelson Application Architect, Microsoft //bit.ly/ericnelson |

WORKING WITH SQL AZURE DATABASES

SQL AzureTDS

Your App

Change Connection String

Page 6: SQL AZURE Eric Nelson Application Architect, Microsoft //bit.ly/ericnelson |

BEHIND THE SCENES OF SQL AZURE

Application

Internet

LBTDS (tcp)

TDS (tcp)

TDS (tcp)

Apps use standard SQL client libraries: ODBC, ADO.Net, PHP, …

Load balancer forwards ‘sticky’ sessions to TDS protocol tier

Security Boundary

Gateway Gateway Gateway Gateway Gateway Gateway

Scalability and Availability: Fabric, Failover, Replication, and Load balancing

SQL SQL SQL SQL SQLSQL

Gateway: TDS protocol gateway, enforces AUTHN/AUTHZ policy; proxy to backend SQL

Page 7: SQL AZURE Eric Nelson Application Architect, Microsoft //bit.ly/ericnelson |

APPLICATION TOPOLOGIES

From Windows Azure

From Outside Microsoft Datacenter

From Windows Azure & Outside Microsoft Datacenter

Application / Browser

Windows Azure

SQL Azure

Code Near

App Code / Tools

SQL Azure

MicrosoftDatacent

er

Code Far Hybrid

Microsoft Datacenter

SQL Azure

SQL Serve

r

Microsoft Datacenter Windows

Azure

SQL Azure Data Sync

App Code / Tools

Page 8: SQL AZURE Eric Nelson Application Architect, Microsoft //bit.ly/ericnelson |

DEMO

Page 9: SQL AZURE Eric Nelson Application Architect, Microsoft //bit.ly/ericnelson |

CONNECTING TO SQL AZURE

• SQL Azure connection strings follow normal SQL syntax• Applications connect directly to a database

• “Initial Catalog = <db>” in connection string• No support for context switching (no USE <db>)

• Encryption security• Set Encrypt = True, only SSL connections are supported• TrustServerCertificate = False, avoid Man-In-The-Middle-Attack!

• Format of username for authentication:• ADO.Net:

Data Source=server.database.windows.net;User ID=user@server;Password=password;...

• Setup your firewall rules first!

Page 10: SQL AZURE Eric Nelson Application Architect, Microsoft //bit.ly/ericnelson |

SQL AZURE COMPATIBILITY

Currently Supported

• Tables, indexes and views

• Stored Procedures• Triggers• Constraints• Table variables,

session temp tables (#t)

• Spatial types

Not Currently Supported

• Data Types• XML,

HierarchyId, Sparse Columns, Filestream

• Partitions• Full-text indexes• SQL-CLR

Tables require clustered indexes

Page 11: SQL AZURE Eric Nelson Application Architect, Microsoft //bit.ly/ericnelson |

DATABASE EDITIONS

• You specify Web or Business Edition• Web: EDITION = web• Business: EDITION = business

• You specify MAXSIZE• Web: MAXSIZE = 1GB | 5GB• Business: MAXSIZE = 10GB | 20GB | 30GB | 40GB | 50GB

• This is the maximum size we will not let you grow beyond• You will only be charged for the actual peak size in any one day

rounded up• For example, a 3.4 GB Web Edition will be charged 5GB rate.

• CREATE DATABASE foo1 (EDITION='business', MAXSIZE=50GB);• CREATE DATABASE foo2 (EDITION='business', MAXSIZE=30GB);• ALTER DATABASE foo2 MODIFY (EDITION='web', MAXSIZE=5GB);

Up to 50 GB10 GB increment

s

Business Edition

1 GB or 5 GBWeb Edition

Page 12: SQL AZURE Eric Nelson Application Architect, Microsoft //bit.ly/ericnelson |

DATABASE EDITIONS

• Two SQL Azure Database SKUs: Web & Business• Web Edition:

• 1 GB @ £6.055/month • 5 GB @ £30.275/month

• Business Edition: • 10 GB @ £60.604 • 20 GB @ £121.208 • 30 GB @ £131.812 • 40 GB @ £242.416• 50 GB @ £303.20

Up to 50 GB10 GB increment

s

Business Edition

1 GB or 5 GBWeb Edition

Page 13: SQL AZURE Eric Nelson Application Architect, Microsoft //bit.ly/ericnelson |

DEMO

Page 14: SQL AZURE Eric Nelson Application Architect, Microsoft //bit.ly/ericnelson |

SQL AZURE DATA SYNC

Page 15: SQL AZURE Eric Nelson Application Architect, Microsoft //bit.ly/ericnelson |

SQL AZURE DATA SYNC

• Powers movement of data• Cloud cloud• On-premises cloud

• Getting data where you need it• Sync SQL Azure

instances• Sync SQL Server to SQL

Azure• Sync offline apps to SQL

Azure• Enable geo-replication of

data

Sync

SQL Azur

e

Page 16: SQL AZURE Eric Nelson Application Architect, Microsoft //bit.ly/ericnelson |

SQL AZURE DATA SYNC – ROADMAP

On-Premises (Headquarters)

Syn

c

Sync

Remote OfficesData Sync Service For SQL Azure

Retail Stores

Sync Sync

Sync

SQL Azure

Database

Sync Sync CTP1

CTP2

Page 17: SQL AZURE Eric Nelson Application Architect, Microsoft //bit.ly/ericnelson |

TOP FEATURES

• Service scales as resources requirements grow• No-Code Sync Configuration• Schedule Sync• Conflict Handling• Logging and Monitoring• Data sub-setting

Page 18: SQL AZURE Eric Nelson Application Architect, Microsoft //bit.ly/ericnelson |

DEMO

Page 19: SQL AZURE Eric Nelson Application Architect, Microsoft //bit.ly/ericnelson |

SQL AZURE REPORTING

Page 20: SQL AZURE Eric Nelson Application Architect, Microsoft //bit.ly/ericnelson |

SQL AZURE REPORTING

• CTP – you can register • Based on SQL Server Reporting Services 2008 R2

• Exactly same report formats (no custom extensions yet)• Use BI Development Studio

• Reports run on Windows Azure Platform• Report Viewer control using remote processing mode

• Only reports against SQL Azure Database

Page 21: SQL AZURE Eric Nelson Application Architect, Microsoft //bit.ly/ericnelson |

SUMMARY

• SQL Azure Database: hassle free fault tolerance with little to learn

• SQL Azure Data Sync: Helping build geographically disperse or hybrid applications

• SQL Azure Reporting: Reporting Services in the Cloud

Page 22: SQL AZURE Eric Nelson Application Architect, Microsoft //bit.ly/ericnelson |

APPENDIX

Page 23: SQL AZURE Eric Nelson Application Architect, Microsoft //bit.ly/ericnelson |

LATENCY AND TIMEOUTS

Page 24: SQL AZURE Eric Nelson Application Architect, Microsoft //bit.ly/ericnelson |

LATENCY

Service

Request

App Data

App

Consistent and accepted latencies

On premises application

Files

Service

Request

App DataLatenc

yApp

Increases in quantity and variability of latencies

Cloud based application

Latency Blob

TIP: Expect Web Role to SQL Azure to take about twice as long

Page 25: SQL AZURE Eric Nelson Application Architect, Microsoft //bit.ly/ericnelson |

TIMEOUT

Service

Request

App Data

Timeouts?App

Increased likelihood of timeouts

Cloud based application

Service Reques

tApp Data

App

Consistent, reliable connectivity and access

On premises application

Yes

No

Yes

NoTried 5 times?

Connection

Successful?

Try to connect

Continue doing work

Fail

Page 26: SQL AZURE Eric Nelson Application Architect, Microsoft //bit.ly/ericnelson |

TIMEOUT RETRY CODE EXAMPLE

Page 27: SQL AZURE Eric Nelson Application Architect, Microsoft //bit.ly/ericnelson |

TIMEOUT RETRY CODE EXAMPLE

Page 28: SQL AZURE Eric Nelson Application Architect, Microsoft //bit.ly/ericnelson |

TIMEOUT RETRY CODE EXAMPLE

TIP: There is a new code library for all this!

Page 29: SQL AZURE Eric Nelson Application Architect, Microsoft //bit.ly/ericnelson |

DATA SENSITIVITY

Page 30: SQL AZURE Eric Nelson Application Architect, Microsoft //bit.ly/ericnelson |

Purchasing Database

Product catalogue

Secure Transaction(Service Bus)

Segmentation

Online Shop

Online Shop

Product catalogue

Page 31: SQL AZURE Eric Nelson Application Architect, Microsoft //bit.ly/ericnelson |

Contact ID

Social Security #

Customer Credit Card #

Other Information

Shipping Information

Last Name

First Name

Contact ID

On Premises

Cloud

Sharding

Customer Credit Card #

Shipping Information

Last Name

First Name

Contact ID

Social Security #

Billing Data

Other Information

On Premises

Page 32: SQL AZURE Eric Nelson Application Architect, Microsoft //bit.ly/ericnelson |

Customer Credit Card #

Shipping Information

Last Name

First Name

Contact ID

Social Security #

Billing Data

Other Information

On Premises

£!”$&$%!&£%

£”$&!%*^(&

!£$&!%£&%*

^$”$&%$”&

Shipping Information

Last Name

First Name

Contact ID

On Premises

Cloud

Encryption

Page 33: SQL AZURE Eric Nelson Application Architect, Microsoft //bit.ly/ericnelson |

DATA CHOICES

Page 34: SQL AZURE Eric Nelson Application Architect, Microsoft //bit.ly/ericnelson |

YOU HAVE MANY CHOICES FOR DATA

Relational Database

Structured Storage

Unstructured Storage

NTFS Drive

Service Communication

SQL Azure

Azure Table

Azure Blob

Azure Queue

Azure Drive

Page 35: SQL AZURE Eric Nelson Application Architect, Microsoft //bit.ly/ericnelson |

SIDE BY SIDE EVALUATION

 Single Blob Drive Queue Table

Single SQL Azure

DatabaseStructured Data Y Y

Relational Database Y

Server Side Processing YDirect Access from outside Azure Y Y Y Y

Messaging Infrastructure Y

Persistent Storage Y Y 1 week Y Y

Size Limit 200 GB/ 1 TB 1 TB 100 TB 100 TB 50 GB (*)

(*) Scale out across multiple databases using partitioning for better scalability and performance

Page 36: SQL AZURE Eric Nelson Application Architect, Microsoft //bit.ly/ericnelson |

AZURE TABLE AND SQL AZURE TABLE

Feature Azure Table SQL Azure Table

Partitioning & Scale

Implicit based on Partition Key Explicitly managed by the Application (Sharding – future feature)

Index Capabilities

Table indexed on Partition Key + Row Key0 Secondary Indexes

1 Clustered Index on any column999 Secondary Indexes

Table Limits

Row Size – 1 MBColumn Limit – 255Table Limit – 100TB

Row Size – 8MBColumn Limit – 1024Table Limit - ~50GB

Transactions

Transactions on entities within partitionNo Transactions across tables or partitionsUp to 100 operations in a TransactionPayload upto 4MB per Transaction

Fully compatible transactional semantics with SQL Server.

No cross Database transactions

Consistency Model Transactionally Consistent Transactionally Consistent

Concurrency

Single Optimistic Concurrency Strategy

Full range of isolation and concurrency models as supported by RDBMS

Page 37: SQL AZURE Eric Nelson Application Architect, Microsoft //bit.ly/ericnelson |

AZURE TABLE AND SQL AZURE TABLE

Feature Azure Table SQL Azure

Data Access REST API, ADO .NET, Client Library SDK

Standard tools and APIs applySSMS, Visual Studio, ADO .NET, ODBC

Column Types Basic Types Usual SQL Server Data Types

Portability

Data portability coming with Windows Azure Appliance

Data in SQL Azure similar to SQL Server- Easy migration in and out of

the cloud- Use multi stream transfer to

mitigate network latency.

Queries

Upto 1000 entities [token pagination]Beyond 5 sec – return continuation token

Queries by partition & row key are fast

No Custom Indexes Today Non key queries are scans

Query capabilities as per standard SQL Server database expectations

Offer Server Side Processing through Stored Procedures and Complex Queries

(Aggregation, Joins, Sorts, Filters, etc.)

Page 38: SQL AZURE Eric Nelson Application Architect, Microsoft //bit.ly/ericnelson |

EXAMPLE: REGISTRY/CONFIGURATION/USER SETTINGS

A traditional set of data that is traditionally stored on the local environment is configuration and user settings. Commonly this is stored in the registry, xml or ini files.

Options Best Case Usage

Blob storage Configuration file that is read only once during app load

SQL database Used in environments where a SQL database already exists

Windows Azure table User settings that may be changed externally from the environment

Page 39: SQL AZURE Eric Nelson Application Architect, Microsoft //bit.ly/ericnelson |

REPORTING

Page 40: SQL AZURE Eric Nelson Application Architect, Microsoft //bit.ly/ericnelson |

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

ID Name Start IP End IP Create Modify

1 Office 12.1.2.0

12.1.2.255

2009-09-18 …

2009-09-18 …

2 Home 12.2.2.5

12.2.2.5 2009-09-20 …

2009-09-21 …

Page 41: SQL AZURE Eric Nelson Application Architect, Microsoft //bit.ly/ericnelson |

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

Time Database

Direction Class Time_period Quantity

2009-09-17 19:00

TPCH Egress Internal

Peak 55598

2009-09-17 19:00

TPCH Ingress Internal

Peak 76026

… … … … … …