Windows Azure SQL Database and SQL Reporting for Developers Dr Greg Low Principal Mentor – SQL...

Post on 27-Dec-2015

227 views 5 download

transcript

Windows Azure SQL Database and SQL Reporting for DevelopersDr Greg LowPrincipal Mentor – SQL Down Under

AZR221

Who is Greg?

CEO and Principal MentorMicrosoft RD and MVP for SQL ServerPASS Regional MentorAuthor (books and whitepapers)

Agenda

Working with Windows Azure SQL

Database

Scaling out using Federations

Scaling out using Data Sync

Reporting

Isn't this just a hosted SQL database?

Windows Azure SQL Database (was SQL Azure)

SQL as a service Massively distributed cluster Based on commodity hardware Focus on logical vs physical design

Is my data secure?

Security built-inLogical firewallDOS attack detectionSSL connectivity

Not yet availableEncryption

Can I rely on my data being available?

HA built-inPrimary plus two replicasNear-instant failoverRolling upgrades only when all

availableRead -> PrimaryWrite -> Quorum

Do I get my own SQL Server?

Logical servers assigned to subscriptionsServer = TDS endpoint at gateway

Can be programmatically provisioned

master databaseDifferent to on-premises versionView for firewall rules

How big can my databases be?

Web up to 5GB, Business up to 150GBMain difference is growth limit

Pricing encourages multi-tenantCould be on different physical servers

Management Portal & Database Design/Query

Will this fix my performance

issues? Probably not WASD is different to an on-premises server Important to understand what is offered

and limitations SQL Server 2012 based engine (Quarterly updates)

Commodity hardwareMulti-tenanted architectureLatency

How do I avoid performance

issues? Database needs appropriate design (no magic fix)

IndexingAvoid fragmentation

Architect for scale-out vs scale-upOn-premises => buy enough hardwareAzure => design for multi-DB, enough

DBs Use async (non-blocking) design patterns

Is latency really an issue?

Possibly significant in local region Need to

Avoid chatty interfacesMinimize round tripsChoose appropriate data centre (via

testing not geography)

Co-locate applications and data within DC

Perceived Performance

Application to data centerData center to databaseQuery execution timeDatabase to data centerData center to application

Query execution time is now often the shortest part

Client Latency (Brisbane 7th August 2012)

Note: Depends entirely upon your ISP and location and can change over time

But: Cloud Apps vs Local Apps

Management Studio and Latency

What tools can I use?

Management Portal (manage servers) SQL Server Management Studio (SSMS)

Use 2008 SP1 or later Database Manager (within portal)

Design tables, edit table dataDoes not really compete with SSMS

SQL Server Data ToolsPerform local validation before

deployment

How to I migrate by apps and data?

Scripting options in SSMSEnsure WASD targetCheck for scripting issues

Data-tier applications.dacpac and .bacpac files

SQL Azure Migration Wizard SQL Server Integration Services bcp

Do I need to change my apps?

Large subset of T-SQL supported Tables must have a clustered index Not all components supported

Agent, Full-Text, Service BrokerDependencies, CLR

Continuous improvements – recently added:MARS, Spatial

Database scripting

What if other apps don't play fair?

WASD is not intended for high resource requirement apps Shared resources

tempdb Worker threadsDiskNetwork

How does Azure balance loads?

Main load balancer (periodic)Balances utilization across all serversSwaps or moves workloads

Reactive load balancer (as needed)Solves short term issuesFast solution to avoid throttling on hot

machines

So what's this throttling thing?

Throttling Service Protects systems based on actual vs safe loads Soft throttle => busiest databases only Hard throttle => all databases on server

How do I avoid throttling?

Optimize database codeUp-to-date statisticsMinimal index fragmentation

Monitor throttle causesMany hard throttles – check code &

designCheck DMVs (eg:

sys.dm_exec_query_stats)Decode errors returned

Throttling Error Decoding (see MSDN)

Will my app stay connected?

No But retry logic needed for on-premises systems

