Implementare e mantenere un progetto azure sql database v.2

32
Emanuele Zanchettin - thinkIT Implementare e mantenere un progetto Azure SQL Database

Transcript of Implementare e mantenere un progetto azure sql database v.2

Page 1: Implementare e mantenere un progetto azure sql database v.2

Emanuele Zanchettin - thinkIT

Implementare e mantenere un progetto Azure SQL Database

Page 2: Implementare e mantenere un progetto azure sql database v.2

Agenda

• Introduzione generale sull’infrastruttura

• La scelta responsabile• Scenari di progetto• Prima pubblicazione• Pubblicazione delle revisioni• Strategie di backup e restore• Service Level Agreement (SLA)

Page 3: Implementare e mantenere un progetto azure sql database v.2

Alcune caratteristiche di SQL Database

le basi non sono cambiate … +/-

Page 4: Implementare e mantenere un progetto azure sql database v.2

SQLDatabase inside – Alta affidabilità

Database logicoDatabase

2° db fisico

3° db fisico

3° db fisico

1° db fisico

Copie multiple ridondate automatiche e failover automatico, disponibilità ottimizzata

Page 5: Implementare e mantenere un progetto azure sql database v.2

Scale-outpartizionamento Orizzontale

PartizionamentoVerticale

Scale-up

Partizionamento dei dati - Scalabilità

Id val

Id val

Id val

Database

db più grande più dbs Federation / Elastic scale (es. app multi-tenant)

Page 6: Implementare e mantenere un progetto azure sql database v.2

Considerazioni

Scale-up

– Tutto ok Partizionamento Verticale

– Chiavi esterne tra databases diversi non ammesse– Non è possibile avere transazioni tra databases

Nemmeno usando Microsoft Distributed Transaction Coordinator (MDTC lato client)

Scale-out o partizionamento Orizzontale

– Nativo in Azure – Modellazione schema– Sviluppo e troubleshooting leggermente oneroso – Elastic Scale (preview) … ciao ciao Federation …

Page 7: Implementare e mantenere un progetto azure sql database v.2

Altre considerazioni

• L’evoluzione del Servizio

t

f(x)

startieri

oggi

domani?

Page 8: Implementare e mantenere un progetto azure sql database v.2

Non ci credi?

RIPSep. ‘15

Proviamo a calcolare il prezzo

Page 9: Implementare e mantenere un progetto azure sql database v.2

La scelta consapevole

Service Tier / Performance

LevelDTU MAX DB Size Max Worker

Threads Max SessionsBenchmark Transaction

RatePredictability

Basic 5 2 GB 30 300 16.600/h(4,6/s) Good

Standard/S0 10 250 GB 60 600 521/min(8,5/s) Better

Standard/S1 20 250 GB 90 900 934/min(15,6/s) Better

Standard/S2 50 250 GB 120 1.200 2.570/min(42,8/s) Better

Premium/P1 100 500 GB 200 2.400 105/s Best

Premium/P2 200 500 GB 400 4.800 228/s Best

Premium/P3 800 500 GB 1.600 19.200 735/s Best

Page 10: Implementare e mantenere un progetto azure sql database v.2

Evoluzione da Federation a Elastic Scale (cenni)

• The Azure SQL Database Federations feature is being retired along with the Web/Business editions in September 2015 (Cit.)

Page 11: Implementare e mantenere un progetto azure sql database v.2

Shard Map

• Due tipi di Shard Map– Range: intervalli elementi contigui– List: lista di valori

• Quattro tipi di chiavi– INT– BIGINT– GUID– VARBINARY

Page 12: Implementare e mantenere un progetto azure sql database v.2

Split/Merge scenario

KeyShard Location

1 Database_A3 Database_B4 Database_C6 Database_B... ...

Key RangeShard Location

[1, 50) Database_A[50, 100) Database_B[100, 200) Database_C[400, 600) Database_C... ...

• Alcuni comandi– CreateShard – DeleteShard– CreateRangeMapping– CreatePointMapping– DeleteMapping– UpdateMapping –MarkMappingOffline –MarkMappingOnline

Page 13: Implementare e mantenere un progetto azure sql database v.2

Si parte …

Qual’è il tuo caso?

Page 14: Implementare e mantenere un progetto azure sql database v.2

Migrazione progetto esistente

tutto su cloud on premise + cloud (Ibrido)

Azure SQL Database

Page 16: Implementare e mantenere un progetto azure sql database v.2

Prima pubblicazione

Sono pronto per farlo?

Page 17: Implementare e mantenere un progetto azure sql database v.2

Strumenti per la migrazione

• Schema e datiSQL Server Migration Assistant (SSMA)– da Oracle, Sybase, MySQL e Access

SQL Server Management Studio (SSMS) – da SQL Server 2012 usando .bacpac package

SQL Database Migration Wizard (CodePlex)– SQL Server 2008 R2 SP1 (v3x), SQL Server 2012 (v4x)

• Solo dati– bcp, SSMS, SQL Data Sync, SSIS

• Solo schemaSQL Server Data Tools– da Microsoft Visual Studio 2012– da SQL Server 2012 usando .dacpac package

Page 18: Implementare e mantenere un progetto azure sql database v.2

Caso reale di migrazione

• Strumento utilizzato: Migrate Data di SQL Server Migration Assistant for MySQL

• Quantità: 6 tabelle, 9KK righe, 520MB dimensione totale

• Tempi: 26’ 30’’ upload parallelo, fibra 10Mbit/s

Page 19: Implementare e mantenere un progetto azure sql database v.2

demo

Page 20: Implementare e mantenere un progetto azure sql database v.2

CONSIDERAZIONI

