What is "Reverse Proxy" and "Load Balancing" in Nginx / Web server terms?

robue-a7119895 picture robue-a7119895 · Nov 18, 2014 · Viewed 7.6k times · Source

These are two phrases I hear about very often, mainly associated with Nginx. Can someone give me a laymans defintion?

Answer

ChainLooper picture ChainLooper · Mar 3, 2015

Definitions are often difficult to understand. I guess you just need some explanation for their use case.

A short explanation is: load balancing is one of the functionalities of reverse proxy, and reverse proxy is one of the softwares that can do load balancing.

And a long explanation is given below.

For example a service of your company has customers in UK and German. Because the policy is different for these two countries, your company has two web servers, uk.myservice.com for UK and de.myservice.com for German, each with different business logic. In addition, your company wants there to be only one unified endpoint, myservice.com for the service. In this case, you need to set up a reverse proxy as the unified endpoint. The proxy takes the url myservice.com, and rewrites the url of incoming requests so that requests from UK(determined by source ip) go to uk.myservice.com and requests from German go to de.myservice.com. From the view of a client from UK, it never knows the response is actually generated from uk.myservice.com.

In this case, the load of request traffic to the service is actually balanced to servers on uk.myservice.com and de.myservice.com as a side effect. So we normally don't call it used as a load balancer, just say it as a reverse proxy.

But lets say if your company uses the same policy for all countries, and has 2 servers, a.myservice.com and b.myservice.com, only for the reason that the work load is to heavy for one server machine. In this case, we normally call the reverse proxy as load balancer to emphasize the reason why it is being used.