Aplicaciones móviles super-escalables

Post on 14-Apr-2017

60 views 0 download

Transcript of Aplicaciones móviles super-escalables

Aplicaciones móviles super-escalables

Sergio A. BorromeiCowboy Codersergiob@lagash.com

Nick A. RivasPsycho Code Reviewernickr@lagash.com

User Interface

lagash.com

La era móvil

Embrace the challengelagash.com

2014: Los usuarios móviles superan a los usuarios de escritorio

Embrace the challengelagash.com

Crecimiento en el uso mobile

Embrace the challengelagash.com

El desarrollo móvil...

• Diversidad de dispositivos y plataformas

• Muchas actualizaciones de SO• Nuevas capacidades de hardware

Embrace the challengelagash.com

Tus usuarios son expertos (muy)

Embrace the challengelagash.com

Desafíos...• Runtime de servicios de backend• Integrar datos y procesos de diversas fuentes• Brindar continuidad de servicio (24x7)• Capacidad de crecer elásticamente• Delivery continuo• Monitoreo proactivo de la plataforma• MILLONES DE REQUESTS!!!

lagash.com

Como afecta esto a la forma en que diseñamos nuestras aplicaciones?

User Interface

APIsRuntime Identity

NotificationsDatabase

CacheSearch

Media

StorageNetworking

lagash.com

La arquitectura tradicional

Starring: The Monolith

Web

BusinessLogic

DB

Tier #1

Tier #2

Starring: The Monolith

Web

BusinessLogic

DB(active)

Web

DB(pasive)

Load Balancer

Cache

Cache

Tier #1

Tier #2

Tier #3

Starring: The Monolith

Web / APIs

Business Logic

Database

Starring: The Monolith

Web / APIs

Business Logic

Database

Web / APIs

Business Logic

Database

Web / APIs

Business Logic

Database

Web / APIs

Business Logic

Database

Web / APIs

Business Logic

Database

Web / APIs

Business Logic

Database

Web / APIs

Business Logic

Database

lagash.com

La nube al rescate...

Embrace the challengelagash.com

Infraestructura Como Servicio (IaaS)Como accedo a los datos?Donde guardo los datos?Como resuelvo la transversalidad?

Embrace the challengelagash.com

Mobile Backend As A Service (MBaaS)

Servers / Virtualization / OS / Storage / Networking

Identity / AuthN / AuthZ

Indexing / Search

Databases (SQL / NoSQL)

App Backend Code

Push Notifications

On Premises / Private Cloud / Public Cloud

Integration

Media Management

API Runtime / Management

Monitoring

Microsoft Azure

App Service

Active Directory

App Insights

Notifications Hubs

Media Services

Service Bus

Azure Search

DocumentDB SQL Database

App Service• “Runtime” para ejecutar aplicaciones en la nube

• Escala automáticamente (dependiendo del App Service Plan)

• Deployment slots• Integración continua• GitHub / Git / VSTS / Bitbucket / Dropbox

• Varios “sabores”• API App• Mobile App• Web App

Notification Hubs• Servicio para enviar notificaciones “Push” a

dispositivos• Broadcast a los principales proveedores• Apple APNS, Google GCM, Windows WNS,

Windows Phone MPNS, Amazon ADM, Baidu (Android China)

• Una sola API / SDK para dominarlos a todos

Media Services• Servicios para encoding y streaming de video• Jobs automáticos de encoding para varias

resoluciones y dispositivos• Endpoints para reproducción• Live streaming

DocumentDB• Base de datos NoSQL• Compatible a nivel API / funcionalidad con

MongoDB• Soporta colecciones “particionadas”• Prácticamente no tiene límites de

escalabilidad

Azure Search• Servicio de indexación y búsqueda de

documents• Permite búsquedas por filtros, facetas,

tags y ordenamientos• Se conecta con “DocumentDb”• Prácticamente no tiene límites de

escalabilidad

Accounts API

Companies API

Parameters API

Matching API

Media API

Notifications

API

App Service #1

App Service #2

App Service #3

App Service #4

App Service #5

App Service #6

Partitioned collection

10000 RU/s

Partitioned collection5000 RU/s

Single collection1500 RU/s

2 Replicas x 2 Partitions

10 reserved S1 processing

units10M Pushes10M Devices

lagash.com

Cambio de paradigma

Descomponiendo el monolitoWeb / APIs

Business Logic

Database

lagash.com

Que es un Microservicio?

Software +

Estado durable(opcional)

Desarrollado y operado por un equipo pequeño

Desarrollado encualquier lenguaje

o framework

Versionamiento y despliegue

independiente

Posee una dirección única para ubicarlo en

