load balancing apps in docker swarm with nginx
TRANSCRIPT
Load Balancing Apps in Docker Swarm with NGINX
August 3, 2016
Rick NelsonHead of Pre-sales at NGINX, Inc.
Formerly:- Riverbed, Zeus, VMware, BEA and more
Michael PleshakovPlatform Integration Engineer at NGINX, Inc.
What’s New With Docker?Docker Version 1.12
Docker Swarm• A clustering and
scheduling tool for containers
• Easily spreads containers across a cluster of Docker hosts
Swarm ModeCombines Docker hosts into a swarm:• Fault tolerant• Self healing• Decentralized
Additional Features• Easier Swarm cluster setup• Cryptographic node
identity• Every node identified by a
key• SSL/TLS between nodes
Additional Features• Service API• Scaling• Rolling updates• Health checks
Networking and Load Balancing• Cluster-wide overlay
network• DNS-based service
discovery• Built-in load balancing
Docker Swarm Architecture
Docker Swarm – Networking
Docker Swarm – Built-In Load Balancing
12
Swarm Demo
Why Another Load Balancer?• SSL termination• Content-based routing• Access control and authorization• Rewrites and redirects
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
Docker Swarm – NGINX F/OSSExternal Client Requests
16
NGINX F/OSSSwarm Demo
NGINX PlusThe supported commercial version of NGINX
NGINX PlusBased on NGINX F/OSS
NGINX PlusAdds enterprise-grade load balancing features
NGINX PlusAn application delivery controller (ADC)
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
What’s Been Added in NGINX Plus?• Active health checks
NGINX Plus – Active Health Checks
Sophisticated, app-specific health checksDetect application failures, orchestrate upgrades
Internet
Server 1 isfailing
Servers 2 and 3are active
What’s Been Added in NGINX Plus?• Session persistence
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
What’s Been Added in NGINX Plus?• Dynamic reconfiguration
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
What’s Been Added in NGINX Plus?• Live activity monitoring
NGINX Plus – Live Activity Monitoring
Docker Swarm – NGINX F/OSSExternal Client Requests
Docker Swarm – NGINX PlusExternal Client Requests
32
NGINX PlusSwarm Demo Part 1
NGINX Plus Swarm Mode Demo
34
NGINX PlusSwarm Demo Part 2
Load-Balancing ModelsThere are different options for deploying a load balancer in a microservices environment
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
Docker Swarm – NGINX F/OSSExternal Client Requests
Docker Swarm – NGINX F/OSSInternal Service-to-Service Requests
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
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
SummaryThe new orchestration features in Docker v1.12 are powerful
SummaryOpen source NGINX provides a more advanced load balancing solution
SummaryNGINX Plus brings enterprise grade load balancing
Q & A
1. Docker Swarm2. NGINX Plus and Docker3. DNS Service Discovery with NGINX4. The Fabric Model
Resources