Escalabilidad horizontal y arquitecturas elásticas en Microsoft azure

Post on 11-Jul-2015

249 views 3 download

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

#SQSummit

@enriquecatala

Escalabilidad horizontal y arquitecturas

elásticas en Microsoft Azure

Mentor

ecatala@solidq.com

MVP – MCT – MCSE

Enrique Catalá Bañuls

Agenda

3

1. ¿Qué podemos usar?

2. AlwaysON

3. Arquitecturas elásticas

4. Caching

5. Autoescalado VMs

6. Rendimiento CPU

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

Modelos de Servicio

5

Soluciones híbridas

6

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

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

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

Agenda

10

1. ¿Qué podemos usar?

2. AlwaysON

3. Arquitecturas elásticas

4. Caching

5. Autoescalado VMs

6. Rendimiento CPU

Diagrama arquitecturaAlwaysOn SQL Server 2012+

11

Windows Cluster

Availability Group

On-Premises

SecondaryPrimary

Diagrama arquitectura

12

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

Diagrama arquitectura

14

Windows Cluster

Availability Group

Cloud On-Premises

SecondarySecondaryPrimary

AlwaysOn

15

DEMO

16

Elasticidad con AlwaysOn híbrido

Agenda

41

1. ¿Qué podemos usar?

2. AlwaysON

3. Arquitecturas elásticas

4. Caching

5. Autoescalado VMs

6. Rendimiento CPU

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

DEMO

43

Configurar entorno

Grupo de afinidad

44

Network Service

45

Infraestructura

46

Dominio Active Directory

47

Añadir el rol de Active Directory

48

Añadir DNS

49

Añadir republicador

50

DEMO

51

Elasticidad flexible

• Las VM no pueden ser basic*

• Usa VPN o encripta tu conexión

• Automatiza los despliegues con sysprep y

scripts

Conceptos clave

52

Agenda

53

1. ¿Qué podemos usar?

2. AlwaysON

3. Arquitecturas elásticas

4. Caching

5. Autoescalado VMs

6. Rendimiento CPU

IaaS y VMs

54

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

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>

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

DEMO

64

Caching

Agenda

65

1. ¿Qué podemos usar?

2. AlwaysON

3. Arquitecturas elásticas

4. Caching

5. Autoescalado VMs

6. Rendimiento CPU

DEMO

66

Autoscale VM

Autoscale VMDos nodos, 1 parado

67

Autoscale VMMáquina1

68

Autoscale VMLog de operaciones

69

Autoscale VMDetectado evento…aprovisionando

70

Autoscale VMAprovisionando

71

Autoscale VMAparece en el log

72

Autoscale VMLog del evento

73

Agenda

74

1. ¿Qué podemos usar?

2. AlwaysON

3. Arquitecturas elásticas

4. Caching

5. Autoescalado VMs

6. Rendimiento CPU

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

Rendimiento CPU

76

Azure

OnPremise

Azure

OnPremise

Azure

OnPremise

Rendimiento CPUTambién a nivel SQL

77

Solución IaaS real (eLearning)

78

AS_DCAD

AS_Cluster_SQL_AO

AS_FE_MOOD

AS_FE_LAMSAG

80

80

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

¿Preguntas?

80

¡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