Load Balancing Apps in Docker Swarm with NGINX
Transcript of Load Balancing Apps in Docker Swarm with NGINX
![Page 1: Load Balancing Apps in Docker Swarm with NGINX](https://reader034.fdocuments.in/reader034/viewer/2022051521/5872c64d1a28ab0c718b6451/html5/thumbnails/1.jpg)
Load Balancing Apps in Docker Swarm with NGINX
August 3, 2016
![Page 2: Load Balancing Apps in Docker Swarm with NGINX](https://reader034.fdocuments.in/reader034/viewer/2022051521/5872c64d1a28ab0c718b6451/html5/thumbnails/2.jpg)
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](https://reader034.fdocuments.in/reader034/viewer/2022051521/5872c64d1a28ab0c718b6451/html5/thumbnails/3.jpg)
What’s New With Docker?Docker Version 1.12
![Page 4: Load Balancing Apps in Docker Swarm with NGINX](https://reader034.fdocuments.in/reader034/viewer/2022051521/5872c64d1a28ab0c718b6451/html5/thumbnails/4.jpg)
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](https://reader034.fdocuments.in/reader034/viewer/2022051521/5872c64d1a28ab0c718b6451/html5/thumbnails/5.jpg)
Swarm ModeCombines Docker hosts into a swarm:• Fault tolerant• Self healing• Decentralized
![Page 6: Load Balancing Apps in Docker Swarm with NGINX](https://reader034.fdocuments.in/reader034/viewer/2022051521/5872c64d1a28ab0c718b6451/html5/thumbnails/6.jpg)
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](https://reader034.fdocuments.in/reader034/viewer/2022051521/5872c64d1a28ab0c718b6451/html5/thumbnails/7.jpg)
Additional Features• Service API• Scaling• Rolling updates• Health checks
![Page 8: Load Balancing Apps in Docker Swarm with NGINX](https://reader034.fdocuments.in/reader034/viewer/2022051521/5872c64d1a28ab0c718b6451/html5/thumbnails/8.jpg)
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](https://reader034.fdocuments.in/reader034/viewer/2022051521/5872c64d1a28ab0c718b6451/html5/thumbnails/9.jpg)
Docker Swarm Architecture
![Page 10: Load Balancing Apps in Docker Swarm with NGINX](https://reader034.fdocuments.in/reader034/viewer/2022051521/5872c64d1a28ab0c718b6451/html5/thumbnails/10.jpg)
Docker Swarm – Networking
![Page 11: Load Balancing Apps in Docker Swarm with NGINX](https://reader034.fdocuments.in/reader034/viewer/2022051521/5872c64d1a28ab0c718b6451/html5/thumbnails/11.jpg)
Docker Swarm – Built-In Load Balancing
![Page 12: Load Balancing Apps in Docker Swarm with NGINX](https://reader034.fdocuments.in/reader034/viewer/2022051521/5872c64d1a28ab0c718b6451/html5/thumbnails/12.jpg)
12
Swarm Demo
![Page 13: Load Balancing Apps in Docker Swarm with NGINX](https://reader034.fdocuments.in/reader034/viewer/2022051521/5872c64d1a28ab0c718b6451/html5/thumbnails/13.jpg)
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](https://reader034.fdocuments.in/reader034/viewer/2022051521/5872c64d1a28ab0c718b6451/html5/thumbnails/14.jpg)
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](https://reader034.fdocuments.in/reader034/viewer/2022051521/5872c64d1a28ab0c718b6451/html5/thumbnails/15.jpg)
Docker Swarm – NGINX F/OSSExternal Client Requests
![Page 16: Load Balancing Apps in Docker Swarm with NGINX](https://reader034.fdocuments.in/reader034/viewer/2022051521/5872c64d1a28ab0c718b6451/html5/thumbnails/16.jpg)
16
NGINX F/OSSSwarm Demo
![Page 17: Load Balancing Apps in Docker Swarm with NGINX](https://reader034.fdocuments.in/reader034/viewer/2022051521/5872c64d1a28ab0c718b6451/html5/thumbnails/17.jpg)
NGINX PlusThe supported commercial version of NGINX
![Page 18: Load Balancing Apps in Docker Swarm with NGINX](https://reader034.fdocuments.in/reader034/viewer/2022051521/5872c64d1a28ab0c718b6451/html5/thumbnails/18.jpg)
NGINX PlusBased on NGINX F/OSS
![Page 19: Load Balancing Apps in Docker Swarm with NGINX](https://reader034.fdocuments.in/reader034/viewer/2022051521/5872c64d1a28ab0c718b6451/html5/thumbnails/19.jpg)
NGINX PlusAdds enterprise-grade load balancing features
![Page 20: Load Balancing Apps in Docker Swarm with NGINX](https://reader034.fdocuments.in/reader034/viewer/2022051521/5872c64d1a28ab0c718b6451/html5/thumbnails/20.jpg)
NGINX PlusAn application delivery controller (ADC)
![Page 21: Load Balancing Apps in Docker Swarm with NGINX](https://reader034.fdocuments.in/reader034/viewer/2022051521/5872c64d1a28ab0c718b6451/html5/thumbnails/21.jpg)
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](https://reader034.fdocuments.in/reader034/viewer/2022051521/5872c64d1a28ab0c718b6451/html5/thumbnails/22.jpg)
What’s Been Added in NGINX Plus?• Active health checks
![Page 23: Load Balancing Apps in Docker Swarm with NGINX](https://reader034.fdocuments.in/reader034/viewer/2022051521/5872c64d1a28ab0c718b6451/html5/thumbnails/23.jpg)
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](https://reader034.fdocuments.in/reader034/viewer/2022051521/5872c64d1a28ab0c718b6451/html5/thumbnails/24.jpg)
What’s Been Added in NGINX Plus?• Session persistence
![Page 25: Load Balancing Apps in Docker Swarm with NGINX](https://reader034.fdocuments.in/reader034/viewer/2022051521/5872c64d1a28ab0c718b6451/html5/thumbnails/25.jpg)
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](https://reader034.fdocuments.in/reader034/viewer/2022051521/5872c64d1a28ab0c718b6451/html5/thumbnails/26.jpg)
What’s Been Added in NGINX Plus?• Dynamic reconfiguration
![Page 27: Load Balancing Apps in Docker Swarm with NGINX](https://reader034.fdocuments.in/reader034/viewer/2022051521/5872c64d1a28ab0c718b6451/html5/thumbnails/27.jpg)
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](https://reader034.fdocuments.in/reader034/viewer/2022051521/5872c64d1a28ab0c718b6451/html5/thumbnails/28.jpg)
What’s Been Added in NGINX Plus?• Live activity monitoring
![Page 29: Load Balancing Apps in Docker Swarm with NGINX](https://reader034.fdocuments.in/reader034/viewer/2022051521/5872c64d1a28ab0c718b6451/html5/thumbnails/29.jpg)
NGINX Plus – Live Activity Monitoring
![Page 30: Load Balancing Apps in Docker Swarm with NGINX](https://reader034.fdocuments.in/reader034/viewer/2022051521/5872c64d1a28ab0c718b6451/html5/thumbnails/30.jpg)
Docker Swarm – NGINX F/OSSExternal Client Requests
![Page 31: Load Balancing Apps in Docker Swarm with NGINX](https://reader034.fdocuments.in/reader034/viewer/2022051521/5872c64d1a28ab0c718b6451/html5/thumbnails/31.jpg)
Docker Swarm – NGINX PlusExternal Client Requests
![Page 32: Load Balancing Apps in Docker Swarm with NGINX](https://reader034.fdocuments.in/reader034/viewer/2022051521/5872c64d1a28ab0c718b6451/html5/thumbnails/32.jpg)
32
NGINX PlusSwarm Demo Part 1
![Page 33: Load Balancing Apps in Docker Swarm with NGINX](https://reader034.fdocuments.in/reader034/viewer/2022051521/5872c64d1a28ab0c718b6451/html5/thumbnails/33.jpg)
NGINX Plus Swarm Mode Demo
![Page 34: Load Balancing Apps in Docker Swarm with NGINX](https://reader034.fdocuments.in/reader034/viewer/2022051521/5872c64d1a28ab0c718b6451/html5/thumbnails/34.jpg)
34
NGINX PlusSwarm Demo Part 2
![Page 35: Load Balancing Apps in Docker Swarm with NGINX](https://reader034.fdocuments.in/reader034/viewer/2022051521/5872c64d1a28ab0c718b6451/html5/thumbnails/35.jpg)
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](https://reader034.fdocuments.in/reader034/viewer/2022051521/5872c64d1a28ab0c718b6451/html5/thumbnails/36.jpg)
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](https://reader034.fdocuments.in/reader034/viewer/2022051521/5872c64d1a28ab0c718b6451/html5/thumbnails/37.jpg)
Docker Swarm – NGINX F/OSSExternal Client Requests
![Page 38: Load Balancing Apps in Docker Swarm with NGINX](https://reader034.fdocuments.in/reader034/viewer/2022051521/5872c64d1a28ab0c718b6451/html5/thumbnails/38.jpg)
Docker Swarm – NGINX F/OSSInternal Service-to-Service Requests
![Page 39: Load Balancing Apps in Docker Swarm with NGINX](https://reader034.fdocuments.in/reader034/viewer/2022051521/5872c64d1a28ab0c718b6451/html5/thumbnails/39.jpg)
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](https://reader034.fdocuments.in/reader034/viewer/2022051521/5872c64d1a28ab0c718b6451/html5/thumbnails/40.jpg)
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](https://reader034.fdocuments.in/reader034/viewer/2022051521/5872c64d1a28ab0c718b6451/html5/thumbnails/41.jpg)
SummaryThe new orchestration features in Docker v1.12 are powerful
![Page 42: Load Balancing Apps in Docker Swarm with NGINX](https://reader034.fdocuments.in/reader034/viewer/2022051521/5872c64d1a28ab0c718b6451/html5/thumbnails/42.jpg)
SummaryOpen source NGINX provides a more advanced load balancing solution
![Page 43: Load Balancing Apps in Docker Swarm with NGINX](https://reader034.fdocuments.in/reader034/viewer/2022051521/5872c64d1a28ab0c718b6451/html5/thumbnails/43.jpg)
SummaryNGINX Plus brings enterprise grade load balancing
![Page 44: Load Balancing Apps in Docker Swarm with NGINX](https://reader034.fdocuments.in/reader034/viewer/2022051521/5872c64d1a28ab0c718b6451/html5/thumbnails/44.jpg)
Q & A
![Page 45: Load Balancing Apps in Docker Swarm with NGINX](https://reader034.fdocuments.in/reader034/viewer/2022051521/5872c64d1a28ab0c718b6451/html5/thumbnails/45.jpg)
1. Docker Swarm2. NGINX Plus and Docker3. DNS Service Discovery with NGINX4. The Fabric Model
Resources