2. Vlad Vlasceanu
Specialist Solutions
Architect, Amazon Web
Services
Principal DB Specialist SA, AWS
Principal Database Specialist Solutions
Architect for the Americas team. Help
customers operate database workloads in
the cloud effectively.
SQL Server Experience
10 years of expertise working with SQL
Server, developing and operating apps with
SQL Server backends. 15+ years of expertise
working with RDBMS and NoSQL systems.
Thought Leadership
Authored/co-authored whitepapers &
articles on using databases and other
technologies on AWS. Talks on databases,
DevOps and perimeter security. Speaker at
PASS Summit 3 years in a row.
3. • Overview of deployment options on AWS
• Best practices for SQL Server on Amazon EC2
• Recommendations for Amazon RDS for SQL Server
• SQL Server 2017 on AWS
Agenda
How do you design, deploy and optimize SQL Server on AWS
effectively?
4. Running SQL Server on AWS
AMAZON RDS SQL SERVER SQL SERVER ON AMAZON EC2
Cloud-native solution
Focus on:
• Business value tasks
• High-level tuning tasks
• Schema optimization
No in-house database expertise
Need control over:
• DB instance & OS
• Backups, Replication
• Clustering
• sysadmin role
Need to use features, size or
performance options not available in
Amazon RDS
Customers Have a Long & Successful History Running SQL Server on AWS
5. Features & Capabilities
FEATURES
• Same DB engine on both Amazon RDS and Amazon EC2
• Encrypted storage using Amazon Key Management Service (all editions), TDE, column-
level
• SSL support, including forced SSL
• Active Directory integration
LICENSING
• Pay as you go license included, or bring your own license (BYOL)
VERSIONS AND EDITIONS
• 2008R2, 2012, 2014, 2016
• Express, Web, Standard, Enterprise
6. The Differences
AMAZON RDS SQL SERVER SQL SERVER ON AMAZON EC2
• Less management overhead
• AWS managed deployment and
patching
• Multi-AZ automatic high-availability
• Auditable centralized engine parameter
tuning
• Automated backups and point in time
restore
• No direct instance or file system access
• Some features are restricted
• Support for legacy versions (self-install)
• Self-managed HA: Always On Availability
Groups
• Self-managed backups: Maintenance
Plans
• Self-managed deployment &
maintenance
• Administrator access to instance and DBs
• Custom monitoring agents
• Run SSRS, SSIS, SSAS on instance
• Always On Availability Group Hybrid
Architectures
8. • Getting the most out of AWS storage options
• What to do about tempdb
• AWS Availability Zones and Always On Availability Groups
• What about HA for SQL Server Standard Edition?
SQL Server on Amazon EC2
Common design and configuration practices
9. Amazon Elastic Block Storage (EBS)
WHAT IS AMAZON EBS?
• Low latency, elastic, persistent, network-attached block storage
• EBS Optimization: EC2 instance dedicated capacity for
network storage I/O (default on new instance types)
KEY PERFORMANCE DRIVERS
• EBS Optimized Bandwidth Capacity: Size of EBS optimized
channel (Mbps), and IOPS capacity
• EBS Volume IOPS: Max. volume capability at
variable I/O size (up to 256 KB/operation)
• EBS Volume Throughput: Max. MB/sec supported
by the volume
10. Amazon EBS Volume Types
Volume Type General Purpose
(GP2)
Provisioned IOPS
(PIOPS, IO1)
Throughput Optimized
(ST1)
Cold HDD
(SC1)
Technology: SSD SSD Magnetic Magnetic
Suitability: Variable Random I/O Consistent Random I/O High Throughput, Large Sequential I/O
Sizes: 1 GiB – 16 TiB 4 GiB – 16 TiB 500 GiB – 16TiB 500 GiB – 16 TiB
Max. IOPS: 10,000 20,000 500 250
Max. Throughput: 160 MiB/sec 320 MiB/sec 500 MiB/sec 250 MiB/sec
Properties: 3 IOPS/1 GB,
burstable up to 3000
IOPS for ≤1 TiB
volumes; fixed ratio
for larger ones
Consistent provisioned
performance, up to 50
IOPS/GB
Optimized for throughput, and sequential
read/write workloads, baseline per TiB throughput,
with burst capability
11. EBS Optimization & Volume
Characteristics
PLANNING STORAGE PERFORMANCE ON AMAZON EC2
• Enable EBS Optimization, if not on by default
• Match total EBS IOPS and throughput to instance type
• Stripe EBS PIOPS volumes for more than 20,000 IOPS or 320MB/s
12. EBS Optimization & Volume
Characteristics
PLANNING STORAGE PERFORMANCE ON AMAZON EC2
• Enable EBS Optimization, if not on by default
• Match total EBS IOPS and throughput to instance type
• Stripe EBS PIOPS volumes for more than 20,000 IOPS or 320MB/s
r4 family
r4.large
2 vCPUs/15.25 GiB RAM
Max EBS bandwidth: 425 Mbps
Max IOPS (16KB): 3,000
Expected throughput: 53 MB/s
r4.16xlarge
64 vCPUs/488 GiB RAM
Max EBS bandwidth: 14k Mbps
Max IOPS (16KB): 75,000
Expected throughput: 1,750 MB/s
1TB GP2 Volume
Expected IOPS (16KB): 3,000
Max. throughput: 160 MB/s
4 x 1TB PIOPS @ 20k IOPS
Expected IOPS (16KB): 80k
Max. throughput: 1,280 MB/s
13. Amazon EC2 Instance Storage
WHAT IS INSTANCE STORAGE?
• Some instance types come with direct attached disk-based storage
• Included in the hourly cost
• Data on instance storage does not persist a user-initiated
instance stop/start or hardware failure
• Must be allocated at launch
FAST DISK I/O WITHOUT GOING OVER THE NETWORK
• i3 instance type with NVMe drives, i3.16xlarge:
• Up to 3.3 million random IOPS @ 4KB block size
• Up to 16 GB/s sequential disk throughput
14. SQL Server Storage Optimization
Storage I/O contention is one of the
main causes for poor SQL Server
performance
• Match storage technology with I/O
pattern of workload components
• Match instance type to IOPS and
throughput needs of workload
• Format with 64K allocation unit size
• Create a single volume for data and
logs
SQL Server
Example Volume Layout
C:
Boot on General Purpose SSD
D:
Data and logs on Provisioned IOPS
K:
Backups on ST1 or SC1
Z:
Tempdb on instance storage (if available)
15. Tempdb Optimizations
CONSIDER:
• Using multiple tempdb files (1:1 mapping with CPUs, up to 8)
• Striping multiple instance storage disks together for higher I/O
• Changing SQL Server service startup to Automatic (Delayed Start) to allow instance
storage to provision
• Scripting/automating configuration on instance boot
Striping solution by consulting partner IFM Ltd.
http://www.ifm.net.nz/cookbooks/amazon-sql-tempdb/index.html
16. …from a performant SQL Server workload
…to a highly available, fault tolerant
and performant SQL Server workload
on Amazon EC2
17. SQL Server HA & DR on Amazon EC2
USE MULTIPLE AVAILABILITY ZONES (AZs)
• Implement Instance-level and AZ-level failure tolerance
• Synchronous replication across physical data centers
ENTERPRISE EDITION (2012+)
• Always On Availability Groups
• Shared nothing architecture (multi-subnet failover)
STANDARD EDITION
• Basic Always On Availability Groups (2016+)
• Failover Cluster Instances (FCI) using block storage replication
22. • SQL Server as a managed service
• Managing SQL Server storage and I/O performance
• Using highly available SQL Server deployments in Amazon RDS
• Configuration management
• Moving/migrating data from Amazon RDS
• Leveraging SQL Server’s native .bak backup and restore
Amazon RDS for SQL Server
Common design and configuration practices
23. SQL Server as a Managed Service
AMAZON RDS
• Same SQL Server DB engine as with Amazon EC2
• Management, monitoring and automation layer around the DB engine
• Automated full DB instance backups, with point in time restore
• Automated high availability
• Automated provisioning, patching, monitoring, directory integration
LIMITATIONS
• Cannot run SSRS, SSIS, SSAS on the DB instance (works as data source)
• Maximum 30 databases
• No sysadmin role, server Administrator or direct file system access
• Not supported: MSDTC, Maintenance Plans, Database Mail, Always On, Service Broker
24. Storage Performance Planning
AMAZON RDS STORAGE
• Low latency, persistent, network-attached block storage
• Cannot be scaled once initially provisioned
• Maximum storage: 16TB
• Maximum IOPS: 20,000
• Amazon RDS storage throughput
depends on DB instance class (see equivalent
EC2 EBS Optimized instance type)
MONITORING I/O EFFICIENCY
• CloudWatch Metric Average Queue Depth
- I/O requests waiting to be serviced
25. RDS for SQL Server High Availability
AMAZON RDS FOR SQL SERVER MULTI-AZ DEPLOYMENT
• Fully managed and automated HA solution in an AWS Region
• Principal and secondary DB nodes in different AZs
• Witness in a 3rd AZ
• Leverages SQL Server DB mirroring
• Works with Standard and Enterprise editions
• Secondary node is completely passive
• DNS endpoint provided for app connectivity
CONSIDERATIONS
• Mirroring impact on change heavy workloads
26. Amazon RDS Multi-AZ in Depth
FAILURE SCENARIOS MITIGATED
• Loss of availability in primary AZ
• Loss of network connectivity to principal DB node
• Compute unit or storage failure on principal DB node
FAILOVER PROCESS
Implement retry logic at the application layer – trigger manual failover to test
Mirroring
stopped
Address
apply debt
Promote to
master
Change
DNS
endpoint
Provision
new
secondary
YOUR RESPONSIBILITY
27. …from a performant, highly available and fault tolerant SQL
Server workload
…to a manageable such workload on
Amazon RDS over time
28. Centralized DB Engine Configuration
PARAMETER GROUPS OPTION GROUPS
• Centralized management of DB engine
parameters
• Ability to consistently apply
configurations to DB instances
• Auditability of configuration
• Sensible defaults work for most use
cases
• Ability to create custom parameter
groups
• Read-only vs. changeable parameters
• Applied immediately vs. requiring reboot
• Used for enabling additional features
• Ability to create custom option groups
• Supported options:
• Transparent Data Encryption (TDE) in
Enterprise Edition only
• S3 Backup & Restore
Exercise Caution - Change at Your Own Risk!
Follow Microsoft and documented best practices
29. RDS for SQL Server Data Movement
.BAK File Import and Export
Leverages SQL Server’s native backup functionality
AWS Database Migration Service
Supports heterogeneous migrations
AWS Marketplace
Third-party data import and export tools and
solutions
1
3
4
Database Publishing Wizard, Import/Export,
Bulk Copy
Use bcp; export to T-SQL files & load using sqlcmd
2
31. • Both Windows and Linux variants supported
• SQL Server Linux available using BYOL via distribution specific package
managers
• Cluster & cluster-less Availability Groups (WSFC, Pacemaker, None)
• SQL Server Linux on Amazon EC2:
• System DBs fixed to /var/opt/mssql/data
mount a different EBS volume at that location
SQL Server 2017
Supported on Amazon EC2 within 2 days of General Availability
32. Summary
DEPLOYMENT OPTIONS
• Self Managed: SQL Server on Amazon EC2 using Amazon EBS, instance storage,
Always On
• SQL Server on AWS: Quick Start Reference Deployment
https://aws.amazon.com/quickstart/architecture/sql/
• Managed Service: Amazon RDS for SQL Server using Multi-AZ
DATA MOVEMENT & MIGRATION
• Using native tools, AWS Database Migration Service or AWS Marketplace partner
solutions
BEST PRACTICES
• Whitepapers, Articles, Webinars, re:Invent and external talks, and more
• Whitepaper: Deploying SQL Server on AWS
• Articles: Using Linked Servers with RDS SQL Server; Replicating Data to RDS SQL
Server; Understanding General Purpose SSD Performance with RDS SQL Server
33. Free online webinar
events
Free 1-day local
training events
Local user groups
around the world
Online special
interest user groups
Business analytics
training
Free Online Resources
PASS Blog
White Papers
Session Recordings
Newsletter www.pass.org
Explore everything PASS has to offer
PASS Connector
BA Insights
Get involved
34. Session evaluations
Download the GuideBook App
and search: PASS Summit 2017
Follow the QR code link
displayed on session signage
throughout the conference
venue and in the program guide
Your feedback is important and valuable.
Go to passSummit.com
Submit by 5pm Friday, November 10th to win prizes. 3 Ways to Access: