SlideShare a Scribd company logo
1 of 49
@cloudgen_verona
#GlobalAzure
#CloudGenVerona
BASIC SPONSOR
PREMIUM SPONSOR
Thanks to all the sponsors
3
TOPIC
SQL Server
performance tuning
su Azure IaaS
Suggerimenti per massimizzare la resa delle
proprie VM SQL Server su Azure
@OmegaMadLab
https://github.com/OmegaMadLab
https://www.linkedin.com/in/marco-obinu-omegamadlab/
Who Am I?
Marco Obinu
Advisory Engineer @ Softjam S.p.A
Geek to the bone!
Agenda
 SQL Server su Azure
• Infrastructure as a Service: quando e perché
 Overview delle best practices suggerite da Microsoft
• Sizing della virtual machine
• Ottimizzazioni post deployment
 Automazione
SQL Server su Azure
Come, quando e perche?
SQL Server: Azure proposition
Minor TCO, a scapito delle funzionalità?
Voglio
Azure!
SQL VM
Single DB /
Pool
Maggior controllo? Minor TCO?
Managed
Instances
On-prem L&S? Nuovo progetto?
MANAGEDBYVENDOR
APPLICATION
HYPERVISOR
OS
RUNTIME
DATA
STORAGE
NETWORK
IaaS
YOUMANAGE
SERVERS
MANAGEDBYVENDOR
APPLICATION
HYPERVISOR
OS
RUNTIME
DATA
STORAGE
NETWORK
PaaS
YOUMANAGE
SERVERS
IaaS: quando e perché?
• Istanza di SQL Server in esecuzione in una macchina virtuale di
Azure
• Tutte le feature on-prem disponibili in cloud
• Controllo totale di SQL Server
• Velocità e agilità nel deployment, grazie ai template
• Licenza inclusa nel prezzo, o possibilità di utilizzo della propria
licenza
• Dev/Test
• Lift and Shift
• Scenari di DR
Microsoft Best Practices
Overview
Area Optimizations When to apply
DS3 or higher for SQL Enterprise edition.
DS2 or higher for SQL Standard and Web editions.
Use Premium Storage. Standard storage is only recommended for dev/test.
Keep the storage account and SQL Server VM in the same region.
Disable Azure geo-redundant storage (geo-replication) on the storage account.
Use a minimum of 2 P30 disks (1 for log files; 1 for data files and TempDB).
Enable read caching on the disk(s) hosting the data files and TempDB.
Do not enable caching on disk(s) hosting the log file.
Stripe multiple Azure data disks to get increased IO throughput.
Format with documented allocation sizes.
Avoid using operating system or temporary disks for database storage or logging.
Move all databases to data disks, including system databases.
Move SQL Server error log and trace file directories to data disks.
Setup default backup and database file locations.
Enable instant file initialization for data files.
Limit or disable autogrow on the database.
Disable autoshrink on the database.
Enable database page compression.
Enable locked pages.
Apply SQL Server performance fixes.
Feature specific Back up directly to blob storage.
VM size
Storage
Disks
I/O
During VM provisioning
After VM provisioning
https://azure.microsoft.com/en-us/documentation/articles/virtual-machines-windows-sql-performance/
Microsoft Best Practices
Dimensionamento della VM
Creazione della VM
Creazione della VM
Opzioni di alta disponibilità
Availability Set  2 VM 99,95% SLA
Availability Zone  2 VM in zone diverse 99,99% SLA
Creazione della VM
Creazione della VM
Famiglie e dimensioni VM
https://docs.microsoft.com/it-it/azure/virtual-machines/windows/sizes
Azure Compute Units
Single core performance, referred to an A-family core
SKU Family ACU/Core
Standard_A0 50
Standard_A1-4, Standard_A5-7, Standard_A1-8v2, Standard_A2m-8mv2 100
A8-A11 225*
D1-14, DS1-14 160
D1-15v2, DS1-15v2 210-250*
Dv3, DSv3, Ev3, ESv3 160-190* **
F1-F16, F1s-F16s 210-250*
F2Sv2-F72Sv2 195-210* **
G1-5, GS1-5, L4s-L32s 180-240*
H 290-300*
M 160-180 **
* use Intel® Turbo technology to increase CPU frequency and provide a performance boost.
** Hyper-Threaded hosts (1 physical core = 2 vCpu)
https://docs.microsoft.com/en-us/azure/virtual-machines/windows/acu
Famiglie e dimensioni VM
https://docs.microsoft.com/it-it/azure/virtual-machines/windows/sizes
Constrained CPU
Name vCPU Specs
Standard_E32-16_v3 16 Same as E32s_v3
Standard_E32-8s_v3 8 Same as E32s_v3
Standard_E64-32s_v3 32 Same as E64s_v3
Standard_E64-16s_v3 16 Same as E64s_v3
Standard_GS4-8 8 Same as GS4
Standard_GS4-4 4 Same as GS4
Standard_GS5-16 16 Same as GS5
Standard_GS5-8 8 Same as GS5
Standard_DS11-1_v2 1 Same as DS11_v2
Standard_DS12-2_v2 2 Same as DS12_v2
Standard_DS12-1_v2 1 Same as DS12_v2
Standard_DS13-4_v2 4 Same as DS13_v2
Standard_DS13-2_v2 2 Same as DS13_v2
Standard_DS14-8_v2 8 Same as DS14_v2
Standard_DS14-4_v2 4 Same as DS14_v2
Name vCPU Specs
Standard_M8-2ms 2 Same as M8ms
Standard_M8-4ms 4 Same as M8ms
Standard_M16-4ms 4 Same as M16ms
Standard_M16-8ms 8 Same as M16ms
Standard_M32-8ms 8 Same as M32ms
Standard_M32-16ms 16 Same as M32ms
Standard_M64-32ms 32 Same as M64ms
Standard_M64-16ms 16 Same as M64ms
Standard_M128-64ms 64 Same as M128ms
Standard_M128-32ms 32 Same as M128ms
Standard_E4-2s_v3 2 Same as E4s_v3
Standard_E8-4s_v3 4 Same as E8s_v3
Standard_E8-2s_v3 2 Same as E8s_v3
Standard_E16-8s_v3 8 Same as E16s_v3
Standard_E16-4s_v3 4 Same as E16s_v3
https://docs.microsoft.com/en-us/azure/virtual-machines/windows/constrained-vcpu
Famiglie e dimensioni VM - storage
https://docs.microsoft.com/it-it/azure/virtual-machines/windows/sizes
Architettura storage VM
VM
Host Azure Storage
Blobcache
RAM cache
Server SSD cacheTemp Disk OS Disk Data Disk Data Disk
Cached throughput Uncached throughput
https://azure.microsoft.com/en-us/blog/azure-premium-storage-now-generally-available-2/
Best practices
 Taglie minime raccomandate:
 DS2_v2 (2 vCPU 7 GB RAM) per SQL Server Standard Edition
 DS3_v2 (4 vCPU 14 GB RAM) per SQL Server Enterprise Edition
Qualche suggerimento in più…
 Attenzione al licensing!!!
 Attenzione alle ACU!!!
 Usate VM che supportano Premium Storage
1
Creazione della VM
Creazione della VM
Creazione della VM
Tipologie dischi
Ultra SSD (preview) Premium SSD Standard SSD Standard HDD
Disk type SSD SSD SSD HDD
Scenario
IO-intensive workloads
such as SAP HANA, top
tier databases (for
example, SQL, Oracle),
and other transaction-
heavy workloads.
Production and
performance sensitive
workloads
Web servers, lightly
used enterprise
applications and
dev/test
Backup, non-critical,
infrequent access
Disk size
65,536 gibibyte (GiB)
(Preview)
32,767 GiB 32,767 GiB 32,767 GiB
Max throughput 2,000 MiB/s (Preview) 900 MiB/s 750 MiB/s 500 MiB/s
Max IOPS 160,000 (Preview) 20,000 6,000 2,000
https://docs.microsoft.com/en-us/azure/virtual-machines/windows/disks-types
Creazione della VM
Unmanaged vs. Managed Disks
• Premium Storage account limits:
• 50 Gbps bandwidth
• 35 TB for disks
• 10 TB for snapshots
• Standard Storage account limits:
• 50 Gbps bandwidth
• 35 TB for disks
• 10 TB for snapshots
https://blogs.msdn.microsoft.com/igorpag/2017/03/14/azure-managed-disks-deep-dive-lessons-learned-and-benefits/
Best practices
 Usate Premium Storage con replica locale, e posizionate
lo storage account nello stesso datacenter della VM
 Lo storage geo-replicato è supportato solo in scenari
molto particolari  utilizzate feature applicative per
ottenere geo-ridondanza
Qualche suggerimento in più…
 Possibilmente utilizzate dischi managed
 Se usate dischi unmanaged, attenzione al posizionamento su storage
account
1
Creazione della VM
Creazione della VM
Creazione della VM
Creazione della VM
Creazione della VM
Creazione della VM
Tipologie dischi
P
R
E
M
I
U
M
S
S
D
Type P4 P6 P10 P15 P20 P30 P40 P50 P60 P70 P80
Disk size in GiB 32 64 128 256 512 1,024 2,048 4,095 8,192 16,384 32,767
IOPS per disk Up to 120 Up to 240 Up to 500 Up to 1,100 Up to 2,300 Up to 5,000 Up to 7,500 Up to 7,500
Up to
16,000
Up to
18,000
Up to
20,000
Throughput per
disk
Up to 25
MiB/sec
Up to 50
MiB/sec
Up to 100
MiB/sec
Up to 125
MiB/sec
Up to 150
MiB/sec
Up to 200
MiB/sec
Up to 250
MiB/sec
Up to 250
MiB/sec
Up to 500
MiB/sec
Up to 750
MiB/sec
Up to 900
MiB/sec
S
T
A
N
D
A
R
D
S
S
D
Type E4 E6 E10 E15 E20 E30 E40 E50 E60 E70 E80
Disk size in GiB 32 64 128 256 512 1,024 2,048 4,095 8,192 16,384 32,767
IOPS per disk Up to 120 Up to 240 Up to 500 Up to 500 Up to 500 Up to 500 Up to 500 Up to 500 Up to 2,000 Up to 4,000 Up to 6,000
Throughput per
disk
Up to 25
MiB/sec
Up to 50
MiB/sec
Up to 60
MiB/sec
Up to 60
MiB/sec
Up to 60
MiB/sec
Up to 60
MiB/sec
Up to 60
MiB/sec
Up to 60
MiB/sec
Up to 400
MiB/sec
Up to 600
MiB/sec
Up to 750
MiB/sec
S
T
A
N
D
A
R
D
H
D
D
Type S4 S6 S10 S15 S20 S30 S40 S50 S60 S70 S80
Disk size in GiB 32 64 128 256 512 1,024 2,048 4,095 8,192 16,384 32,767
IOPS per disk Up to 500 Up to 500 Up to 500 Up to 500 Up to 500 Up to 500 Up to 500 Up to 500 Up to 1,300 Up to 2,000 Up to 2,000
Throughput per
disk
Up to 60
MiB/sec
Up to 60
MiB/sec
Up to 60
MiB/sec
Up to 60
MiB/sec
Up to 60
MiB/sec
Up to 60
MiB/sec
Up to 60
MiB/sec
Up to 60
MiB/sec
Up to 300
MiB/sec
Up to 500
MiB/sec
Up to 500
MiB/sec
https://docs.microsoft.com/en-us/azure/virtual-machines/windows/disks-types
Famiglie e dimensioni VM - storage
https://docs.microsoft.com/it-it/azure/virtual-machines/windows/sizes
Best practices
 Usare dischi Premium SSD per workload di produzione
 Almeno un disco P30 per i dati ed un P30 per i log
 Cache Read-Only per dischi dati e TempDB
 Cache None per dischi log o write intensive
 Utilizzare Storage Spaces per creare volumi in striping
• Columns = numero dischi in striping
• Interleave = 64KB se workload OLTP, 256KB se workload DWH
 Formattare i dischi con dimensione unità di allocazione = 64 KB
Qualche suggerimento in più…
 Max due dischi per ogni vCPU
 Considerate la possibilità di utilizzare il disco temporaneo per il TempDB
 Se utilizzate standard storage:
• Utilizzate il numero massimo di dischi supportato dalla VM in striping
• Impostate la cache a None su tutti i dischi
Creazione della VM
Microsoft Best Practices
Step post-deployment
Best practices
 Evitate di utilizzare il disco OS per ospitare database, ERRORLOG,
Trace e backup
• Spostare tutto su data disk:
• Impostare path di default per database e backups
• Spostare MSDB, MODEL, TEMPDB:
1. ALTER DATABASE database_name MODIFY FILE ( NAME = logical_name , FILENAME =
'new_pathos_file_name' )
2. Spostare i file
3. Riavviare istanza
• Spostare MASTER, Log SQL e Default Trace:
1. Stop istanza
2. Da SQL Configuration Manager cambiare parametri di startup
3. Spostare i file
4. Riavviare istanza
Best practices
 Tenere sotto controllo la dimensione dei database
• Autogrowth = ultima spiaggia 
• Disabilitare Auto Shrink  Impatto su I/O e su frammentazione indici
 Privilegi da concedere all’account di servizio
• Perform volume maintenance tasks per abilitare Instant File Initialization  funziona solo sui data files!
• Lock Pages in Memory per limitare il paging della memoria utilizzata da SQL
 Valutare l’abilitazione della Page Compression su tabelle ed indici
 Su SQL 2012 installare la CU10 o successiva per SP1 o la CU1
o successive per SP2
Best practices
 Valutare la possibilità di eseguire backup direttamente su
storage account
Storage AccountSQL Server VM
Backup
Qualche suggerimento in più…
 Disabilitare eventuali servizi non necessari (SSAS, SSRS)
 Impostare il valore massimo di memoria utilizzabile da SQL Server
per evitare contesa di risorse con il sistema operativo
 Valutare la possibilità di suddividere il TempDB in più datafile
 Valutare la possibilità di utilizzare il disco temporaneo per il
TempDB
 Valutare l’utilizzo di Trace Flag su SQL 2012/2014
• -T1117 e -T1118 per workload OLTP
• -T1117 e -T610 per workload DW
Automazione
Qualche suggerimento
Automazione
• PowerShell
• dbatools.io
• ARM Template
• PowerShell Desired State Configuration
• Azure Custom Script Extension
Da dove cominciare…
• Official docs
https://azure.microsoft.com/en-us/documentation/articles/virtual-machines-windows-sql-performance/
https://docs.microsoft.com/en-us/azure/virtual-machines/windows/sql/virtual-machines-windows-sql-
server-storage-configuration
• GitHub Azure Quickstart Templates
https://github.com/Azure/azure-quickstart-templates
• SQL Server optimized template
https://github.com/OmegaMadLab/OptimizedSqlVm
• Optimize-SqlVmIaas PoSH script
https://github.com/OmegaMadLab/Optimize-SqlIaasVm
Thanks
Questions?
https://github.com/OmegaMadLab
@OmegaMadLab
https://www.linkedin.com/in/marco-obinu-omegamadlab/

More Related Content

Similar to Global Azure BootCamp 2019 - Verona - Ottimizzazione delle VM SQL Server su Azure IaaS

Virtualizzare Nanosoft
Virtualizzare   NanosoftVirtualizzare   Nanosoft
Virtualizzare NanosoftDario Vemagi
 
VMUGIT - Virtualizzare con i piedi per terra
VMUGIT - Virtualizzare con i piedi per terraVMUGIT - Virtualizzare con i piedi per terra
VMUGIT - Virtualizzare con i piedi per terraVMUG IT
 
Presentazione al VMUGIT UC 2014 - Virtualizzare con i piedi per terra
Presentazione al VMUGIT UC 2014 - Virtualizzare con i piedi per terraPresentazione al VMUGIT UC 2014 - Virtualizzare con i piedi per terra
Presentazione al VMUGIT UC 2014 - Virtualizzare con i piedi per terraAndrea Mauro
 
Presentazione storage concetti base pdf
Presentazione storage   concetti base pdfPresentazione storage   concetti base pdf
Presentazione storage concetti base pdfAFB Net
 
MongoDB Atlas: il modo migliore per eseguire MongoDB in ambiente cloud 1
MongoDB Atlas: il modo migliore per eseguire MongoDB in ambiente cloud 1MongoDB Atlas: il modo migliore per eseguire MongoDB in ambiente cloud 1
MongoDB Atlas: il modo migliore per eseguire MongoDB in ambiente cloud 1MongoDB
 
Introduzione al Cloud - Progetto ICARO
Introduzione al Cloud - Progetto ICAROIntroduzione al Cloud - Progetto ICARO
Introduzione al Cloud - Progetto ICAROPaolo Nesi
 
Back to Basics, webinar 6: Messa in esercizio
Back to Basics, webinar 6: Messa in esercizioBack to Basics, webinar 6: Messa in esercizio
Back to Basics, webinar 6: Messa in esercizioMongoDB
 
VMUG.IT @ ITway Campus 2014
VMUG.IT @ ITway Campus 2014VMUG.IT @ ITway Campus 2014
VMUG.IT @ ITway Campus 2014Andrea Mauro
 
20160402_mlraviol_mariadb_TorinoWordCamp
20160402_mlraviol_mariadb_TorinoWordCamp20160402_mlraviol_mariadb_TorinoWordCamp
20160402_mlraviol_mariadb_TorinoWordCampmlraviol
 
CCI2019 - SQL Server ed Azure: Disaster Recovery per tutti
CCI2019 - SQL Server ed Azure: Disaster Recovery per tuttiCCI2019 - SQL Server ed Azure: Disaster Recovery per tutti
CCI2019 - SQL Server ed Azure: Disaster Recovery per tuttiwalk2talk srl
 
Microservices webinar EMEA Aug. 2017
Microservices webinar EMEA Aug. 2017Microservices webinar EMEA Aug. 2017
Microservices webinar EMEA Aug. 2017MongoDB
 
Realizzazione di Microservizi con Docker, Kubernetes, Kafka e Mongodb
Realizzazione di Microservizi con Docker, Kubernetes, Kafka e MongodbRealizzazione di Microservizi con Docker, Kubernetes, Kafka e Mongodb
Realizzazione di Microservizi con Docker, Kubernetes, Kafka e MongodbMongoDB
 
Come l’Open Source può essere alla base di un business di successo: il caso H...
Come l’Open Source può essere alla base di un business di successo: il caso H...Come l’Open Source può essere alla base di un business di successo: il caso H...
Come l’Open Source può essere alla base di un business di successo: il caso H...MariaDB plc
 
VMUGIT UC 2013 - 09b VMUGIT SMB
VMUGIT UC 2013 - 09b VMUGIT SMB VMUGIT UC 2013 - 09b VMUGIT SMB
VMUGIT UC 2013 - 09b VMUGIT SMB VMUG IT
 
10 suggerimenti per aumentare le performance di sql server senza spendere 1 euro
10 suggerimenti per aumentare le performance di sql server senza spendere 1 euro10 suggerimenti per aumentare le performance di sql server senza spendere 1 euro
10 suggerimenti per aumentare le performance di sql server senza spendere 1 euroRenzo Sotgia
 
10 SUGGERIMENTI PER AUMENTARE LE PERFORMANCE DI SQL SERVER SENZA SPENDERE 1 EURO
10 SUGGERIMENTI PER AUMENTARE LE PERFORMANCE DI SQL SERVER SENZA SPENDERE 1 EURO10 SUGGERIMENTI PER AUMENTARE LE PERFORMANCE DI SQL SERVER SENZA SPENDERE 1 EURO
10 SUGGERIMENTI PER AUMENTARE LE PERFORMANCE DI SQL SERVER SENZA SPENDERE 1 EURORenzo Sotgia
 
Partner Day Milano - dicembre 2015 - Software Difined Storage. Disaster recov...
Partner Day Milano - dicembre 2015 - Software Difined Storage. Disaster recov...Partner Day Milano - dicembre 2015 - Software Difined Storage. Disaster recov...
Partner Day Milano - dicembre 2015 - Software Difined Storage. Disaster recov...Clouditalia Telecomunicazioni
 

Similar to Global Azure BootCamp 2019 - Verona - Ottimizzazione delle VM SQL Server su Azure IaaS (20)

Virtualizzare Nanosoft
Virtualizzare   NanosoftVirtualizzare   Nanosoft
Virtualizzare Nanosoft
 
VMUGIT - Virtualizzare con i piedi per terra
VMUGIT - Virtualizzare con i piedi per terraVMUGIT - Virtualizzare con i piedi per terra
VMUGIT - Virtualizzare con i piedi per terra
 
Presentazione al VMUGIT UC 2014 - Virtualizzare con i piedi per terra
Presentazione al VMUGIT UC 2014 - Virtualizzare con i piedi per terraPresentazione al VMUGIT UC 2014 - Virtualizzare con i piedi per terra
Presentazione al VMUGIT UC 2014 - Virtualizzare con i piedi per terra
 
Presentazione storage concetti base pdf
Presentazione storage   concetti base pdfPresentazione storage   concetti base pdf
Presentazione storage concetti base pdf
 
MongoDB Atlas: il modo migliore per eseguire MongoDB in ambiente cloud 1
MongoDB Atlas: il modo migliore per eseguire MongoDB in ambiente cloud 1MongoDB Atlas: il modo migliore per eseguire MongoDB in ambiente cloud 1
MongoDB Atlas: il modo migliore per eseguire MongoDB in ambiente cloud 1
 
Introduzione al Cloud - Progetto ICARO
Introduzione al Cloud - Progetto ICAROIntroduzione al Cloud - Progetto ICARO
Introduzione al Cloud - Progetto ICARO
 
Back to Basics, webinar 6: Messa in esercizio
Back to Basics, webinar 6: Messa in esercizioBack to Basics, webinar 6: Messa in esercizio
Back to Basics, webinar 6: Messa in esercizio
 
VMUG.IT @ ITway Campus 2014
VMUG.IT @ ITway Campus 2014VMUG.IT @ ITway Campus 2014
VMUG.IT @ ITway Campus 2014
 
20160402_mlraviol_mariadb_TorinoWordCamp
20160402_mlraviol_mariadb_TorinoWordCamp20160402_mlraviol_mariadb_TorinoWordCamp
20160402_mlraviol_mariadb_TorinoWordCamp
 
CCI2019 - SQL Server ed Azure: Disaster Recovery per tutti
CCI2019 - SQL Server ed Azure: Disaster Recovery per tuttiCCI2019 - SQL Server ed Azure: Disaster Recovery per tutti
CCI2019 - SQL Server ed Azure: Disaster Recovery per tutti
 
Microservices webinar EMEA Aug. 2017
Microservices webinar EMEA Aug. 2017Microservices webinar EMEA Aug. 2017
Microservices webinar EMEA Aug. 2017
 
Realizzazione di Microservizi con Docker, Kubernetes, Kafka e Mongodb
Realizzazione di Microservizi con Docker, Kubernetes, Kafka e MongodbRealizzazione di Microservizi con Docker, Kubernetes, Kafka e Mongodb
Realizzazione di Microservizi con Docker, Kubernetes, Kafka e Mongodb
 
Come l’Open Source può essere alla base di un business di successo: il caso H...
Come l’Open Source può essere alla base di un business di successo: il caso H...Come l’Open Source può essere alla base di un business di successo: il caso H...
Come l’Open Source può essere alla base di un business di successo: il caso H...
 
VMUGIT UC 2013 - 09b VMUGIT SMB
VMUGIT UC 2013 - 09b VMUGIT SMB VMUGIT UC 2013 - 09b VMUGIT SMB
VMUGIT UC 2013 - 09b VMUGIT SMB
 
Microsoft Azure
Microsoft AzureMicrosoft Azure
Microsoft Azure
 
IBM FlashSystem 810 e 710
IBM FlashSystem 810 e 710IBM FlashSystem 810 e 710
IBM FlashSystem 810 e 710
 
Ha solutions su power i
Ha solutions su power iHa solutions su power i
Ha solutions su power i
 
10 suggerimenti per aumentare le performance di sql server senza spendere 1 euro
10 suggerimenti per aumentare le performance di sql server senza spendere 1 euro10 suggerimenti per aumentare le performance di sql server senza spendere 1 euro
10 suggerimenti per aumentare le performance di sql server senza spendere 1 euro
 
10 SUGGERIMENTI PER AUMENTARE LE PERFORMANCE DI SQL SERVER SENZA SPENDERE 1 EURO
10 SUGGERIMENTI PER AUMENTARE LE PERFORMANCE DI SQL SERVER SENZA SPENDERE 1 EURO10 SUGGERIMENTI PER AUMENTARE LE PERFORMANCE DI SQL SERVER SENZA SPENDERE 1 EURO
10 SUGGERIMENTI PER AUMENTARE LE PERFORMANCE DI SQL SERVER SENZA SPENDERE 1 EURO
 
Partner Day Milano - dicembre 2015 - Software Difined Storage. Disaster recov...
Partner Day Milano - dicembre 2015 - Software Difined Storage. Disaster recov...Partner Day Milano - dicembre 2015 - Software Difined Storage. Disaster recov...
Partner Day Milano - dicembre 2015 - Software Difined Storage. Disaster recov...
 

More from Marco Obinu

Securing an Azure full-PaaS architecture - Data saturday #0001 Pordenone
Securing an Azure full-PaaS architecture - Data saturday #0001 PordenoneSecuring an Azure full-PaaS architecture - Data saturday #0001 Pordenone
Securing an Azure full-PaaS architecture - Data saturday #0001 PordenoneMarco Obinu
 
Implement a disaster recovery solution for your on-prem SQL with Azure? Easy!
Implement a disaster recovery solution for your on-prem SQL with Azure? Easy!Implement a disaster recovery solution for your on-prem SQL with Azure? Easy!
Implement a disaster recovery solution for your on-prem SQL with Azure? Easy!Marco Obinu
 
Infrastructure as Code on Azure - Show your Bicep! v0.2 - .NetConf 2020 by Do...
Infrastructure as Code on Azure - Show your Bicep! v0.2 - .NetConf 2020 by Do...Infrastructure as Code on Azure - Show your Bicep! v0.2 - .NetConf 2020 by Do...
Infrastructure as Code on Azure - Show your Bicep! v0.2 - .NetConf 2020 by Do...Marco Obinu
 
Infrastructure as Code on Azure: Show your Bicep!
Infrastructure as Code on Azure: Show your Bicep!Infrastructure as Code on Azure: Show your Bicep!
Infrastructure as Code on Azure: Show your Bicep!Marco Obinu
 
Sql Start! 2020 - SQL Server Lift & Shift su Azure
Sql Start! 2020 - SQL Server Lift & Shift su AzureSql Start! 2020 - SQL Server Lift & Shift su Azure
Sql Start! 2020 - SQL Server Lift & Shift su AzureMarco Obinu
 
SQL Server Lift & Shift on Azure - SQL Saturday 921
SQL Server Lift & Shift on Azure - SQL Saturday 921SQL Server Lift & Shift on Azure - SQL Saturday 921
SQL Server Lift & Shift on Azure - SQL Saturday 921Marco Obinu
 
SQL Server Disaster Recovery on Azure - SQL Saturday 921
SQL Server Disaster Recovery on Azure - SQL Saturday 921SQL Server Disaster Recovery on Azure - SQL Saturday 921
SQL Server Disaster Recovery on Azure - SQL Saturday 921Marco Obinu
 
Azure VM 101 - HomeGen by CloudGen Verona - Marco Obinu
Azure VM 101 - HomeGen by CloudGen Verona - Marco ObinuAzure VM 101 - HomeGen by CloudGen Verona - Marco Obinu
Azure VM 101 - HomeGen by CloudGen Verona - Marco ObinuMarco Obinu
 
Global Azure Virtual 2020 What's new on Azure IaaS for SQL VMs
Global Azure Virtual 2020 What's new on Azure IaaS for SQL VMsGlobal Azure Virtual 2020 What's new on Azure IaaS for SQL VMs
Global Azure Virtual 2020 What's new on Azure IaaS for SQL VMsMarco Obinu
 
Azure Day Reloaded 2019 - React to infrastructure events with Azure Monitor
Azure Day Reloaded 2019 - React to infrastructure events with Azure MonitorAzure Day Reloaded 2019 - React to infrastructure events with Azure Monitor
Azure Day Reloaded 2019 - React to infrastructure events with Azure MonitorMarco Obinu
 
Azure Day Reloaded 2019 - ARM Template workshop
Azure Day Reloaded 2019 - ARM Template workshopAzure Day Reloaded 2019 - ARM Template workshop
Azure Day Reloaded 2019 - ARM Template workshopMarco Obinu
 
Sql Saturday 895 - SQL Server e PowerShell: from Zero to Hero
Sql Saturday 895 - SQL Server e PowerShell: from Zero to HeroSql Saturday 895 - SQL Server e PowerShell: from Zero to Hero
Sql Saturday 895 - SQL Server e PowerShell: from Zero to HeroMarco Obinu
 
Automazione serverless con Azure Functions e PowerShell - Marco Obinu - DevOp...
Automazione serverless con Azure Functions e PowerShell - Marco Obinu - DevOp...Automazione serverless con Azure Functions e PowerShell - Marco Obinu - DevOp...
Automazione serverless con Azure Functions e PowerShell - Marco Obinu - DevOp...Marco Obinu
 
Azure Saturday Pordenone 2019 - Reagire agli eventi di infrastruttura con Azu...
Azure Saturday Pordenone 2019 - Reagire agli eventi di infrastruttura con Azu...Azure Saturday Pordenone 2019 - Reagire agli eventi di infrastruttura con Azu...
Azure Saturday Pordenone 2019 - Reagire agli eventi di infrastruttura con Azu...Marco Obinu
 
SQL Saturday 871 - Sardegna 2019 - SQL Server DR on Azure
SQL Saturday 871 - Sardegna 2019 - SQL Server DR on AzureSQL Saturday 871 - Sardegna 2019 - SQL Server DR on Azure
SQL Saturday 871 - Sardegna 2019 - SQL Server DR on AzureMarco Obinu
 
SQL Start! 2019 - Ancona - Distribuisci ed amministra le tue istanze SQL Serv...
SQL Start! 2019 - Ancona - Distribuisci ed amministra le tue istanze SQL Serv...SQL Start! 2019 - Ancona - Distribuisci ed amministra le tue istanze SQL Serv...
SQL Start! 2019 - Ancona - Distribuisci ed amministra le tue istanze SQL Serv...Marco Obinu
 
Global Azure BootCamp 2019 - Verona - Azure Cloud Shell
Global Azure BootCamp 2019 - Verona - Azure Cloud ShellGlobal Azure BootCamp 2019 - Verona - Azure Cloud Shell
Global Azure BootCamp 2019 - Verona - Azure Cloud ShellMarco Obinu
 

More from Marco Obinu (17)

Securing an Azure full-PaaS architecture - Data saturday #0001 Pordenone
Securing an Azure full-PaaS architecture - Data saturday #0001 PordenoneSecuring an Azure full-PaaS architecture - Data saturday #0001 Pordenone
Securing an Azure full-PaaS architecture - Data saturday #0001 Pordenone
 
Implement a disaster recovery solution for your on-prem SQL with Azure? Easy!
Implement a disaster recovery solution for your on-prem SQL with Azure? Easy!Implement a disaster recovery solution for your on-prem SQL with Azure? Easy!
Implement a disaster recovery solution for your on-prem SQL with Azure? Easy!
 
Infrastructure as Code on Azure - Show your Bicep! v0.2 - .NetConf 2020 by Do...
Infrastructure as Code on Azure - Show your Bicep! v0.2 - .NetConf 2020 by Do...Infrastructure as Code on Azure - Show your Bicep! v0.2 - .NetConf 2020 by Do...
Infrastructure as Code on Azure - Show your Bicep! v0.2 - .NetConf 2020 by Do...
 
Infrastructure as Code on Azure: Show your Bicep!
Infrastructure as Code on Azure: Show your Bicep!Infrastructure as Code on Azure: Show your Bicep!
Infrastructure as Code on Azure: Show your Bicep!
 
Sql Start! 2020 - SQL Server Lift & Shift su Azure
Sql Start! 2020 - SQL Server Lift & Shift su AzureSql Start! 2020 - SQL Server Lift & Shift su Azure
Sql Start! 2020 - SQL Server Lift & Shift su Azure
 
SQL Server Lift & Shift on Azure - SQL Saturday 921
SQL Server Lift & Shift on Azure - SQL Saturday 921SQL Server Lift & Shift on Azure - SQL Saturday 921
SQL Server Lift & Shift on Azure - SQL Saturday 921
 
SQL Server Disaster Recovery on Azure - SQL Saturday 921
SQL Server Disaster Recovery on Azure - SQL Saturday 921SQL Server Disaster Recovery on Azure - SQL Saturday 921
SQL Server Disaster Recovery on Azure - SQL Saturday 921
 
Azure VM 101 - HomeGen by CloudGen Verona - Marco Obinu
Azure VM 101 - HomeGen by CloudGen Verona - Marco ObinuAzure VM 101 - HomeGen by CloudGen Verona - Marco Obinu
Azure VM 101 - HomeGen by CloudGen Verona - Marco Obinu
 
Global Azure Virtual 2020 What's new on Azure IaaS for SQL VMs
Global Azure Virtual 2020 What's new on Azure IaaS for SQL VMsGlobal Azure Virtual 2020 What's new on Azure IaaS for SQL VMs
Global Azure Virtual 2020 What's new on Azure IaaS for SQL VMs
 
Azure Day Reloaded 2019 - React to infrastructure events with Azure Monitor
Azure Day Reloaded 2019 - React to infrastructure events with Azure MonitorAzure Day Reloaded 2019 - React to infrastructure events with Azure Monitor
Azure Day Reloaded 2019 - React to infrastructure events with Azure Monitor
 
Azure Day Reloaded 2019 - ARM Template workshop
Azure Day Reloaded 2019 - ARM Template workshopAzure Day Reloaded 2019 - ARM Template workshop
Azure Day Reloaded 2019 - ARM Template workshop
 
Sql Saturday 895 - SQL Server e PowerShell: from Zero to Hero
Sql Saturday 895 - SQL Server e PowerShell: from Zero to HeroSql Saturday 895 - SQL Server e PowerShell: from Zero to Hero
Sql Saturday 895 - SQL Server e PowerShell: from Zero to Hero
 
Automazione serverless con Azure Functions e PowerShell - Marco Obinu - DevOp...
Automazione serverless con Azure Functions e PowerShell - Marco Obinu - DevOp...Automazione serverless con Azure Functions e PowerShell - Marco Obinu - DevOp...
Automazione serverless con Azure Functions e PowerShell - Marco Obinu - DevOp...
 
Azure Saturday Pordenone 2019 - Reagire agli eventi di infrastruttura con Azu...
Azure Saturday Pordenone 2019 - Reagire agli eventi di infrastruttura con Azu...Azure Saturday Pordenone 2019 - Reagire agli eventi di infrastruttura con Azu...
Azure Saturday Pordenone 2019 - Reagire agli eventi di infrastruttura con Azu...
 
SQL Saturday 871 - Sardegna 2019 - SQL Server DR on Azure
SQL Saturday 871 - Sardegna 2019 - SQL Server DR on AzureSQL Saturday 871 - Sardegna 2019 - SQL Server DR on Azure
SQL Saturday 871 - Sardegna 2019 - SQL Server DR on Azure
 
SQL Start! 2019 - Ancona - Distribuisci ed amministra le tue istanze SQL Serv...
SQL Start! 2019 - Ancona - Distribuisci ed amministra le tue istanze SQL Serv...SQL Start! 2019 - Ancona - Distribuisci ed amministra le tue istanze SQL Serv...
SQL Start! 2019 - Ancona - Distribuisci ed amministra le tue istanze SQL Serv...
 
Global Azure BootCamp 2019 - Verona - Azure Cloud Shell
Global Azure BootCamp 2019 - Verona - Azure Cloud ShellGlobal Azure BootCamp 2019 - Verona - Azure Cloud Shell
Global Azure BootCamp 2019 - Verona - Azure Cloud Shell
 

