Tryst among Reverse Proxies and Load Balancers
In this post, I want to write down among thin line differentiation among load balancers and reverse proxies.
Let’s start with Reverse Proxy:
In client server communication, reverse proxy has essential role at server end. Simply put,it is a server that sits in front of web servers and forwards client (e.g. web browser) requests to those web servers. Reverse proxies are typically implemented to help increase security, performance, and reliability.
When clients send requests to the origin server of a website, those requests are intercepted by the reverse proxy server. The reverse proxy server will then send requests to and receive responses from the origin server.
However, forward proxy is component which is in front of client not server. When client make requests to sites and services on the Internet, the proxy server intercepts those requests and then communicates with web servers on behalf of those clients, like a middleman.
Why should i use forward proxy?
- Block malicious access
- Monitor employee activity (within organisation)
- Block specific requests
Now, Why should i use Reverse Proxy becomes the next question?
- Perform Load balancing
- Protection from DDoS attacks
- Caching
- SSL encryption
Popular reverse proxy implementations are:
- Nginx — https://docs.nginx.com/nginx/admin-guide/web-server/reverse-proxy
- Apache — https://httpd.apache.org/docs/2.4/howto/reverse_proxy.html
- ZUUL- https://github.com/Netflix/zuul
Load Balancers:
By definition, A load balancer is a device that acts as a reverse proxy and distributes network or application traffic across a number of servers.
Yes, I said reverse proxy and Yes i mentioned reverse proxy can balance load.
Load balancer just like reverse proxy is facade with a subtle difference that Reverse proxy distributes the traffic and load balancer caters to the client ask in terms of volume.
- Server Side Load Balancing: Server side load balancing is a monolithic It applies between the client and the server. It accepts incoming network, application traffic, and distributes the traffic across the multiple backend servers by using various methods. The middle component is responsible for distributing the client requests to the server.
- Client-Side Load Balancing: The client holds the list of server’s IPs so that it can deliver the requests. The client selects an IP from the list, randomly, and forwards the request to the server.
Criterion for load distribution:
- Least connection method — to direct traffic to lightest node in terms of utilisation, useful when distribution is uneven
- Least response time method — to direct traffic to lowest average response time
- Round robin — distributes the load evenly across, useful when all servers are same in terms of configuration and connections are not persistent.
- IP Hash — IP address of client defines the distribution logic.
ISO Model Placement:
Load balancers operate at both layer 4 and layer 7 and have intelligence accordingly built in. Taking AWS as an example, below is the comparison:
Source: -https://www.nclouds.com/blog/what-type-of-aws-elastic-load-balancing-aws-elb-is-right-for-you/
Apart from this, we have offerings from Nginx and Netflix(Ribbon) which can be used which we’ll be talking about soon.
Happy reading..!