• Limitazioni sulle funzionalitàSQL Server Utility, SQL Server PowerShell Provider, Master Data Services, Change Data Capture, Data Auditing, Data Compression, Extended Events, Extension of spatial types and methods through Common Language Runtime (CLR), External Key Management / Extensible Key Management, FILESTREAM Data, Integrated Full-Text Search, Large User-Defined Aggregates (UDAs), Large User-Defined Types (UDTs), Performance Data Collection (Data Collector), Policy-Based Management, Resource Governor, SQL Server Replication Transparent Data Encryption, Common Language Runtime (CLR) and CLR User-Defined Types, Database Mirroring, Service Broker, Table Partitioning, Typed XML and XML indexing (XML data type), Backup and Restore, Replication, Extended Stored Procedures, SQL Server Agent/Jobs

• Limitazioni su T-SQLCommon Language Runtime (CLR), Database file placement, Database mirroring, Distributed queries, Distributed transactions, Filegroup management, Global temporary tables, SQL Server configuration options, SQL Server Service Broker, System tables, Trace Flags

• Documentazione disponibile online

• Pianifica prima di iniziare

Page 21: Implementare e mantenere un progetto azure sql database v.2

Pubblicazione delle revisioni

E ora?

Page 22: Implementare e mantenere un progetto azure sql database v.2

GESTIRE SCHEMA E DATI

• Gestire ambienti di test e produzione

• Pianificare uno scenario di undo

• Cambiare lo schema e datiSQL Server Management Studio (SSMS) – da SQL Server 2012 usando .bacpac package

SQL Database Migration Wizard (CodePlex)– SQL Server 2008 R2 SP1 (v3x), SQL Server 2012 (v4x)

• Cambiare solo dati– bcp, SSMS, SQL Data Sync, SSIS

• Cambiare solo lo schema– Microsoft Visual Studio 2012

Page 23: Implementare e mantenere un progetto azure sql database v.2

Caso reale di upload federazione

• Strumento utilizzato: Esporta dati di SQL Server Management Studio

• Quantità: 3 tabelle, 8,6KK righe, 490MB dimensione totale

• Tempi: 10’ 15’’ download/upload parallelo, fibra 10Mbit/s

Page 24: Implementare e mantenere un progetto azure sql database v.2

demo

Page 25: Implementare e mantenere un progetto azure sql database v.2

Considerazioni

• DBA, Data Architect e sviluppatori, non litigate tra voi

• “Scalare” prima di raggiungere il limite

• Scegliere una pubblicazione passo-passo

• Pianificare prima di iniziare

Page 26: Implementare e mantenere un progetto azure sql database v.2

Strategie di backup e restore

Non dimenticartelo!

Page 27: Implementare e mantenere un progetto azure sql database v.2

Chi fa cosa?

• SQL Azure periodico mantenuto almeno 7 giorni“as a safe guard against catastrophic software and system failures” !!!!Backup Full settimanale, Differenziale giornaliero, Transaction Log

ogni 5’Storico 7gg (B), 14gg (S), 35gg (P)Point in Time Restore, Restoring a Deleted Database, Geo-Restore

• Errori Utente (Business Continuity)Usare SQL Data Sync (backup offline/remoto)Copia di Database (CREATE DATABASE [destination] AS COPY OF

[source])Import/Export Service (Azure BLOB storage necessario, auto in

preview)Gruppo/Agente di sincronizzazione Azure (SQLDataSyncAgent solo

x86 )

• Pianificare prima di iniziare

Page 28: Implementare e mantenere un progetto azure sql database v.2

Service Level Agreement (SLA)

Garanzie sul servizio fornito?

Page 29: Implementare e mantenere un progetto azure sql database v.2

SLA

• 99,90% (W, BU) e 99,99% (B, S, P)– Mensile, calcolo al minuto su inattività >= 1 minuto

• Limiti di sottoscrizione• Carta di credito senza soldi• Sforamenti di quota• DTU (Database Throughput Units )• Upgrade / Downgrade del Service tier

– SLO (Service Level Objective) e “la formula del male”

3 x (5 minutes + database size / 150 MB/minute)

Es. 3 x (5 minutes + 50 GB x 1024 MB/GB / 150 MB/minute) ≈17 hours

SLO > SLA (MNU)SLO == SLA SLO < SLA

Page 30: Implementare e mantenere un progetto azure sql database v.2

Links

• Migration from federation to elastic scaleazure.microsoft.com/en-us/documentation/articles/sql-database-elastic-scale-federation-migration/

• Azure SQL Database Elastic Scale Ch9channel9.msdn.com/Shows/Data-Exposed/Azure-SQL-Database-Elastic-Scale

• SQL Database Service Level Agreement (SLA)www.windowsazure.com/it-it/support/legal/sla/

• SQL Database pricingwww.windowsazure.com/it-it/pricing/details/sql-database/

Page 31: Implementare e mantenere un progetto azure sql database v.2

Links

• SQL Server Migration Assistant (SSMA)blogs.msdn.com/b/ssma/

• Guidelines and Limitations (Windows Azure SQL Database)msdn.microsoft.com/en-us/library/windowsazure/ff394102.aspx

• Known SQL Data Sync (Preview) Limitsmsdn.microsoft.com/en-us/library/jj590380.aspx

• Azure SQL Database Backup and Restoremsdn.microsoft.com/en-us/library/azure/jj650016.aspx

Page 32: Implementare e mantenere un progetto azure sql database v.2

feedback

10

o Feedback su:

• http://xedotnet.org/feedback

Grazie!

Emanuele Zanchettin – thinkITEmail: [email protected]: http://www.thinkit.it/Twitter: @_thinkIT_LinkedIn: http

://it.linkedin.com/pub/emanuele-zanchettin/18/921/34