Escalabilidad horizontal y arquitecturas elásticas en Microsoft azure

80
#SQSummit @enriquecatala Escalabilidad horizontal y arquitecturas elásticas en Microsoft Azure Mentor [email protected] MVP – MCT – MCSE Enrique Catalá Bañuls

Transcript of Escalabilidad horizontal y arquitecturas elásticas en Microsoft azure

Page 1: Escalabilidad horizontal y arquitecturas elásticas en Microsoft azure

#SQSummit

@enriquecatala

Escalabilidad horizontal y arquitecturas

elásticas en Microsoft Azure

Mentor

[email protected]

MVP – MCT – MCSE

Enrique Catalá Bañuls

Page 2: Escalabilidad horizontal y arquitecturas elásticas en Microsoft azure

Agenda

3

1. ¿Qué podemos usar?

2. AlwaysON

3. Arquitecturas elásticas

4. Caching

5. Autoescalado VMs

6. Rendimiento CPU

Page 3: Escalabilidad horizontal y arquitecturas elásticas en Microsoft azure

La informática en la nube definidaPosiciónamiento

4

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-demandSelf Service

Broad Network Access

ResourcePooling

Rapid Elasticity

MeasuredService

Page 4: Escalabilidad horizontal y arquitecturas elásticas en Microsoft azure

Modelos de Servicio

5

Page 5: Escalabilidad horizontal y arquitecturas elásticas en Microsoft azure

Soluciones híbridas

6

Page 6: Escalabilidad horizontal y arquitecturas elásticas en Microsoft azure

Tecnologias soportadas

7

Tecnología SQL

Server

Cero

pérdida de

datos

Ámbito Nº secundarios Failover

automático

Leer de

secundarios

Availability

Groups

2012+ Si* DB(s) 4 -> 2012

8 -> 2014

Yes

(w/ additional

cluster

member)**

Si

Database

Mirroring

2008 R2

2012

Si* DB 1 Yes

(w/ Witness)**

Limited

(database

snapshots)

Log

Shipping

2005+ No DB Ilimitadas No Limited

(standby

state)

Replicacion 2008+ No Articulos ***Ilimitadas No Si

Page 7: Escalabilidad horizontal y arquitecturas elásticas en Microsoft azure

Tamaños de VM

8

Cores Memoria Temp

Ancho

de

banda

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 2000 €0,135/h

Large 4 7 GB 285 GB 400 8 4000 €0,269/h

ExtraLarge 8 14 GB 605 GB 800 16 8000 €0,537/h

A5 2 14GB 605 GB 200 4 2000€0,298/h

A6 4 28 GB 285 GB 1,000 8 4000 €0,596/h

A7 8 56 GB 605 GB 2,000 16 8000 €1,192/h

A88

2.6 Ghz56 Gb

1600 Mhz382 Gb 1,000

40,000**16 8000 €1,183/h

A916

2.6 Ghz112 Gb1600 Mhz

382 Gb 1,00040,000**

16 8000 €3,65/h

Page 8: Escalabilidad horizontal y arquitecturas elásticas en Microsoft azure

Bajada de precio en SQL VMsSQL Standard (a fecha de 12-05-2014)

9

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

Page 9: Escalabilidad horizontal y arquitecturas elásticas en Microsoft azure

Agenda

10

1. ¿Qué podemos usar?

2. AlwaysON

3. Arquitecturas elásticas

4. Caching

5. Autoescalado VMs

6. Rendimiento CPU

Page 10: Escalabilidad horizontal y arquitecturas elásticas en Microsoft azure

Diagrama arquitecturaAlwaysOn SQL Server 2012+

11

Windows Cluster

Availability Group

On-Premises

SecondaryPrimary

Page 11: Escalabilidad horizontal y arquitecturas elásticas en Microsoft azure

Diagrama arquitectura

12

Windows Cluster

Availability Group

On-Premises

Secondary

Cloud

SecondaryPrimary

Page 12: Escalabilidad horizontal y arquitecturas elásticas en Microsoft azure

Diagrama arquitectura

13

Windows Cluster Windows Cluster

Availability Group Availability Group

Primary Secondary

On-Premises (NY) On-Premises (NJ)

Secondary

Cloud

Page 13: Escalabilidad horizontal y arquitecturas elásticas en Microsoft azure

Diagrama arquitectura

14

Windows Cluster

Availability Group

Cloud On-Premises

SecondarySecondaryPrimary

Page 14: Escalabilidad horizontal y arquitecturas elásticas en Microsoft azure

AlwaysOn

15

Page 15: Escalabilidad horizontal y arquitecturas elásticas en Microsoft azure

