Download presentation
Presentation is loading. Please wait.
Published byKrystian Laskowski Modified over 6 years ago
1
TechEd 2013 12/28/ :16 PM © 2013 Microsoft Corporation. All rights reserved. Microsoft, Windows, 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.
2
12/28/ :16 PM DBI-B311 Performance Tuning Microsoft SQL Server in Windows Azure Virtual Machines Madhan Arumugam Ramakrishnan Program Manager Microsoft SQL Server © 2013 Microsoft Corporation. All rights reserved. Microsoft, Windows, 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.
3
Performance Guidance for SQL Server in Windows Azure Virtual Machines
Whitepaper Performance Guidance for SQL Server in Windows Azure Virtual Machines Published: June 2013 Download it here: nkId=306266
4
Performance tuning Analyzing performance impact
Is it a problem with my SQL application? or Is it a problem with how I configured the Azure IaaS platform for my usage SQL Performance considerations Platform characteristics Best practices Monitoring Troubleshooting
5
SQL performance considerations
KPIs Throughput Response time (aka latency) Dimensions Know what is the Platform impact vs Application impact Metric OLTP DW Log Read/Write mix Mostly reads, smaller # of rows at a time Scan intensive, large portions of data at a time, bulk loading Mostly writes, requires low latency IO size and pattern Between 8 and 64K, mostly random 1 64KB read per 8 512KB reads, Mostly sequential MB/s a critical metric Highly sequential # users high low n/a
6
Windows Azure IaaS Characteristics
7
… … … Windows Azure Cluster 1 Cluster 2 Cluster n Datacenter 1
Datacenter n Datacenter network Cluster 1 Cluster 2 … Cluster n … Region 2 Region 1
8
Windows Azure Infrastructure Services
Implicit Cloud Service Virtual Machine VM Cloud Service Worker Role Web Role VM1 VM2 VM3 VM4 VM5 VM… Instances Roles Cloud Service Virtual Machine VM Cloud Service is a management, configuration, security, networking and service model boundary Stateless Roles : Web/Worker Role – requires 2 or more instances Persistent Roles : Virtual Machine can work with single instance
9
Windows Azure Infrastructure Services
VM2 LB/IP VM1 PORT 3389 PORT 5586 PORT 5587 Single Public IP Per Cloud Service Cloud Service Endpoint Public Port Local Port Protocol (TCP/UDP) Name Cloud Service VM1 LBHTTP VM2 VM3 LB Endpoint Set Public Port Local Port Protocol (TCP/UDP) Name PORT 80 Port Forwarding Load Balanced Sets Custom Load Balancer Health Probes -Health check with probe timeouts, HTTP based probing, allowing granular control of health checks
10
Inside the Windows Azure VM
No standard cached images for IaaS OS is faulted in from blob storage during boot On first boot Windows Sysprep /specialize SQL Sysprep completion Virtual Machine C:\ OS Disk E:\, F:\, etc. Data Disks D:\ Temporary Disk Dynamic VHD RAM Cache Local Disk Cache Blobs Blob Striped Volume
11
VM Disk Types & Configurations
OS disk (persistent) Dynamic 127GB disk optimized for OS access patterns (e.g. boot up) Data disk (persistent) A VHD you can attach to a VM to store app data Up to 1TB in size Up to 16 disks for XL VMs Temporary local disk (non-persistent) Used for transient/temporary data storage & OS page files Hosted in attached disks on physical host Cleaned up in case of a VM failure or recycling Physical disks shared across other VMs on same physical machine Not recommended for user or system database files
12
Windows Azure VM Size & Bandwidth
Virtual Machine Size CPU Cores Memory Disk Space for Virtual Machines Allocated Bandwidth (Mbps) Maximum data disks (1 TB each) Maximum IOPS (500 maximum per disk) ExtraSmall Shared 768 MB 20 GB 5 1 1x500 Small 1.75 GB 70 GB 100 2 2x500 Medium 3.5 GB 135 GB 200 4 4x500 Large 7 GB 285 GB 400 8 8x500 ExtraLarge 14 GB 605 GB 800 16 16x500 A6 28 GB 1,000 A7 56 GB 2,000 Source:
13
VM Disk IO subsystem Disks implemented as a shared multi-tenant service Built-in triple redundancy, optional geo-redundancy Performance more variable than on-prem Host machines, storage services, network bandwidth shared between subscribers Perf can depend on where and when VM is provisioned Subject to maintenance operations Granular control & configurability vs. cost, simplicity, out of box redundancy Storage Stamp Stream Layer Partition Layer Front-ends LB Intra-stamp replication Geo-replication Storage Location Service
14
VM Disk Caching Caches VM data inside physical host machine
Can reduce disk I/O latency by reducing # transactions against Windows Azure Storage 2-tier cache Recently accessed data stored in host RAM cache - space shared by all VMs on machine Less recently accessed data stored on local hard disks of physical machine. Reserved cache space for VM “OS Disk” and “Data Disks” based on the VM size
15
Default VM cache settings
Read Only: All requests cached for future reads. All writes persisted directly to Windows Azure Storage Read Write: Reads and writes cached for future reads. Non-write-through writes persisted to local cache first. For SQL Server, writes are persisted to WA storage because it uses Write-through - Lowest disk latency for light workloads None (disabled): Bypasses cache. All disk transfers persisted to Windows Azure Storage Highest I/O rate for I/O intensive workloads Also consider TX cost Disk type Read Only Read Write None (disabled) OS disk Supported Default mode Not supported Data disk Supported (up to 4) Temporary disk Implemented using local attached storage
16
Best Practices
17
VM Disk cache setting recommendations
OS Disk “Read Write” (default) reduces read latency for IO intensive workloads with smaller DBs (<=10GB) Working set can fit in disk cache or memory, reducing blob storage IO Data disks Recommended for DBs > 10GB. Cache setting depends on the IO pattern and workload intensity Use default of “None” (disable) for Higher rate of random IOs (e.g. OLTP) & higher throughput Bypasses physical host local disks, maximizing IO rate Consider enabling read cache for latency sensitive read heavy workloads
18
Single Data Disk Configuration
Recommended for <1TB storage Acceptable performance Minimal complexity, simpler recovery Sample SQL IO Measurement tests for single disk: Random I/O (8KB Pages) Sequential I/O (64KB Extents) Sequential I/O (256KB Blocks) Reads Writes IOPS 500 300 Bandwidth 4 MB/s 30 MB/s 20 MB/s 70 MB/s
19
Multiple Disk Configuration
Recommended for >1TB DB files & higher IOPS/bandwidth Config options Use Database files and Filegroups and place DB files across multiple data disks This showed the best performance in our testing Create OS volume on top of multiple data disks (e.g. OS striped volume or WS2012 storage space) Storage spaces recommended over OS striped volumes
20
Aggregated Measurement Samples
4 disks Random I/O (8KB Pages) Sequential I/O (64KB Extents) Sequential I/O (256KB Blocks) Reads Writes IOPS 2000 1300 700 1100 Bandwidth 20 MB/s 120 MB/s 80 MB/s 170 MB/s 270 MB/s 8 disks Random I/O (8KB Pages) Sequential I/O (64KB Extents) Sequential I/O (256KB Blocks) Reads Writes IOPS 4000 2500 2600 700 2200 Bandwidth 30 MB/s 150 MB/s 160 MB/s 170 MB/s 550 MB/s 16 disks Random I/O (8KB Pages) Sequential I/O (64KB Extents) Sequential I/O (256KB Blocks) Reads Writes IOPS 8000 2500 5000 700 2400 Bandwidth 60 MB/s 150 MB/s 300 MB/s 170 MB/s 600 MB/s
21
Demo - 1 data disk vs 3 data disks
22
What else affects VM data disk performance?
Disk warm-up NTFS Allocation Unit Size Single vs. multiple storage accounts with a single VM Data in different blobs not written at the same time BLOBs that make up the stripe set could be out of sync Spread the load across multiple VHDs instead Note a storage account has a limit of 20K tps
23
Data Compression IO intensive workloads: fewer pages ->reduced IO
24
Reduce IO with Instant File Initialization
Not default in Azure VM images Reduces IO for Creating a DB Restoring a DB Adding files to a DB Extending file size Autogrow, etc. Add SQL service account to Perform Volume Maintenance Tasks security policy Restart SQL Server
25
Should tempdb go on D: drive?
Short answer: No Why? Predictable performance: OS or data disk can provide same or better performance but D: drive can be more variable, being a physical disk sharing IO with other VMs on the host. Size and performance also depends on VM size Configuration overhead: SQL Server has to recreate tempDB in D: if VM goes down – SQL Server service account requires Admin privileges. If stored in a separate folder this needs to be created at startup. tempDB can be critical to application performance Follow tempDB IO best practices
26
Demo - TempDB Contention and Resolution
27
Monitoring
28
Windows Azure Storage Analytics Metrics
Tracks aggregated storage usage for Blobs, Tables and Queues Capacity – e.g. #containers, total #blobs Requests - #requests, total ingress/egress, average E2E latency and server latency, total # failures by category, etc. Access via storage account namespace Enable in portal or using Set Blob Service Properties (REST API) Set retention policy See Windows Azure Storage Metrics: Using Metrics to Track Storage Usage
29
Performance Charts on the WA Portal
VM Dashboard Monitor tab for storage account Enabled under the “configure” tab VM read and write to their VHDs using GetBlob and PutPage commands respectively
30
Other platform monitoring tools
Tools to determine network latency impact Psping (free download at technet ) Traceroute (tracert)
31
SQL tools Tools to determine IO capacity of VM configurations
SQLIO – Disk Subsystem Benchmark Tool Performance metrics DMVs
32
Key SQL Perf counters Typical SQL KPIs Typical Web App KPIs
Max val for \Process(SQLServ)\% Processor Time Avg val for \Process(SQLServ)\% Processor Time Max val for \Processor(_Total)\% Processor Time Avg val for \Processor(_Total)\% Processor Time Max val for \SQLServer:SQL Statistics\Batch Requests/sec Avg val for \SQLServer:SQL Statistics\Batch Requests/sec Typical Web App KPIs Max val for \ASP.NET Applications (_Total_)\Reqests/sec Avg val for \ASP.NET Applications (_Total_)\Reqests/sec Avg val for \Memory\Available Mbytes Max val for \Processor(_Total)\% Processor Time Avg val for \Processor(_Total)\% Processor Time Avg val for \ASP.NET\Request Wait Time Avg val for \ASP.NET\Request Execution Time Avg val for \ASP.NET\Requests Queued Avg val for \ASP.NET\Requests Rejected Avg val for \ASP.NET\Requests Current Typical User/test characteristics Number of concurrent users Average/Max request execution time Number of web servers Ramp up period, test method Start and end time of test
33
Troubleshooting
34
Classic SQL Server Performance Factors
Plan change/choice issues Software/hardware configuration Locking & latching Multi-user operations and blocking Checkpoint & system operations
35
High-level Troubleshooting Steps
Define KPIs to monitor resource utilization Monitor KPIs to track utilization over time Examine trends and patterns as workload increases Monitor DMVs to understand resource contention/waits Monitor spinlock and back-off events
36
Troubleshooting Common VM Issues
KPIs To Monitor Actions to Consider CPU at or near 80% % Processor Time (_Total) SOS_SCHEDULER_YIELD waits Increase instance size Identify top consuming queries and tune Load balance (e.g. move DB to another instance) Near I/O capacity limits or IO Latency Increases Average disk reads per second Average disk writes per second Disk reads per second Disk writes per second io_virtual_file_stats PAGEIOLATCH waits SQL Server: Buffer Manager\Page Life Expectancy Check Page Life Expectancy counter, for mem pressure. Increase instance size Identify which DB and log files have I/O bottleneck Add more data disks and separate data files if near IOPS limits per disk Tune queries to reduce reads and writes Consider enabling row or page compression Memory resource pressure Memory: Available Bytes Memory: Pages per second Process: Working Set (for SQL Server) RESOURCE_SEMAPHORE waits Check max server memory setting for SQL Server. Use high memory instance Identify SQL component (such as, CLR, high memory grants for app queries, et.), tune appropriately.
37
Key takeaways Evaluate SQL Server in Windows Azure Infrastructure Services – SQL Server 2014 CTP1 available now! Read the Performance Guidance for SQL Server in Windows Azure Virtual Machines white paper and follow best practices described there Identify optimal VM size for your workload Optimize for reduced IO and network round trips Plan and test for IO perf variability Identify your KPIs to monitor Revisit optimization decisions as workload grows
38
Further Reading TechEd EMEA 2013 Sessions
White paper: Performance Guidance for SQL Server in Windows Azure Virtual Machines SQL IaaS Basics SQL Server in Windows Azure Virtual Machines SQL Server HA/DR on IaaS Windows Azure Storage Windows Azure’s Flat Network Storage and 2012 Scalability Targets Windows Azure Storage: A Highly Available Cloud Storage Service with Strong Consistency Erasure Coding in Windows Azure Storage SQL Server Backup and Restore with Windows Azure Blob Storage Service SQL Server Performance Analyzing I/O Characteristics and Sizing Storage Systems for SQL Server Database Applications Compilation of SQL Server TempDB IO Best Practices Windows Azure SQL Database and SQL Server -- Performance and Scalability Compared and Contrasted TechEd EMEA 2013 Sessions MDC-B212: Infrastructure Services on Windows Azure: Virtual Machines and Virtual Networks with Mark Russinovich Today 10:15AM, Hall 7.2 DBI-B206: Private Cloud – Better Together: Microsoft SQL Server 2012, Windows Server 2012 and System Center 2012 Today 5PM, N104 WAD-B402: Windows Azure Internals with Mark Russinovich Today 3:15PM, Hall 7.2 DBI-B329: Overview, Best Practices and Lessons Learned on Microsoft SQL Server in Windows Azure Virtual Machines June 27 10:15AM, N102 DBI-B306: Microsoft SQL Server High Availability and Disaster Recovery on Windows Azure June 27 3:15PM, N104
39
Resources Learning TechNet msdn http://channel9.msdn.com/Events/TechEd
12/28/ :16 PM Resources Learning Sessions on Demand Microsoft Certification & Training Resources TechNet msdn Resources for IT Professionals Resources for Developers © 2013 Microsoft Corporation. All rights reserved. Microsoft, Windows, 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.
40
Evaluate this session Scan this QR code to evaluate this session.
12/28/ :16 PM Required Slide *delete this box when your slide is finalized Your MS Tag will be inserted here during the final scrub. Evaluate this session Scan this QR code to evaluate this session. © 2013 Microsoft Corporation. All rights reserved. Microsoft, Windows, 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.
41
12/28/ :16 PM © 2013 Microsoft Corporation. All rights reserved. Microsoft, Windows 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. © 2013 Microsoft Corporation. All rights reserved. Microsoft, Windows, 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.
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.