Global Azure BootCamp 2019 - Verona - Ottimizzazione delle VM SQL Server su Azure IaaS

  • 3. 3 TOPIC SQL Server performance tuning su Azure IaaS Suggerimenti per massimizzare la resa delle proprie VM SQL Server su Azure
  • 5. Agenda  SQL Server su Azure • Infrastructure as a Service: quando e perché  Overview delle best practices suggerite da Microsoft • Sizing della virtual machine • Ottimizzazioni post deployment  Automazione
  • 6. SQL Server su Azure Come, quando e perche?
  • 7. SQL Server: Azure proposition Minor TCO, a scapito delle funzionalità? Voglio Azure! SQL VM Single DB / Pool Maggior controllo? Minor TCO? Managed Instances On-prem L&S? Nuovo progetto? MANAGEDBYVENDOR APPLICATION HYPERVISOR OS RUNTIME DATA STORAGE NETWORK IaaS YOUMANAGE SERVERS MANAGEDBYVENDOR APPLICATION HYPERVISOR OS RUNTIME DATA STORAGE NETWORK PaaS YOUMANAGE SERVERS
  • 8. IaaS: quando e perché? • Istanza di SQL Server in esecuzione in una macchina virtuale di Azure • Tutte le feature on-prem disponibili in cloud • Controllo totale di SQL Server • Velocità e agilità nel deployment, grazie ai template • Licenza inclusa nel prezzo, o possibilità di utilizzo della propria licenza • Dev/Test • Lift and Shift • Scenari di DR
  • 10. Area Optimizations When to apply DS3 or higher for SQL Enterprise edition. DS2 or higher for SQL Standard and Web editions. Use Premium Storage. Standard storage is only recommended for dev/test. Keep the storage account and SQL Server VM in the same region. Disable Azure geo-redundant storage (geo-replication) on the storage account. Use a minimum of 2 P30 disks (1 for log files; 1 for data files and TempDB). Enable read caching on the disk(s) hosting the data files and TempDB. Do not enable caching on disk(s) hosting the log file. Stripe multiple Azure data disks to get increased IO throughput. Format with documented allocation sizes. Avoid using operating system or temporary disks for database storage or logging. Move all databases to data disks, including system databases. Move SQL Server error log and trace file directories to data disks. Setup default backup and database file locations. Enable instant file initialization for data files. Limit or disable autogrow on the database. Disable autoshrink on the database. Enable database page compression. Enable locked pages. Apply SQL Server performance fixes. Feature specific Back up directly to blob storage. VM size Storage Disks I/O During VM provisioning After VM provisioning https://azure.microsoft.com/en-us/documentation/articles/virtual-machines-windows-sql-performance/
  • 14. Opzioni di alta disponibilità Availability Set  2 VM 99,95% SLA Availability Zone  2 VM in zone diverse 99,99% SLA
  • 17. Famiglie e dimensioni VM https://docs.microsoft.com/it-it/azure/virtual-machines/windows/sizes
  • 18. Azure Compute Units Single core performance, referred to an A-family core SKU Family ACU/Core Standard_A0 50 Standard_A1-4, Standard_A5-7, Standard_A1-8v2, Standard_A2m-8mv2 100 A8-A11 225* D1-14, DS1-14 160 D1-15v2, DS1-15v2 210-250* Dv3, DSv3, Ev3, ESv3 160-190* ** F1-F16, F1s-F16s 210-250* F2Sv2-F72Sv2 195-210* ** G1-5, GS1-5, L4s-L32s 180-240* H 290-300* M 160-180 ** * use Intel® Turbo technology to increase CPU frequency and provide a performance boost. ** Hyper-Threaded hosts (1 physical core = 2 vCpu) https://docs.microsoft.com/en-us/azure/virtual-machines/windows/acu
  • 19. Famiglie e dimensioni VM https://docs.microsoft.com/it-it/azure/virtual-machines/windows/sizes
  • 20. Constrained CPU Name vCPU Specs Standard_E32-16_v3 16 Same as E32s_v3 Standard_E32-8s_v3 8 Same as E32s_v3 Standard_E64-32s_v3 32 Same as E64s_v3 Standard_E64-16s_v3 16 Same as E64s_v3 Standard_GS4-8 8 Same as GS4 Standard_GS4-4 4 Same as GS4 Standard_GS5-16 16 Same as GS5 Standard_GS5-8 8 Same as GS5 Standard_DS11-1_v2 1 Same as DS11_v2 Standard_DS12-2_v2 2 Same as DS12_v2 Standard_DS12-1_v2 1 Same as DS12_v2 Standard_DS13-4_v2 4 Same as DS13_v2 Standard_DS13-2_v2 2 Same as DS13_v2 Standard_DS14-8_v2 8 Same as DS14_v2 Standard_DS14-4_v2 4 Same as DS14_v2 Name vCPU Specs Standard_M8-2ms 2 Same as M8ms Standard_M8-4ms 4 Same as M8ms Standard_M16-4ms 4 Same as M16ms Standard_M16-8ms 8 Same as M16ms Standard_M32-8ms 8 Same as M32ms Standard_M32-16ms 16 Same as M32ms Standard_M64-32ms 32 Same as M64ms Standard_M64-16ms 16 Same as M64ms Standard_M128-64ms 64 Same as M128ms Standard_M128-32ms 32 Same as M128ms Standard_E4-2s_v3 2 Same as E4s_v3 Standard_E8-4s_v3 4 Same as E8s_v3 Standard_E8-2s_v3 2 Same as E8s_v3 Standard_E16-8s_v3 8 Same as E16s_v3 Standard_E16-4s_v3 4 Same as E16s_v3 https://docs.microsoft.com/en-us/azure/virtual-machines/windows/constrained-vcpu
  • 21. Famiglie e dimensioni VM - storage https://docs.microsoft.com/it-it/azure/virtual-machines/windows/sizes
  • 22. Architettura storage VM VM Host Azure Storage Blobcache RAM cache Server SSD cacheTemp Disk OS Disk Data Disk Data Disk Cached throughput Uncached throughput https://azure.microsoft.com/en-us/blog/azure-premium-storage-now-generally-available-2/
  • 23. Best practices  Taglie minime raccomandate:  DS2_v2 (2 vCPU 7 GB RAM) per SQL Server Standard Edition  DS3_v2 (4 vCPU 14 GB RAM) per SQL Server Enterprise Edition Qualche suggerimento in più…  Attenzione al licensing!!!  Attenzione alle ACU!!!  Usate VM che supportano Premium Storage 1
  • 27. Tipologie dischi Ultra SSD (preview) Premium SSD Standard SSD Standard HDD Disk type SSD SSD SSD HDD Scenario IO-intensive workloads such as SAP HANA, top tier databases (for example, SQL, Oracle), and other transaction- heavy workloads. Production and performance sensitive workloads Web servers, lightly used enterprise applications and dev/test Backup, non-critical, infrequent access Disk size 65,536 gibibyte (GiB) (Preview) 32,767 GiB 32,767 GiB 32,767 GiB Max throughput 2,000 MiB/s (Preview) 900 MiB/s 750 MiB/s 500 MiB/s Max IOPS 160,000 (Preview) 20,000 6,000 2,000 https://docs.microsoft.com/en-us/azure/virtual-machines/windows/disks-types
  • 29. Unmanaged vs. Managed Disks • Premium Storage account limits: • 50 Gbps bandwidth • 35 TB for disks • 10 TB for snapshots • Standard Storage account limits: • 50 Gbps bandwidth • 35 TB for disks • 10 TB for snapshots https://blogs.msdn.microsoft.com/igorpag/2017/03/14/azure-managed-disks-deep-dive-lessons-learned-and-benefits/
  • 30. Best practices  Usate Premium Storage con replica locale, e posizionate lo storage account nello stesso datacenter della VM  Lo storage geo-replicato è supportato solo in scenari molto particolari  utilizzate feature applicative per ottenere geo-ridondanza Qualche suggerimento in più…  Possibilmente utilizzate dischi managed  Se usate dischi unmanaged, attenzione al posizionamento su storage account 1
  • 37. Tipologie dischi P R E M I U M S S D Type P4 P6 P10 P15 P20 P30 P40 P50 P60 P70 P80 Disk size in GiB 32 64 128 256 512 1,024 2,048 4,095 8,192 16,384 32,767 IOPS per disk Up to 120 Up to 240 Up to 500 Up to 1,100 Up to 2,300 Up to 5,000 Up to 7,500 Up to 7,500 Up to 16,000 Up to 18,000 Up to 20,000 Throughput per disk Up to 25 MiB/sec Up to 50 MiB/sec Up to 100 MiB/sec Up to 125 MiB/sec Up to 150 MiB/sec Up to 200 MiB/sec Up to 250 MiB/sec Up to 250 MiB/sec Up to 500 MiB/sec Up to 750 MiB/sec Up to 900 MiB/sec S T A N D A R D S S D Type E4 E6 E10 E15 E20 E30 E40 E50 E60 E70 E80 Disk size in GiB 32 64 128 256 512 1,024 2,048 4,095 8,192 16,384 32,767 IOPS per disk Up to 120 Up to 240 Up to 500 Up to 500 Up to 500 Up to 500 Up to 500 Up to 500 Up to 2,000 Up to 4,000 Up to 6,000 Throughput per disk Up to 25 MiB/sec Up to 50 MiB/sec Up to 60 MiB/sec Up to 60 MiB/sec Up to 60 MiB/sec Up to 60 MiB/sec Up to 60 MiB/sec Up to 60 MiB/sec Up to 400 MiB/sec Up to 600 MiB/sec Up to 750 MiB/sec S T A N D A R D H D D Type S4 S6 S10 S15 S20 S30 S40 S50 S60 S70 S80 Disk size in GiB 32 64 128 256 512 1,024 2,048 4,095 8,192 16,384 32,767 IOPS per disk Up to 500 Up to 500 Up to 500 Up to 500 Up to 500 Up to 500 Up to 500 Up to 500 Up to 1,300 Up to 2,000 Up to 2,000 Throughput per disk Up to 60 MiB/sec Up to 60 MiB/sec Up to 60 MiB/sec Up to 60 MiB/sec Up to 60 MiB/sec Up to 60 MiB/sec Up to 60 MiB/sec Up to 60 MiB/sec Up to 300 MiB/sec Up to 500 MiB/sec Up to 500 MiB/sec https://docs.microsoft.com/en-us/azure/virtual-machines/windows/disks-types
  • 38. Famiglie e dimensioni VM - storage https://docs.microsoft.com/it-it/azure/virtual-machines/windows/sizes
  • 39. Best practices  Usare dischi Premium SSD per workload di produzione  Almeno un disco P30 per i dati ed un P30 per i log  Cache Read-Only per dischi dati e TempDB  Cache None per dischi log o write intensive  Utilizzare Storage Spaces per creare volumi in striping • Columns = numero dischi in striping • Interleave = 64KB se workload OLTP, 256KB se workload DWH  Formattare i dischi con dimensione unità di allocazione = 64 KB Qualche suggerimento in più…  Max due dischi per ogni vCPU  Considerate la possibilità di utilizzare il disco temporaneo per il TempDB  Se utilizzate standard storage: • Utilizzate il numero massimo di dischi supportato dalla VM in striping • Impostate la cache a None su tutti i dischi
  • 41. Microsoft Best Practices Step post-deployment
  • 42. Best practices  Evitate di utilizzare il disco OS per ospitare database, ERRORLOG, Trace e backup • Spostare tutto su data disk: • Impostare path di default per database e backups • Spostare MSDB, MODEL, TEMPDB: 1. ALTER DATABASE database_name MODIFY FILE ( NAME = logical_name , FILENAME = 'new_pathos_file_name' ) 2. Spostare i file 3. Riavviare istanza • Spostare MASTER, Log SQL e Default Trace: 1. Stop istanza 2. Da SQL Configuration Manager cambiare parametri di startup 3. Spostare i file 4. Riavviare istanza
  • 43. Best practices  Tenere sotto controllo la dimensione dei database • Autogrowth = ultima spiaggia  • Disabilitare Auto Shrink  Impatto su I/O e su frammentazione indici  Privilegi da concedere all’account di servizio • Perform volume maintenance tasks per abilitare Instant File Initialization  funziona solo sui data files! • Lock Pages in Memory per limitare il paging della memoria utilizzata da SQL  Valutare l’abilitazione della Page Compression su tabelle ed indici  Su SQL 2012 installare la CU10 o successiva per SP1 o la CU1 o successive per SP2
  • 44. Best practices  Valutare la possibilità di eseguire backup direttamente su storage account Storage AccountSQL Server VM Backup
  • 45. Qualche suggerimento in più…  Disabilitare eventuali servizi non necessari (SSAS, SSRS)  Impostare il valore massimo di memoria utilizzabile da SQL Server per evitare contesa di risorse con il sistema operativo  Valutare la possibilità di suddividere il TempDB in più datafile  Valutare la possibilità di utilizzare il disco temporaneo per il TempDB  Valutare l’utilizzo di Trace Flag su SQL 2012/2014 • -T1117 e -T1118 per workload OLTP • -T1117 e -T610 per workload DW
  • 47. Automazione • PowerShell • dbatools.io • ARM Template • PowerShell Desired State Configuration • Azure Custom Script Extension
  • 48. Da dove cominciare… • Official docs https://azure.microsoft.com/en-us/documentation/articles/virtual-machines-windows-sql-performance/ https://docs.microsoft.com/en-us/azure/virtual-machines/windows/sql/virtual-machines-windows-sql- server-storage-configuration • GitHub Azure Quickstart Templates https://github.com/Azure/azure-quickstart-templates • SQL Server optimized template https://github.com/OmegaMadLab/OptimizedSqlVm • Optimize-SqlVmIaas PoSH script https://github.com/OmegaMadLab/Optimize-SqlIaasVm