windows azure sql database and sql reporting for developers dr greg low principal mentor – sql...

50
Windows Azure SQL Database and SQL Reporting for Developers Dr Greg Low Principal Mentor – SQL Down Under AZR221

Upload: victor-baker

Post on 27-Dec-2015

233 views

Category:

Documents


5 download

TRANSCRIPT

Page 1: Windows Azure SQL Database and SQL Reporting for Developers Dr Greg Low Principal Mentor – SQL Down Under AZR221

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

AZR221

Page 2: Windows Azure SQL Database and SQL Reporting for Developers Dr Greg Low Principal Mentor – SQL Down Under AZR221

Who is Greg?

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

Page 3: Windows Azure SQL Database and SQL Reporting for Developers Dr Greg Low Principal Mentor – SQL Down Under AZR221

Agenda

Working with Windows Azure SQL

Database

Scaling out using Federations

Scaling out using Data Sync

Reporting

Page 4: Windows Azure SQL Database and SQL Reporting for Developers Dr Greg Low Principal Mentor – SQL Down Under AZR221

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

Page 5: Windows Azure SQL Database and SQL Reporting for Developers Dr Greg Low Principal Mentor – SQL Down Under AZR221

Is my data secure?

Security built-inLogical firewallDOS attack detectionSSL connectivity

Not yet availableEncryption

Page 6: Windows Azure SQL Database and SQL Reporting for Developers Dr Greg Low Principal Mentor – SQL Down Under AZR221

Can I rely on my data being available?

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

availableRead -> PrimaryWrite -> Quorum

Page 7: Windows Azure SQL Database and SQL Reporting for Developers Dr Greg Low Principal Mentor – SQL Down Under AZR221

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

Page 8: Windows Azure SQL Database and SQL Reporting for Developers Dr Greg Low Principal Mentor – SQL Down Under AZR221

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

Page 9: Windows Azure SQL Database and SQL Reporting for Developers Dr Greg Low Principal Mentor – SQL Down Under AZR221

Management Portal & Database Design/Query

Page 10: Windows Azure SQL Database and SQL Reporting for Developers Dr Greg Low Principal Mentor – SQL Down Under AZR221

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

Page 11: Windows Azure SQL Database and SQL Reporting for Developers Dr Greg Low Principal Mentor – SQL Down Under AZR221

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

Page 12: Windows Azure SQL Database and SQL Reporting for Developers Dr Greg Low Principal Mentor – SQL Down Under AZR221

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

Page 13: Windows Azure SQL Database and SQL Reporting for Developers Dr Greg Low Principal Mentor – SQL Down Under AZR221

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

Page 14: Windows Azure SQL Database and SQL Reporting for Developers Dr Greg Low Principal Mentor – SQL Down Under AZR221

Client Latency (Brisbane 7th August 2012)

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

Page 15: Windows Azure SQL Database and SQL Reporting for Developers Dr Greg Low Principal Mentor – SQL Down Under AZR221

But: Cloud Apps vs Local Apps

Page 16: Windows Azure SQL Database and SQL Reporting for Developers Dr Greg Low Principal Mentor – SQL Down Under AZR221

Management Studio and Latency

Page 17: Windows Azure SQL Database and SQL Reporting for Developers Dr Greg Low Principal Mentor – SQL Down Under AZR221

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

Page 18: Windows Azure SQL Database and SQL Reporting for Developers Dr Greg Low Principal Mentor – SQL Down Under AZR221

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

Page 19: Windows Azure SQL Database and SQL Reporting for Developers Dr Greg Low Principal Mentor – SQL Down Under AZR221

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

Page 20: Windows Azure SQL Database and SQL Reporting for Developers Dr Greg Low Principal Mentor – SQL Down Under AZR221

Database scripting

Page 21: Windows Azure SQL Database and SQL Reporting for Developers Dr Greg Low Principal Mentor – SQL Down Under AZR221

What if other apps don't play fair?

WASD is not intended for high resource requirement apps Shared resources

tempdb Worker threadsDiskNetwork

Page 22: Windows Azure SQL Database and SQL Reporting for Developers Dr Greg Low Principal Mentor – SQL Down Under AZR221

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

Page 23: Windows Azure SQL Database and SQL Reporting for Developers Dr Greg Low Principal Mentor – SQL Down Under AZR221

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

Page 24: Windows Azure SQL Database and SQL Reporting for Developers Dr Greg Low Principal Mentor – SQL Down Under AZR221
Page 25: Windows Azure SQL Database and SQL Reporting for Developers Dr Greg Low Principal Mentor – SQL Down Under AZR221

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

