#SQSummit
@enriquecatala
Escalabilidad horizontal y arquitecturas elásticas en Microsoft Azure
Mentor
MVP – MCT – MCSE
Enrique Catalá Bañuls
3
Agenda
1. ¿Qué podemos usar?2. AlwaysON3. Arquitecturas elásticas4. Caching 5. Autoescalado VMs6. Rendimiento CPU
4
La informática en la nube definidaPosiciónamiento
Cloud computing as four deloyment models, three service models and five main features
features
Public Cloud
Hybrid Cloud
Private Cloud
Community Cloud
IaaSInfrastructure as a
Service
PaaSPlatform as a Service
SaaSPlatform as a Service
On-demand Self Service
Broad Network Access
Resource Pooling
Rapid Elasticity
Measured Service
5
Modelos de Servicio
Office 365, CRM, Dynamics,
SharePoint Online
consume
SaaSServicios de
aplic. Almacenamiento,
comunicación
build
PaaSRoles, máquinas virtuales, Discos
y Redes
host
IaaS
Soluciones híbridas
6
DR rápido
Rápido de desplegar y manejar
Aprovechamiento elástico
Ambito global de tu app
Mejor aislamiento parcial de tus datos
Manual o automático
A nivel complete o de punto del tiempo
Se mide el uso de la BBDD y se realiza autónomamente por ti
7
Tecnologias soportadasTecnología
SQL Server
Cero pérdida de datos
Ámbito Nº secundarios
Failover automático
Leer de secundarios
Availability Groups
2012+ Si* DB(s) 4 -> 20128 -> 2014
Yes(w/ additional cluster member)**
Si
Database Mirroring
2008 R22012
Si* DB 1 Yes(w/ Witness)**
Limited(database snapshots)
LogShipping
2005+ No DB Ilimitadas No Limited(standby state)
Replicacion
2008+ No Articulos
***Ilimitadas
No Si
8
Tamaños de VM
Cores Memoria Temp
Ancho de band
a
Discos de
datos
IOPs total
SQL Standard
Coste/ hora
ExtraSmall
1 - Shared 768 MB 20 GB 5 1 500 €0,015/h
Small 1 1.75 GB 70 GB 100 2 1000 €0,068/h
Medium 2 3.5 GB 135 GB 200 4 200
0 €0,135/h
Large 4 7 GB 285 GB 400 8 400
0 €0,269/h
ExtraLarge 8 14 GB 605
GB 800 16 8000 €0,537/h
A5 2 14GB 605 GB 200 4 200
0€0,298/h
A6 4 28 GB 285 GB
1,000 8 400
0 €0,596/h
A7 8 56 GB 605 GB
2,000 16 800
0 €1,192/h
A8 8 2.6 Ghz
56 Gb 1600 Mhz
382 Gb
1,000
40,000**
16 8000 €1,183/h
A9 16 2.6 Ghz
112 Gb1600 Mhz
382 Gb
1,000
40,000**
16 8000 €3,65/h
9
Bajada de precio en SQL VMsSQL Standard (a fecha de 12-05-2014)
2013 2014 (basic) 2014 (standard)
ExtraSmall €0.425/hr €0,014/hr €0,015/hr
Small €0.477/hr €0,056/hr €0,068/hr
Medium €0.544/hr €0,111/hr €0,135/hr
Large €0.678/hr €0,221/hr €0,269/hr
ExtraLarge €1.356/hr €0,441/hr €0,537/hr
A6 €1.17/hr €0,596/hr €0,596/hr
A7 €2.339/hr €1,192/hr €1,192/hr
10
Agenda
1. ¿Qué podemos usar?2. AlwaysON3. Arquitecturas elásticas4. Caching 5. Autoescalado VMs6. Rendimiento CPU
11
Diagrama arquitecturaAlwaysOn SQL Server 2012+
Windows Cluster
Availability Group
On-Premises
SecondaryPrimary
12
Diagrama arquitectura
Windows Cluster
Availability Group
On-Premises
Secondary
Cloud
SecondaryPrimary
Diagrama arquitectura
13
Windows Cluster Windows Cluster
Availability Group Availability Group
Primary Secondary
On-Premises (NY) On-Premises (NJ)
Secondary
Cloud
14
Diagrama arquitectura
Windows Cluster
Availability Group
Cloud On-Premises
SecondarySecondaryPrimary
15
AlwaysOn
On-premises network
Domain controller
VPN tunnel (Windows Azure Virtual Network)Asynchronous
commit
Primary replica
Secondary replica
Synchronous commit
Run backups
Run BI reports
16
DEMOElasticidad con AlwaysOn híbrido
41
Agenda
1. ¿Qué podemos usar?2. AlwaysON3. Arquitecturas elásticas4. Caching 5. Autoescalado VMs6. Rendimiento CPU
42
Diagrama arquitecturaElasticidad
DBreplica1
Replica1 Replica2 Replica n
DBreplica2 DBreplica3
Azure Republicador(opcional)
Transactional replication
SYNC
WANSQL1 (onpremise)
ON PREMISE Azure
Nodos secundarios replicación
Capa de base de datos, suscriptores (5s-15s delay)
SQL Standard Edition
Nodo publicador Instancia OnPremise que
contiene los datos maestros a replicar mediante replicación transaccional
43
DEMOConfigurar entorno
Icon de tecnologíaIcon de tecnologíaIcon de tecnología
44
Grupo de afinidad
45
Network Service
46
Infraestructura
47
Dominio Active Directory
48
Añadir el rol de Active Directory
49
Añadir DNS
50
Añadir republicador
51
DEMOElasticidad flexible
Icon de tecnologíaIcon de tecnologíaIcon de tecnología
52
• Las VM no pueden ser basic*• Usa VPN o encripta tu conexión• Automatiza los despliegues con
sysprep y scripts
Conceptos clave
53
Agenda
1. ¿Qué podemos usar?2. AlwaysON3. Arquitecturas elásticas4. Caching 5. Autoescalado VMs6. Rendimiento CPU
54
IaaS y VMs
Fault DomainRack_01
Fault DomainRack_02
Grupo de Disponibilidad
Grupo de Disponibilidad
Windows Azure Caching concepts
Microsoft Azure Cache is a family of distributed, in-memory, scalable solutions that enable you to build highly scalable and responsive applications by providing super-fast access to your data.Microsoft Azure Cache is available in the following flavors.– Azure Redis Cache (Preview) – Managed Cache Service – In-Role Cache
Managed Cache Service
Azure Managed Cache Service is based on the AppFabric Cache engine. It also gives you access to a secure, dedicated cache that is managed by Microsoft. A cache created using the Managed Cache Service is also accessible from applications within Azure running on Azure Web Sites, Web & Worker Roles and Virtual Machines. For more information
Using Managed Cache
// Cache client configured by settings in application // configuration file. DataCacheFactoryConfiguration config =
new DataCacheFactoryConfiguration("default"); DataCacheFactory cacheFactory = new DataCacheFactory(config); DataCache defaultCache = cacheFactory.GetDefaultCache();
// Put and retrieve a test object from the default cache. defaultCache.Put("testkey", "testobject"); string strObject = (string)defaultCache.Get("testkey");
In-Role CachingBased on the AppFabric Cache engine.
Allows you to perform caching by using a dedicated web or worker role instance in an application deployed to Microsoft Azure Cloud Services.
This provides flexibility in terms of deployment options and size but you manage the cache yourself.
//add string object to cache with key "Key0" myCache.Add("Key0", "object added with Key0");
//add or replace string object in cache using key "Key0" myCache.Put("Key0", "object replaced or added using Key0"); //remove object in cache using key "Key0"myCache.Remove("Key0");
Use Cloud Caching: the Right Reasons
Speed of access to dataAzure SQL databaseAzure storageRemote storage and servicesAvoiding hitting rate limitsUp to 5,000 entities/messages/blobs per second per accountUp to 500 messages per second from a single queueUp to 500 entities per second from a single table partition
60
Using Caching in your applications
Stores session state in shared memoryRequired for Web FarmsFaster than SQLSimple configuration change to your web app Enables session state to be cached across a clusterUses cache-aside, not RT+WB (session is Activity Data)TIP: Use HA to reduce the chances of sessions state loss
Example: ASP.NET App Session state provider
<sessionState mode="Custom" customProvider="SessionStoreProvider"> <providers> <add name="SessionStoreProvider“ type="Microsoft.ApplicationServer.Caching.DataCacheSessionStoreProvider,
Microsoft.ApplicationServer.Caching.Client, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35“ cacheName=“MyCache"/> </providers></sessionState>
Azure Redis Cache (PREVIEW)
Microsoft Azure Redis Cache (Preview) is based on the popular open source Redis Cache. It gives you access to a secure, dedicated Redis cache, managed by Microsoft. A cache created using Azure Redis Cache is accessible from any application within Microsoft Azure.
Azure Redis Cache (Preview) is available in the following two tiers.
– Basic – single node, multiple sizes.
– Standard – Two node Master/Slave, multiple sizes. Once the preview period is over, the standard tier offering will have a 99.9% SLA.
Azure Redis Cache
Azure Redis Cache (use)using StackExchange.Redis;
ConnectionMultiplexer connection = ConnectionMultiplexer.Connect("contoso5.redis.cache.windows.net,ssl=true,password=...");
// connection referes to a previously configured //ConnectionMultiplexer IDatabase cache = connection.GetDatabase();
ConnectionMultiplexer connection = ConnectionMultiplexer.Connect("contoso5.redis.cache.windows.net..."); IDatabase cache = connection.GetDatabase();
// Perform cache operations using the cache object... // Simple put of integral data types into the cache cache.StringSet("key1", "value"); cache.StringSet("key2", 25); // Simple get of data types from the cache string key1 = cache.StringGet("key1"); int key2 = (int)cache.StringGet("key2");
64
DEMOCaching
Icon de tecnologíaIcon de tecnologíaIcon de tecnología
65
Agenda
1. ¿Qué podemos usar?2. AlwaysON3. Arquitecturas elásticas4. Caching 5. Autoescalado VMs6. Rendimiento CPU
66
DEMOAutoscale VM
Icon de tecnologíaIcon de tecnologíaIcon de tecnología
67
Autoscale VMDos nodos, 1 parado
68
Autoscale VMMáquina1
69
Autoscale VMLog de operaciones
70
Autoscale VMDetectado evento…aprovisionando
71
Autoscale VMAprovisionando
72
Autoscale VMAparece en el log
73
Autoscale VMLog del evento
74
Agenda
1. ¿Qué podemos usar?2. AlwaysON3. Arquitecturas elásticas4. Caching 5. Autoescalado VMs6. Rendimiento CPU
75
Rendimiento CPUBenchmark simple
MáquinaPuntuación
single-threadPuntuación multi-
thread Descripción
Portatil Enrique Catalá
1911 4826 Intel i7 1.73Ghz
Entorno Web Role (A3)
1068 3729 AMD Opteron 4171 2.1Ghz
Entorno VM A3 (4cores)
1066 3635 AMD Opteron 4171 2.1Ghz
Entorno VM A4 (8cores)
1072 6617 AMD Opteron 4171 2.1Ghz
Entorno VM A7 (AMD)
1077 5622 AMD Opteron 4171 2.1Ghz
Entorno VM A7 (Intel)
1115 6680Intel Xeon E5-2660 2.2Ghz
Entorno A9 2460 10580 Intel Xeon E5-2670 2.6Ghz
Rendimiento CPU
76
Azure
OnPremise
Azure
OnPremise
Azure
OnPremise
77
Rendimiento CPUTambién a nivel SQL
78
Solución IaaS real (eLearning)
VNET eLearning Corporativo PYME (con HA
CS-BE
FRONT-END SUBNET BACK-END SUBNET
CS-LAMS_Eng
CS-Moodle_LMS
AS_DCAD
AS_Cluster_SQL_AO
AS_FE_MOOD
AS_FE_LAMSAG
80
80
79
Arquitecturas elásticas en SQL • De serie con AlwaysOn• “sin límite” con replicaciónElasticidad flexible• Web y worker roles• VMSCaché
ConclusiónAzure mola…pero úsalo para lo que necesitas
80
Power BI para usuarios de negocio
80
Curso onlineClases virtuales presenciales14, 15, 16, 21, 22 y 23 de JulioDe 16 a 20 h
Máster en BI 4ª Edición (Inicio Octubre 2014)- Clases presenciales virtuales- 450 horas (60 ECTS) - SolidQ – UPM
- Clases + trabajo práctico + proyecto- Beca de hasta 1.300 € para los primeros inscritos.
Máster en Big Data & Analytics1ª Edición (Inicio Octubre 2014)- Clases presenciales virtuales- 1 año (60 ECTS) UMA
- Clases + trabajo práctico + proyecto
Información e inscripción: http://university.solidq.com / [email protected]