Load Balancing Apps in Docker Swarm with NGINX

46
Load Balancing Apps in Docker Swarm with NGINX August 3, 2016

Transcript of Load Balancing Apps in Docker Swarm with NGINX

Page 1: Load Balancing Apps in Docker Swarm with NGINX

Load Balancing Apps in Docker Swarm with NGINX

August 3, 2016

Page 2: Load Balancing Apps in Docker Swarm with NGINX

Rick NelsonHead of Pre-sales at NGINX, Inc.

Formerly:- Riverbed, Zeus, VMware, BEA and more

Michael PleshakovPlatform Integration Engineer at NGINX, Inc.

Page 3: Load Balancing Apps in Docker Swarm with NGINX

What’s New With Docker?Docker Version 1.12

Page 4: Load Balancing Apps in Docker Swarm with NGINX

Docker Swarm• A clustering and

scheduling tool for containers

• Easily spreads containers across a cluster of Docker hosts

Page 5: Load Balancing Apps in Docker Swarm with NGINX

Swarm ModeCombines Docker hosts into a swarm:• Fault tolerant• Self healing• Decentralized

Page 6: Load Balancing Apps in Docker Swarm with NGINX

Additional Features• Easier Swarm cluster setup• Cryptographic node

identity• Every node identified by a

key• SSL/TLS between nodes

Page 7: Load Balancing Apps in Docker Swarm with NGINX

Additional Features• Service API• Scaling• Rolling updates• Health checks

Page 8: Load Balancing Apps in Docker Swarm with NGINX

Networking and Load Balancing• Cluster-wide overlay

network• DNS-based service

discovery• Built-in load balancing

Page 9: Load Balancing Apps in Docker Swarm with NGINX

Docker Swarm Architecture

Page 10: Load Balancing Apps in Docker Swarm with NGINX

Docker Swarm – Networking

Page 11: Load Balancing Apps in Docker Swarm with NGINX

Docker Swarm – Built-In Load Balancing

Page 12: Load Balancing Apps in Docker Swarm with NGINX

12

Swarm Demo

Page 13: Load Balancing Apps in Docker Swarm with NGINX

Why Another Load Balancer?• SSL termination• Content-based routing• Access control and authorization• Rewrites and redirects

Page 14: Load Balancing Apps in Docker Swarm with NGINX

NGINX F/OSS Adds• SSL termination• Content-based routing• Access control and auth• Rewrites and redirects• Advanced LB algorithms

• Multiprotocol support• Advanced logging• Limits• Scripting• Security

Page 15: Load Balancing Apps in Docker Swarm with NGINX

Docker Swarm – NGINX F/OSSExternal Client Requests

Page 16: Load Balancing Apps in Docker Swarm with NGINX

16

NGINX F/OSSSwarm Demo

Page 17: Load Balancing Apps in Docker Swarm with NGINX

NGINX PlusThe supported commercial version of NGINX

Page 18: Load Balancing Apps in Docker Swarm with NGINX

NGINX PlusBased on NGINX F/OSS

Page 19: Load Balancing Apps in Docker Swarm with NGINX

NGINX PlusAdds enterprise-grade load balancing features

Page 20: Load Balancing Apps in Docker Swarm with NGINX

NGINX PlusAn application delivery controller (ADC)

Page 21: Load Balancing Apps in Docker Swarm with NGINX

OPEN SOURCE PLUSFEATURES

REQUEST ROUTING COMPRESSION LOAD BALANCING APP HEALTH MONITORING

EDGE CACHE MEDIA STREAMING MONITORING ANALYTICS

What’s Inside NGINX Plus?GUI VISUALIZATION

CONFIGURATION RESTFUL APISSL EMBEDDED SCRIPT LANGUAGE

Page 22: Load Balancing Apps in Docker Swarm with NGINX

What’s Been Added in NGINX Plus?• Active health checks

Page 23: Load Balancing Apps in Docker Swarm with NGINX

NGINX Plus – Active Health Checks

Sophisticated, app-specific health checksDetect application failures, orchestrate upgrades

Internet

Server 1 isfailing

Servers 2 and 3are active

Page 24: Load Balancing Apps in Docker Swarm with NGINX

What’s Been Added in NGINX Plus?• Session persistence

Page 25: Load Balancing Apps in Docker Swarm with NGINX

NGINX Plus – Session Persistence - Draining

Internet

Server 1 isdraining

Sessions (orange) against server 1 are allowed to complete.New sessions are directed to servers 2 and 3

Servers 2 and 3are active

Page 26: Load Balancing Apps in Docker Swarm with NGINX

What’s Been Added in NGINX Plus?• Dynamic reconfiguration

Page 27: Load Balancing Apps in Docker Swarm with NGINX

NGINX Plus – Dynamic Reconfiguration

http { resolver 192.168.0.2; upstream backends1 { zone backends1 64k; server api.u.com resolve; } upstream backends2 { zone backends2 64k; server 192.168.100.10; server 192.168.100.11; } server { . . . location /upstream_conf { upstream_conf; } . . . }}

DNS

Changes in DNS can dynamically update NGINX Plus’ load-balancing configuration API

Upstream_conf API is a simple HTTP API to control configuration

Page 28: Load Balancing Apps in Docker Swarm with NGINX

What’s Been Added in NGINX Plus?• Live activity monitoring

Page 29: Load Balancing Apps in Docker Swarm with NGINX

NGINX Plus – Live Activity Monitoring

Page 30: Load Balancing Apps in Docker Swarm with NGINX

Docker Swarm – NGINX F/OSSExternal Client Requests

Page 31: Load Balancing Apps in Docker Swarm with NGINX

Docker Swarm – NGINX PlusExternal Client Requests

Page 32: Load Balancing Apps in Docker Swarm with NGINX

32

NGINX PlusSwarm Demo Part 1

Page 33: Load Balancing Apps in Docker Swarm with NGINX

NGINX Plus Swarm Mode Demo

Page 34: Load Balancing Apps in Docker Swarm with NGINX

34

NGINX PlusSwarm Demo Part 2

Page 35: Load Balancing Apps in Docker Swarm with NGINX

Load-Balancing ModelsThere are different options for deploying a load balancer in a microservices environment

Page 36: Load Balancing Apps in Docker Swarm with NGINX

Proxy Model

• Inbound traffic is managed through a reverse proxy/load balancer

• Services are left to themselves to connect to each other

• Often through round-robin DNS

Page 37: Load Balancing Apps in Docker Swarm with NGINX

Docker Swarm – NGINX F/OSSExternal Client Requests

Page 38: Load Balancing Apps in Docker Swarm with NGINX

Docker Swarm – NGINX F/OSSInternal Service-to-Service Requests

Page 39: Load Balancing Apps in Docker Swarm with NGINX

Router Mesh Model

• Inbound routing through reverse proxy

• Centralized load balancing through a separate load-balancing service

• Marathon LB and Deis Router work like this

Page 40: Load Balancing Apps in Docker Swarm with NGINX

Fabric Model

• Routing is done at the container level

• Services connect to each other as needed

• NGINX Plus acts as the forward and reverse proxy for all requests

• NGINX Plus caches SSL sessions

Page 41: Load Balancing Apps in Docker Swarm with NGINX

SummaryThe new orchestration features in Docker v1.12 are powerful

Page 42: Load Balancing Apps in Docker Swarm with NGINX

SummaryOpen source NGINX provides a more advanced load balancing solution

Page 43: Load Balancing Apps in Docker Swarm with NGINX

SummaryNGINX Plus brings enterprise grade load balancing

Page 44: Load Balancing Apps in Docker Swarm with NGINX

Q & A