Page 26: Windows Azure SQL Database and SQL Reporting for Developers Dr Greg Low Principal Mentor – SQL Down Under AZR221

Throttling Error Decoding (see MSDN)

Page 27: Windows Azure SQL Database and SQL Reporting for Developers Dr Greg Low Principal Mentor – SQL Down Under AZR221

Will my app stay connected?

No But retry logic needed for on-premises systems

anyway Design for an assumption of failure

Page 28: Windows Azure SQL Database and SQL Reporting for Developers Dr Greg Low Principal Mentor – SQL Down Under AZR221

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

Page 29: Windows Azure SQL Database and SQL Reporting for Developers Dr Greg Low Principal Mentor – SQL Down Under AZR221

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

Page 30: Windows Azure SQL Database and SQL Reporting for Developers Dr Greg Low Principal Mentor – SQL Down Under AZR221

Can I point DB Scripts at WASD?

Yes, but don't include data

Page 31: Windows Azure SQL Database and SQL Reporting for Developers Dr Greg Low Principal Mentor – SQL Down Under AZR221

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

Page 32: Windows Azure SQL Database and SQL Reporting for Developers Dr Greg Low Principal Mentor – SQL Down Under AZR221

Working with bacpac, storage and copy database

Page 33: Windows Azure SQL Database and SQL Reporting for Developers Dr Greg Low Principal Mentor – SQL Down Under AZR221

Agenda

Working with Windows Azure SQL

Database

Scaling out using Federations

Scaling out using Data Sync

Reporting

Page 34: Windows Azure SQL Database and SQL Reporting for Developers Dr Greg Low Principal Mentor – SQL Down Under AZR221

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

Page 35: Windows Azure SQL Database and SQL Reporting for Developers Dr Greg Low Principal Mentor – SQL Down Under AZR221

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

Page 36: Windows Azure SQL Database and SQL Reporting for Developers Dr Greg Low Principal Mentor – SQL Down Under AZR221

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

Page 37: Windows Azure SQL Database and SQL Reporting for Developers Dr Greg Low Principal Mentor – SQL Down Under AZR221

Federations

Page 38: Windows Azure SQL Database and SQL Reporting for Developers Dr Greg Low Principal Mentor – SQL Down Under AZR221

More Info On Federations

Plan to attend session AZRxxx with Chris Auld:

SQL Azure Federations Deep Dive

on DAY at TIME

Page 39: Windows Azure SQL Database and SQL Reporting for Developers Dr Greg Low Principal Mentor – SQL Down Under AZR221

Agenda

Working with Windows Azure SQL

Database

Scaling out using Federations

Scaling out using Data Sync

Reporting

Page 40: Windows Azure SQL Database and SQL Reporting for Developers Dr Greg Low Principal Mentor – SQL Down Under AZR221

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

Page 41: Windows Azure SQL Database and SQL Reporting for Developers Dr Greg Low Principal Mentor – SQL Down Under AZR221

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

Page 42: Windows Azure SQL Database and SQL Reporting for Developers Dr Greg Low Principal Mentor – SQL Down Under AZR221

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

Page 43: Windows Azure SQL Database and SQL Reporting for Developers Dr Greg Low Principal Mentor – SQL Down Under AZR221

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

Page 44: Windows Azure SQL Database and SQL Reporting for Developers Dr Greg Low Principal Mentor – SQL Down Under AZR221

Data sync

Page 45: Windows Azure SQL Database and SQL Reporting for Developers Dr Greg Low Principal Mentor – SQL Down Under AZR221

Agenda

Working with Windows Azure SQL

Database

Scaling out using Federations

Scaling out using Data Sync

Reporting

Page 46: Windows Azure SQL Database and SQL Reporting for Developers Dr Greg Low Principal Mentor – SQL Down Under AZR221

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

Page 47: Windows Azure SQL Database and SQL Reporting for Developers Dr Greg Low Principal Mentor – SQL Down Under AZR221

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

Page 48: Windows Azure SQL Database and SQL Reporting for Developers Dr Greg Low Principal Mentor – SQL Down Under AZR221

SQL Reporting

Page 49: Windows Azure SQL Database and SQL Reporting for Developers Dr Greg Low Principal Mentor – SQL Down Under AZR221

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

Page 50: Windows Azure SQL Database and SQL Reporting for Developers Dr Greg Low Principal Mentor – SQL Down Under AZR221

© 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.