DEMO

16

Elasticidad con AlwaysOn híbrido

Page 16: Escalabilidad horizontal y arquitecturas elásticas en Microsoft azure
Page 17: Escalabilidad horizontal y arquitecturas elásticas en Microsoft azure
Page 18: Escalabilidad horizontal y arquitecturas elásticas en Microsoft azure
Page 19: Escalabilidad horizontal y arquitecturas elásticas en Microsoft azure
Page 20: Escalabilidad horizontal y arquitecturas elásticas en Microsoft azure
Page 21: Escalabilidad horizontal y arquitecturas elásticas en Microsoft azure
Page 22: Escalabilidad horizontal y arquitecturas elásticas en Microsoft azure
Page 23: Escalabilidad horizontal y arquitecturas elásticas en Microsoft azure
Page 24: Escalabilidad horizontal y arquitecturas elásticas en Microsoft azure
Page 25: Escalabilidad horizontal y arquitecturas elásticas en Microsoft azure
Page 26: Escalabilidad horizontal y arquitecturas elásticas en Microsoft azure
Page 27: Escalabilidad horizontal y arquitecturas elásticas en Microsoft azure
Page 28: Escalabilidad horizontal y arquitecturas elásticas en Microsoft azure
Page 29: Escalabilidad horizontal y arquitecturas elásticas en Microsoft azure
Page 30: Escalabilidad horizontal y arquitecturas elásticas en Microsoft azure
Page 31: Escalabilidad horizontal y arquitecturas elásticas en Microsoft azure
Page 32: Escalabilidad horizontal y arquitecturas elásticas en Microsoft azure
Page 33: Escalabilidad horizontal y arquitecturas elásticas en Microsoft azure
Page 34: Escalabilidad horizontal y arquitecturas elásticas en Microsoft azure
Page 35: Escalabilidad horizontal y arquitecturas elásticas en Microsoft azure
Page 36: Escalabilidad horizontal y arquitecturas elásticas en Microsoft azure
Page 37: Escalabilidad horizontal y arquitecturas elásticas en Microsoft azure
Page 38: Escalabilidad horizontal y arquitecturas elásticas en Microsoft azure
Page 39: Escalabilidad horizontal y arquitecturas elásticas en Microsoft azure
Page 40: Escalabilidad horizontal y arquitecturas elásticas en Microsoft azure

Agenda

41

1. ¿Qué podemos usar?

2. AlwaysON

3. Arquitecturas elásticas

4. Caching

5. Autoescalado VMs

6. Rendimiento CPU

Page 41: Escalabilidad horizontal y arquitecturas elásticas en Microsoft azure

Diagrama arquitecturaElasticidad

42

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

Page 42: Escalabilidad horizontal y arquitecturas elásticas en Microsoft azure

DEMO

43

Configurar entorno

Page 43: Escalabilidad horizontal y arquitecturas elásticas en Microsoft azure

Grupo de afinidad

44

Page 44: Escalabilidad horizontal y arquitecturas elásticas en Microsoft azure

Network Service

45

Page 45: Escalabilidad horizontal y arquitecturas elásticas en Microsoft azure

Infraestructura

46

Page 46: Escalabilidad horizontal y arquitecturas elásticas en Microsoft azure

Dominio Active Directory

47

Page 47: Escalabilidad horizontal y arquitecturas elásticas en Microsoft azure

Añadir el rol de Active Directory

48

Page 48: Escalabilidad horizontal y arquitecturas elásticas en Microsoft azure

Añadir DNS

49

Page 49: Escalabilidad horizontal y arquitecturas elásticas en Microsoft azure

Añadir republicador

50

Page 50: Escalabilidad horizontal y arquitecturas elásticas en Microsoft azure

DEMO

51

Elasticidad flexible

Page 51: Escalabilidad horizontal y arquitecturas elásticas en Microsoft azure

• Las VM no pueden ser basic*

• Usa VPN o encripta tu conexión

• Automatiza los despliegues con sysprep y

scripts

Conceptos clave

52

Page 52: Escalabilidad horizontal y arquitecturas elásticas en Microsoft azure

Agenda

53

1. ¿Qué podemos usar?

2. AlwaysON

3. Arquitecturas elásticas

4. Caching

5. Autoescalado VMs

6. Rendimiento CPU

Page 53: Escalabilidad horizontal y arquitecturas elásticas en Microsoft azure

IaaS y VMs

54

Page 54: Escalabilidad horizontal y arquitecturas elásticas en Microsoft azure

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

Page 55: Escalabilidad horizontal y arquitecturas elásticas en Microsoft azure

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

