auto scaling for multi-tier containers topology

31
Auto Scaling for Multi- Tier Containers Topology

Upload: jelastic

Post on 11-Jan-2017

322 views

Category:

Technology


0 download

TRANSCRIPT

Page 1: Auto Scaling for Multi-Tier Containers Topology

Auto Scaling for Multi-Tier Containers Topology

Page 2: Auto Scaling for Multi-Tier Containers Topology

The Problem

Page 3: Auto Scaling for Multi-Tier Containers Topology

NotExpected Load

Page 4: Auto Scaling for Multi-Tier Containers Topology

Your app becomes slow

Page 5: Auto Scaling for Multi-Tier Containers Topology

Your app is down

Page 6: Auto Scaling for Multi-Tier Containers Topology

SolutionScale your application

Page 7: Auto Scaling for Multi-Tier Containers Topology

Issues that prevent us to do scaling

• Application is not designed for scaling

• We cannot predict our spikes

• The provisioning of each new instance takes

much time

• We never know what bottlenecks to expect

Page 8: Auto Scaling for Multi-Tier Containers Topology

Let’s try to eliminate these issues

Page 9: Auto Scaling for Multi-Tier Containers Topology

Design your application for multiple instances support

Page 10: Auto Scaling for Multi-Tier Containers Topology

Containers can help you provision appsfaster!

Page 11: Auto Scaling for Multi-Tier Containers Topology

Application Container

Use Docker for packing applications into containers

Page 12: Auto Scaling for Multi-Tier Containers Topology

Mul

tiplic

ity o

f Goo

dsM

ultip

licity

of m

etho

ds fo

r tr

ansp

ortin

g/st

orin

g

Do I w

orry about how

goods interact? C

an I transport quickly and sm

oothly?

…in between, can be loaded and unloaded, stacked, transported efficiently over long distances, and transferred from one mode of transport to another

A standard container that is loaded with virtually any goods, and stays sealed until it reaches final delivery.

Shipping container for goods

Page 13: Auto Scaling for Multi-Tier Containers Topology

Static website

Web frontend

User DB

Queue

Analytics DB

Development VM

QA server

Public Cloud Contributor’s

laptop

Mul

tiplic

ity o

f Sta

cks

Production Cluster

Customer Data Center

…that can be manipulated using standard operations and run consistently on virtually any hardware platform

An engine that enables any payload to be encapsulated as a lightweight, portable, self-sufficient container…

Docker is a shipping container system for code

Mul

tiplic

ity o

f har

dwar

e en

viro

nmen

ts

Do services and apps

interact appropriately?C

an I migrate sm

oothly and quickly?

Page 14: Auto Scaling for Multi-Tier Containers Topology

Why Docker containers are better for scaling than VMs?

Page 15: Auto Scaling for Multi-Tier Containers Topology

Designed for High Availability

Page 16: Auto Scaling for Multi-Tier Containers Topology

Lets Scale

Using Docker

Page 17: Auto Scaling for Multi-Tier Containers Topology

Simple WordPress application

Page 18: Auto Scaling for Multi-Tier Containers Topology

The Goal

Page 19: Auto Scaling for Multi-Tier Containers Topology

• You must use load balancer once you scale an app horizontally

• Keep look at sticky load balancing

• Load balancer can be scaled horizontally

• Dynamic scaling in and out is also possible!

Load balancing consideration

Page 20: Auto Scaling for Multi-Tier Containers Topology

Scaling of the web layer

• Should be done just in time

• Load balancer should be aware of resizing at the web layer

• Requires additional actions for stateful applications:

• Use of storage replication

• Use of shared persistent storage

Page 21: Auto Scaling for Multi-Tier Containers Topology

Database scaling consideration

• Relational databases usually scale good only vertically

• Relational database usually can’t be scaled horizontally in a runtime

• We have to prepare a database cluster of a fixed size

Page 22: Auto Scaling for Multi-Tier Containers Topology

The topology that we try to create

Page 23: Auto Scaling for Multi-Tier Containers Topology

{ "extip": true, "cloudlets": 8, "count": 2, "nodeType": "docker", "nodeGroup": "bl", "docker": { "image": "jelastic/wp-nginxlb" }, "displayName": "Load balancer"}

Load balancer layer declaration

Page 24: Auto Scaling for Multi-Tier Containers Topology

{ "cloudlets": 8, "count": 2, "nodeType": "docker", "nodeGroup": "cp", "docker": { "image": "jelastic/wp-nginxphp", "links": "sqldb:db", "volumes": ["/var/www/webroot/ROOT"], "volumeMounts": { "/var/www/webroot/ROOT": { "readOnly": false, "sourcePath": "/data", "sourceNodeGroup": "storage" } } }, "displayName": "AppServer"}

Web layer declaration

Page 25: Auto Scaling for Multi-Tier Containers Topology

{ "cloudlets": 8, "nodeGroup": "storage", "nodeType": "docker", "docker": { "image": "jelastic/storage" }, "displayName": "Storage"}, { "cloudlets": 8, "count": 2, "nodeType": "docker", "nodeGroup": "sqldb", "docker": { "image": "jelastic/wp-db" }, "displayName": "Database"}

DB & Storage layer declaration

Page 26: Auto Scaling for Multi-Tier Containers Topology

Set your triggers for each layer

Page 27: Auto Scaling for Multi-Tier Containers Topology

"onAfterScaleIn[nodeGroup:cp]": { "call": "ScaleNodes" }, "onAfterScaleOut[nodeGroup:cp]": { "call": "ScaleNodes" }, "onInit": { "call": [ "configureDBReplication","setupWP", "ScaleNodes", "enableAutoScaling" ] }}

Scaling Triggers declaration

Page 28: Auto Scaling for Multi-Tier Containers Topology

{ "id": "ScaleNodes", "onCall": [{ "execCmd": [{ "commands": ["echo \"\" > /etc/nginx/upstreams/common"], "nodeGroup": "bl" }] }, { "forEach(node:nodes.cp)": { "execCmd": { "commands": ["echo \"${@node.intIP}\" >> /etc/nginx/upstreams/common"], "nodeGroup": "bl" } } }, { "execCmd": { "commands": ["jem balancer rebuildCommon", "/etc/init.d/nginx reload"], "nodeGroup": "bl" } } ]}

Scaling Triggers Body

Page 29: Auto Scaling for Multi-Tier Containers Topology

Use stress tools to simulate load

Page 30: Auto Scaling for Multi-Tier Containers Topology

Analyze metrics in each individual microservice