anyway Design for an assumption of failure

Are there code examples?

Entlib (via NuGet) Transient Fault Handling Application Block

ReliableSqlConnection (connection + retry policy)Policy (count, count + timespan, etc)ExecuteNoQueryWithRetryRetrying event exposedExecuteAction method can invoke LINQ

How do I backup and restore?

COPY DATABASETransactionally-consistent duplicate

databaseAsync operation & can be cross-server

Import/Export wizardUses Azure StorageNot transactionally-consistentQuiesce database first or use copy

database

Can I point DB Scripts at WASD?

Yes, but don't include data

Example Recent Timing For 21MB Script

Script included schema & data:

Method Time

Execute against local server 55 secs

Execute against WASD directly 1 hr 52 mins 13 secs

Export bacpac from local server to Azure storage

13 secs

Import bacpac from Azure storage 52 secs

Working with bacpac, storage and copy database

Agenda

Working with Windows Azure SQL

Database

Scaling out using Federations

Scaling out using Data Sync

Reporting

Federations

Support scale-out by shardingSimplify multi-tenancy supportOnline split operation (merge coming)

Member DBs inherit properties from root (collation/type)Distribution based on single column

int bigint varbinary (900 bytes max)

guid

Table Types In Federated Systems Federated

Distributed by keyContain data that is the reason for federation

ReferenceCloned to each federation memberTypically small lookup data

CentralCreated in federation rootTypically low-traffic objects eg: metadata

Federation Routing

USE FEDERATION routes toROOTFederation member for a given distribution keyQueries can be filtered/non-filtered

Fan-out queries not yet supportedUndesirable anywayDesign for performance via parallelism

Federations

More Info On Federations

Plan to attend session AZRxxx with Chris Auld:

SQL Azure Federations Deep Dive

on DAY at TIME

Agenda

Working with Windows Azure SQL

Database

Scaling out using Federations

Scaling out using Data Sync

Reporting

Data Sync

Based on Sync FrameworkDelivered as an Azure serviceHub and spoke topology Conflict resolution policy (client or hub wins)Sync directions (to hub, from hub, bi-directional)Sync schedule (manual or 5 mins to 1 month)Datasets can be filtered

Windows Azure SQL Database

SQL Azure Database

Hub

On-premises

SQL Server

Data Sync Compatibility

Some data type limitationsEg: spatial

Based on Change TrackingNot transactionalData only – no stored procedures or triggers

Implemented via:Triggers on existing tablesNew tablesNeed to ensure SQL Server app compatible with triggers used

Sync With On-Premises SQL Server

Agent service based solutionShared key to connect with hubClient -> Client sync requires two hops

Windows Azure SQL Database

SQL Azure Database

Hub

On-premises

SQL Server

Agent Service

Typical Data Sync Provisioning Deploy database to hub and clients

Configure sync groupDetermine dataset contents & filteringDetermine sync scheduleDetermine conflict resolution policy

Install agent service on on-premises system

Add all clients to topology and deploy topology

Data sync

Agenda

Working with Windows Azure SQL

Database

Scaling out using Federations

Scaling out using Data Sync

Reporting

Windows Azure SQL Reporting SSRS delivered as an Azure service

Worker role in AzureSticky gateway

Primary target: embedded reporting in web apps

Rapid provisioning

Best to provision in same DC as SQL data

Compatibility With SSRSReport designer & RDLDeployment mechanismsWeb services and URL accessReport viewer control (2010)Item level permissions

Plus:Built-in HAElastic scale-out options

SQL authentication onlySSL onlyWASD data sources only

Less:Report Builder,

Schedules, Subscriptions, Custom Extensions, External Images

Same Different

SQL Reporting

Session Summary

Future is logical design and agilityFederations simplify scale-outData sync enables co-operative system designsReporting uses familiar tools and APIs

Windows Azure SQL Database is ready for business

Windows Azure SQL Database enables new opportunities

© 2012 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries.The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to

be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS

PRESENTATION.