Page 56: Escalabilidad horizontal y arquitecturas elásticas en Microsoft azure

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");

Page 57: Escalabilidad horizontal y arquitecturas elásticas en Microsoft azure

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");

Page 58: Escalabilidad horizontal y arquitecturas elásticas en Microsoft azure

Use Cloud Caching: the Right

Reasons

Speed of access to data

Azure SQL database

Azure storage

Remote storage and services

Avoiding hitting rate limits

Up to 5,000 entities/messages/blobs per second per account

Up to 500 messages per second from a single queue

Up to 500 entities per second from a single table partition

Page 59: Escalabilidad horizontal y arquitecturas elásticas en Microsoft azure

Using Caching in your applications

Stores session state in shared memory

Required for Web Farms

Faster than SQL

Simple configuration change to your web app

Enables session state to be cached across a cluster

Uses 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

60

<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>

Page 60: Escalabilidad horizontal y arquitecturas elásticas en Microsoft azure

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.

Page 61: Escalabilidad horizontal y arquitecturas elásticas en Microsoft azure

Azure Redis Cache

Page 62: Escalabilidad horizontal y arquitecturas elásticas en Microsoft azure

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");

Page 63: Escalabilidad horizontal y arquitecturas elásticas en Microsoft azure

DEMO

64

Caching

Page 64: Escalabilidad horizontal y arquitecturas elásticas en Microsoft azure

Agenda

65

1. ¿Qué podemos usar?

2. AlwaysON

3. Arquitecturas elásticas

4. Caching

5. Autoescalado VMs

6. Rendimiento CPU

Page 65: Escalabilidad horizontal y arquitecturas elásticas en Microsoft azure

DEMO

66

Autoscale VM

Page 66: Escalabilidad horizontal y arquitecturas elásticas en Microsoft azure

Autoscale VMDos nodos, 1 parado

67

Page 67: Escalabilidad horizontal y arquitecturas elásticas en Microsoft azure

Autoscale VMMáquina1

68

Page 68: Escalabilidad horizontal y arquitecturas elásticas en Microsoft azure

Autoscale VMLog de operaciones

69

Page 69: Escalabilidad horizontal y arquitecturas elásticas en Microsoft azure

Autoscale VMDetectado evento…aprovisionando

70

Page 70: Escalabilidad horizontal y arquitecturas elásticas en Microsoft azure

Autoscale VMAprovisionando

71

Page 71: Escalabilidad horizontal y arquitecturas elásticas en Microsoft azure

Autoscale VMAparece en el log

72

Page 72: Escalabilidad horizontal y arquitecturas elásticas en Microsoft azure

Autoscale VMLog del evento

73

Page 73: Escalabilidad horizontal y arquitecturas elásticas en Microsoft azure

Agenda

74

1. ¿Qué podemos usar?

2. AlwaysON

3. Arquitecturas elásticas

4. Caching

5. Autoescalado VMs

6. Rendimiento CPU

Page 74: Escalabilidad horizontal y arquitecturas elásticas en Microsoft azure

Rendimiento CPUBenchmark simple

75

MáquinaPuntuación single-

thread

Puntuación multi-

threadDescripció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 6680 Intel Xeon E5-2660 2.2Ghz

Entorno A9 2460 10580 Intel Xeon E5-2670 2.6Ghz

Page 75: Escalabilidad horizontal y arquitecturas elásticas en Microsoft azure

Rendimiento CPU

76

Azure

OnPremise

Azure

OnPremise

Azure

OnPremise

Page 76: Escalabilidad horizontal y arquitecturas elásticas en Microsoft azure

Rendimiento CPUTambién a nivel SQL

77

Page 77: Escalabilidad horizontal y arquitecturas elásticas en Microsoft azure

Solución IaaS real (eLearning)

78

AS_DCAD

AS_Cluster_SQL_AO

AS_FE_MOOD

AS_FE_LAMSAG

80

80

Page 78: Escalabilidad horizontal y arquitecturas elásticas en Microsoft azure

Arquitecturas elásticas en SQL

• De serie con AlwaysOn

• “sin límite” con replicación

Elasticidad flexible

• Web y worker roles

• VMS

Caché

ConclusiónAzure mola…pero úsalo para lo que necesitas

79

Page 79: Escalabilidad horizontal y arquitecturas elásticas en Microsoft azure

¿Preguntas?

80

Page 80: Escalabilidad horizontal y arquitecturas elásticas en Microsoft azure

¡Gracias!

Siéntate a comer con nosotros o tómate un café y aclara tus

dudas

@enriquecatala

Mentor – MVP SQL Server

Enrique Catala Bañuls

81