la red (URI)

Tolerante a fallos y escalable

Expone interfaces e interactúa mediante protocolos definidos

Embrace the challengelagash.com

Web / APIs

Business Logic

Database

My AppCluster #1

Cluster #2

Cluster #3

Embrace the challengelagash.com

My App

Cluster #1

Cluster #2

Cluster #3

Embrace the challengelagash.com

High Density Computing

lagash.com

Como administrar & gobernar mis apps de microservicios?

Embrace the challengelagash.com

Stacks de microserviciosAzure App Service

Docker Container

Cloud based stack Cloud & On Premises

Azure ServiceFabric

Embrace the challengelagash.com

VM vs. Docker

Embrace the challengelagash.com

lagash.com

Azure Service Fabric

Embrace the challengelagash.com

Service Fabric: una plataforma para microservicios hyper-escalables y confiables

Azure

WindowsServer Linux

Hosted Clouds

WindowsServer Linux

Service Fabric

Private Clouds

WindowsServer Linux

High Availability

Hyper-Scale

Hybrid Operations

High Density

Microservices

Rolling Upgrades Stateful

services

Low Latency Fast startup & shutdown

Container Orchestration & lifecycle management Replication &

FailoverSimple

programming models

Load balancing

Self-healingData Partitioning

Automated Rollback

Health Monitoring

Placement Constraints

Service Fabric Microservice Management

App1

App2

Embrace the challengelagash.com

Service Fabric Programming Models

Reliable Actors APIReliable Services API

Azure Private Clouds

Applications composed of microservices

High Availability

Hyper-Scale

Hybrid Operations

High Density

Rolling Upgrades Stateful

services

Low Latency Fast startup & shutdown

Container Orchestration & lifecycle management Replication &

FailoverSimple

programming models

Load balancing

Self-healingData Partitioning

Automated Rollback

Health Monitoring

Placement Constraints

Service Fabric

• Build stateless services using existing technologies such as ASP.NET

• Build stateful services using reliable collections• Manage the concurrency and granularity of state changes

using transactions• Communicate with services using the technology of your

choice • e.g. WebAPI and WCF

Reliable Services API

Collections• Single machine• Single threaded

Concurrent Collections• Single machine• Multi threaded

Reliable Collections• Multi machine

• Multi threaded• Replicated (HA)• Persistence• Asynchronous• Transactional

ReliableDictionary<T>

ReliableQueue<T>

Service Fabric Microservices

• Cualquier cosa puede ser un microservicio:• ASP.NET • node.js, Java VMs• Arbitrary .exe / Docker Container

• Stateless microservices• Un microservicio sin estado o con estado persistente en almacenamiento externo

como una base de datos SQL o DocumentDB• e.g. Cualquier aplicación web (ASP.NET) o worker role

• Stateful microservices• Estado persistente en forma local y confiable a través de replicación• Reduce la complejidad y cantidad de components de una arquitectura 3-tier

tradicional

Microservice Partitioning

P2

SS

SP4S

P1

S

S

P3S

S

S

S

Node 100

S

Node 101 Node 102 Node 103 Node 104 Node 105

• Los servicios pueden particionarse para > escalabilidad• El esquema de partición es decidio en tiempo de diseño.• Las particiones son desplegadas en las maquinas del

cluster

Cloud Services Built On Service FabricService DescriptionAzure Database Scale-out relational databaseAzure DocumentDB No-SQL store for JSON documents

Integrated with O365Azure Power BI BI Pro Data Analysis ServicesAzure Networking Regional Network Manager (RNM) for cross cluster/DC

VNETAzure Compute and Networking Resource Providers for Compute (CRP),

Networking (NRP), Storage (SRP)Event Hubs Streaming messaging and event processingService Bus Service Bus Resource Provider (SBRP)Intune Unified management of PCs and devices on the cloud. Bing Cortana Personal assistant

Cinco años en producciónMismo código utilizado por estos servicios

Azure Compute Continuum

Ultimate Control

Rapid Development

VMs /VM Scale Sets VM Extensions Service Fabric Web Apps/

App Service

IaaS PaaS

@maxolidean@Lagash.Chile@SergioBLagash

Resources

Argentina | Buenos Aires+54 (11) 4982 4185info@lagash.com

Chile | Santiago de Chile+56 (2) 2231 9428info_chile@lagash.com

Colombia | Bogotá+57 (1) 750 5276info_colombia@lagash.com

México | México DF+52 (55) 6394 0617info_mexico@lagash.com

USA | Seattle - US+1 844 4 Lagashinfousa@lagash.com

Uruguay | Montevideo+598 2623 2546info_uy@lagash.com

Let’s keep in touch