NGINX Load Balancing Log

July 11, 2017

What?

A(or many?) reverse proxy server sit in front of all application servers. (mostly) Responsible for directing request/response between client and server.

Why?

To scale application horizontally, improve system availability (failover)

Players?

Nginx, HAproxy, …

Nginx: ways to directing requests?

Problems?

Using Round robin and Least connected make code, relying on local memory, work inconsistently. Examples: websocket, user session stored in local, …

Sticky session could solve that but not good enough.

Solutions?

Store session data in db, retrieve by cookie token. Still not solve the problem with websocket, usually Redis is used in this case.

Multiple load balancers?

What if the load balancer dead or the traffic volume is too high? -> multiple load balancers

Load balancing between multiple load balancers?

DNS load balancing: not efficient, no health check, no sticky session?

AWS ELB: use ELB to load balancing between other load balancers (Nginx). Have support for sticky session. But why don’t just use ELB and eliminate all other load balancers?

What are other options?

Are there any ways to avoid sticky session?