Tony Petrossian Microsoft Corporation Best Practices.

Slides:



Advertisements
Similar presentations
Implementing Tableau Server in an Enterprise Environment
Advertisements

Jim ONeil Microsoft Developer Evangelist
System Center 2012 R2 Overview
Eric Nelson Application Architect, Microsoft |
Application Internet Azure Cloud Internet Azure Cloud LB TDS (tcp) Applications use standard SQL client libraries: ODBC, ADO.Net, PHP, … Load balancer.
“Packaged” Application An application that I buy “off the shelf” and run myself “Packaged” Application An application that I buy “off the shelf”
Mark Simms Principal Program Manager Windows Azure Customer Advisory Team.
“It’s going to take a month to get a proof of concept going.” “I know VMM, but don’t know how it works with SPF and the Portal” “I know Azure, but.
Emmanuel Mesas Microsoft Western Europe Leverage Azure Services & Platform with Existing Application.
T Sponsors Paul Larsen Principal Program Manager, Microsoft Integrating cloud with existing IBM Systems BizTalk Summit 2015 – London ExCeL London | April.
Overview Of Microsoft New Technology ENTER. Processing....
ASP.NET Programming with C# and SQL Server First Edition Chapter 8 Manipulating SQL Server Databases with ASP.NET.
Windows Azure for scalable compute and storage SQL Azure for relational storage for the cloud AppFabric infrastructure to connect the cloud.
Virtual techdays INDIA │ November 2010 SQL Azure Data Sync Shilpa Nirmale │ Associate Manager, Accenture.
Training Workshop Windows Azure Platform. Presentation Outline (hidden slide): Technical Level: 200 Intended Audience: Developers Objectives (what do.
Subtitle color From Windows Azure From Outside Microsoft Datacenter From Outside Microsoft Datacenter & Windows Azure Application / Browser Windows.
Google AppEngine. Google App Engine enables you to build and host web apps on the same systems that power Google applications. App Engine offers fast.
Enterprise Reporting with Reporting Services SQL Server 2005 Donald Farmer Group Program Manager Microsoft Corporation.
Michael Epprecht IT Pro Evangelist Microsoft
Manage & Configure SQL Database on the Cloud Haishi Bai Technical Evangelist Microsoft.
XVII Encontro – 29/11/2011. Virgílio Esteves ID&T – Research & Founder of NetPonto Coimbra C# / WPF / Silverlight / XNA / Azure.
PlacePlace TypeType ServiceService Analysis Caching Integration Sync Search Relational BLOB Query BackupLoad Multi Dim In Memory File XML Reporting.
Distributed Data Stores – Facebook Presented by Ben Gooding University of Arkansas – April 21, 2015.
Hilton Giesenow Principal Consultant, 3fifteen Microsoft MVP.
Training Workshop Windows Azure Platform. Presentation Outline (hidden slide): Technical Level: 200 Intended Audience: Developers & Architects Objectives.
Subtitle color From Windows Azure From Outside Microsoft Datacenter From Windows Azure & Outside Microsoft Datacenter Application / Browser Windows.
Training Workshop Windows Azure Platform. Presentation Outline (hidden slide): Technical Level: 200 Intended Audience: Developers Objectives (what do.
Windows Azure SQL Database and SQL Reporting for Developers Dr Greg Low Principal Mentor – SQL Down Under AZR221.
Migrating Business Apps to Windows Azure Marc Müller Principal Consultant, 4tecture GmbH
Module 8 Configuring and Securing SharePoint Services and Service Applications.
ADO.NET A2 Teacher Up skilling LECTURE 3. What’s to come today? ADO.NET What is ADO.NET? ADO.NET Objects SqlConnection SqlCommand SqlDataReader DataSet.
Virtual techdays INDIA │ august 2010 SQL Azure – Tips and Tricks Ramaprasanna Chellamuthu │ Developer Evangelist, Microsoft.
Your First Azure Application Michael Stiefel Reliable Software, Inc.
Windows Azure Conference 2014 Deploy your Java workloads on Windows Azure.
Application Internet Azure Cloud Internet Azure Cloud LB TDS (tcp) Applications use standard SQL client libraries: ODBC, ADO.Net, PHP, … Load balancer.
Azure Services Platform Update James Conard Sr. Director Developer & Platform Evangelism Microsoft Corporation.
Now Jan Feb 1 Business Analytics Reporting Data Sync.
Windows Azure for scalable compute and storage SQL Azure for relational storage for the cloud AppFabric infrastructure to connect the cloud.
Windows Azure. Azure Application platform for the public cloud. Windows Azure is an operating system You can: – build a web application that runs.
Mirek Sztajno SQL Server Security PM
Tony Petrossian Microsoft Corporation An Introduction.
Text Microsoft to Or Tweet #uktechdays Questions?
Interoperability. Session Objectives and Takeaways Session Objective(s): – Get up to speed on SQL Azure – Learn about the new features in SQL Azure –
Enhancing Scalability and Availability of the Microsoft Application Platform Damir Bersinic Ruth Morton IT Pro Advisor Microsoft Canada
Scalability == Capacity * Density.
Migrating Data to SQL Azure Arunraj Chandrasekaran Twitter June 21, 2011.
Please note that the session topic has changed
Microsoft Cloud Computing. Topics to be covered 1.Environmental Features of windows azure 2.What is Cloud Computing 3.Roles in Cloud Computing 4.Benefits.
Technology Drill Down: Windows Azure Platform Eric Nelson | ISV Application Architect | Microsoft UK |
David Robinson Senior Program Manager Microsoft DAT303.
SQL Server 2012 Session: 1 Session: 4 SQL Azure Data Management Using Microsoft SQL Server.
(re)-Architecting cloud applications on the windows Azure platform CLAEYS Kurt Technology Solution Professional Microsoft EMEA.
Page 1 Overview of SQL Azure Jeff Chu |
Page 1 Programming SQL Azure Database Jeff Chu |
Building web applications with the Windows Azure Platform Ido Flatow | Senior Architect | Sela | This session.
Copyright © New Signature Who we are: Focused on consistently delivering great customer experiences. What we do: We help you transform your business.
Putting Your Head in the Cloud Working with SQL Azure David Postlethwaite 19/09/2015David Postlethwaite.
 Cloud Computing technology basics Platform Evolution Advantages  Microsoft Windows Azure technology basics Windows Azure – A Lap around the platform.
WINDOWS AZURE AND THE HYBRID CLOUD. Hybrid Concepts and Cloud Services.
ELASTIC DATABASE CAPABILITIES WITH AZURE SQL DB Silvia Doomra Azure SQL DB Program Management.
David Robinson Senior Program Manager Microsoft DAT204.
Windows Azure SQL Database - Basic
Introduction to SQL Azure
How to tune your applications before moving your database to Microsoft Azure SQL Database (MASD) OK, you've jumped into your Azure journey by creating.
Lead SQL BankofAmerica Blog: SQLHarry.com
Building Applications with Windows Azure and SQL Azure
2017 Real Questions
Microsoft SQL Azure Development Best Practices
Developing for Windows Azure
06 | SQL Server and the Cloud
Presentation transcript:

Tony Petrossian Microsoft Corporation Best Practices

Service Recap “Server” Management Connectivity and Tracing Using multiple databases Migrating data and schema in and out of SQL Azure

Relational database service Built on SQL Server technology foundation Highly scaled Highly secure Database “as a Service” – beyond hosting Customer Value Props Self-provisioning and capacity on demand Symmetry w/ on-premises database platform Automatic high-availability and fault-tolerance Automated DB maintenance (infrastructure) Simple, flexible pricing – “pay as you grow”

TDS Gateway Front-end Node Protocol Parser Gateway Logic TDS Session 1 Front-end Node Protocol Parser Gateway Logic Master Cluster Master Node Data Node Components Partition Manager Master Node Data Node Components Partition Manager Machine 5 SQL Instance SQL DB DB5 DB3 DB2 Scalability and Availability: Fabric, Failover, Replication, and Load balancing Machine 6 SQL Instance SQL DB Master1 Meta 1 DB2 DB3 Machine 4 SQL Instance SQL DB DB2 DB3 DB4 Machine 7 SQL Instance SQL DB DB4 DB5 DB1 DB7 Scalability and Availability: Fabric, Failover, Replication, and Load balancing 4466 Master1 Applications connect directly to a database “Initial Catalog = ” in connection string No support for context switching (no USE ) SQL Azure connection strings follow SQL syntax Except for an unusual username format Format of username for authentication: ADO.Net: Data Source=server.database.windows.net; User ODBC: Driver={SQL Server Native Client 10.0}; Server=server.database.windows.net;

Where should I create my server? Co-locate server with Windows Azure app to reduce latency When should I create a new server? Trade off between geo/admin/billing Managing Server Through the Portal Add/Drop server Establish admin credentials View usage reports Network access configuration Through the Master Database Fine-tune firewall settings through code User logins Usage and metrics reporting (billing) Create/Drop databases Admin roles permissions CREATE/DROP database CREATE/DROP/ALTER login GRANT/REVOKE rights Modifying server firewall settings Master DB HTTP TDS SQL Azure Server

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 TSQL API against Master DB: sys.firewall_rules, sys.sp_set_firewall_rule, sys.sp_delete_firewall_rule Portal UX

sys.bandwidth_usage: usage in KB sys.database_usage: instance count by type per day

Most-applicable SQL Best Practices Connection Pooling Query Parameterization Batching Scaling with data and load Sharding Building copies Deploying and uploading data Bulk copy, BCP.EXE SSIS Microsoft Sync Framework Power Pack for SQL Azure

// When pooling, use connection and return immediately // Do not hold for a long time – pool ensures fast turnaround // on second use using (SqlConnection conn = new SqlConnection(…)) { conn.Open(); using (SqlCommand cmd = conn.CreateCommand()) { cmd.CommandText = …; … } using (SqlConnection conn = new SqlConnection(…)) { conn.Open(); … Increases efficiency by removing re-login

Connections can drop for variety of reasons Idleness for more than 30-minutes Transient (network) errors Intentional throttling First step: reconnect immediately Handles idleness- and transient-disconnects The SQL Azure Gateway handles connection retry for app Connections attempted for ~30s before failure What to do on connection failure? Wait (10 seconds), then retry Check the error messages and follow recommendation Server health can be checked via Portal TSQL APIs will come in later releases

while (true) { using (SqlConnection connection = new SqlConnection(connStr)) { try { connection.Open(); using (SqlCommand cmd = connection.CreateCommand()) { cmd.CommandText cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add(new BCPJobId)); cmd.ExecuteNonQuery(); } catch (SQLException Sqexc) { // deal with error } catch (Exception exc) { // deal with error } // more stuff // ….. } Keep it inside the main loop

Each session assigned a unique ‘sessionId’ Tracks session state and service errors Retrievable from CONTEXT_INFO() Save this with each new connection If you need support, support personnel will greatly appreciate that value

Guid? sessionId = null; using (SqlConnection conn = new SqlConnection(…)) { // Grab sessionId from new connection using (SqlCommand cmd = conn.CreateCommand()) { conn.Open(); cmd.CommandText = "SELECT CONVERT(NVARCHAR(36), CONTEXT_INFO())"; sessionId = new Guid(cmd.ExecuteScalar().ToString()); } // continue processing... }

Batching: push logic to Server Use stored procedures and batching Limit number of round trips to server Example: batch 10 statements vs. 10 round-trips Parameterized queries Parameterize queries (limits compiles) Declare all parameters, type and length Lack of parameter size leads to cache bloat

// Length inferred: leads to cache bloat  cmd.CommandText = "SELECT c1 FROM dbo.tbl WHERE c2 SqlDbType.NVarChar).Value = "1"; … SqlDbType.NVarChar).Value = "22"; // Length supplied: no cache bloat cmd.CommandText = "SELECT c1 FROM dbo.tbl WHERE c2 SqlDbType.NVarChar, 128).Value = "1"; nvarchar(1)) SELECT c1 FROM dbo.tbl WHERE c2 nvarchar(2)) SELECT c1 FROM dbo.tbl WHERE c2 nvarchar( 128 )) SELECT c1 FROM dbo.tbl WHERE c2

SQL Azure balances databases across machines Divide your data into smaller chunks Makes for better load-balancing Ensures we can place your data on the most-appropriate servers Using shorter transactions Ensures we can respond to issues faster Avoid impacting others sharing the same box Thus avoiding being throttled by SQL Azure

Provider of vehicle valuation data > 13 million visitors to their site per month 2.5 GB Database Size Data refreshed every week Replicate data across 6 databases for increased perf Increase/Decrease database count based on demand Kelly Blue Book

SQL Azure Cluster Server DBC1 DBC2 DBC3 DBC4 DBC5 DBC6

SQL Azure Castellan Castellan Venue DB Castellan Venue DB’s Venue 1 Partition(s) Venue 1 Partition(s) Castellan Venue DB Castellan Venue DB’s Venue 2 Partition(s) Castellan Venue DB Castellan Venue DB’s Venue N Partition(s) One application DB, many venue DB’s – each partitioned in to many parts (40+)... Azure Roles TicketDirect.* Dynamic Worker (tasks uploaded as blobs) Partitioner Worker Azure Storage Queues for communication between clients and roles Tables to record server & partition information Blobs to store web and worker role resources Client Applications Castellan.old (VB6) Castellan.Azure Box Office sales Ticket Printing System Administration Venue/Event Management Partitioning Castellan.Azure Box Office sales Ticket Printing System Administration Venue/Event Management Partitioning.Net Service Bus WCF On Premise SQL Server Castellan Venue Distributed Cache Worker MemCache

SQL Azure Cluster Node 55 DB3 Server DB1 DB2 DB3 DB4 DB5 DB6

Moving between SQL Server & SQL Azure Use SSMS script generation tool SQL Azure Migration Wizard Use Data-Tier Application VS2010, SQL Server 2008 R2, SQL Azure SU2 (April 2010) Build your own scripts Watch out for unsupported T-SQL Don’t depend on instance or server level objects

SQL Azure supports standard SQL data import and export patterns Use bulk loading patterns where possible BCP – console.EXE bulk load/export tool SSIS – SQL integration server Bulk APIs in ODBC and ADO.Net SQL Azure supports data synchronization With on-premises DBs and client stores Always good advice: Break batches up into smaller, consumable chunks Add retry and tracing logic to ensure robust resume in face of failures

// Bulk data import using (SqlBulkCopy bulk = new SqlBulkCopy(new SqlConnection(conn)) { DestinationTableName = "dbo.data", BatchSize = 2000, // Transaction size (length) BulkCopyTimeout = 10000, // Transaction timeout NotifyAfter = 1000, // Progress callback }) { bulk.SqlRowsCopied += new SqlRowsCopiedEventHandler( myProgressCallback); bulk.WriteToServer(sourceDataReader); }

// BCP example SET SRV=somesrv.database.windows.net SET SET PW=something SET S_DR=C:\flats SET DB=TPCH bcp %DB%.dbo.supplier in %S_DR%\supplier.tbl -c -U %LOGIN% -P %PW% -S %SRV% -t "|" bcp %DB%.dbo.nation in %S_DR%\nation.tbl -c -U %LOGIN% -P %PW% -S %SRV% -t "|" bcp %DB%.dbo.region in %S_DR%\region.tbl -c -U %LOGIN% -P %PW% -S %SRV% -t "|" bcp %DB%.dbo.customer in %S_DR%\customer.tbl -c -U %LOGIN% -P %PW% -S %SRV% -t "|" bcp %DB%.dbo.part in %S_DR%\part.tbl -c -U %LOGIN% -P %PW% -S %SRV% -t "|“ bcp %DB%.dbo.supplier out %S_DR%\supplier.tbl -c -U %LOGIN% -P %PW% -S %SRV% -t "|" bcp %DB%.dbo.nation out %S_DR%\nation.tbl -c -U %LOGIN% -P %PW% -S %SRV% -t "|" bcp %DB%.dbo.region out %S_DR%\region.tbl -c -U %LOGIN% -P %PW% -S %SRV% -t "|" bcp %DB%.dbo.customer out %S_DR%\customer.tbl -c -U %LOGIN% -P %PW% -S %SRV% -t "|" bcp %DB%.dbo.part out %S_DR%\part.tbl -c -U %LOGIN% -P %PW% -S %SRV% -t "|"

Many SQL Server patterns apply to SQL Azure Use SQL best practices wherever possible Patterns discussed: Connectivity (to database, not server) Tracing and support Batching, Pooling and Parameterization Getting data in and out

Azure Prices and Packages: SQL Azure Information: MSDN Resources

For more Information please contact Tony Petrossian Principal Program Manager SQL Azure Development Microsoft Corporation