Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is pass-through load balancer? How is it different from proxy load balancer?

Tags:

Google Cloud Network load balancer is a pass-through load balancer and not a proxy load balancer. ( https://cloud.google.com/compute/docs/load-balancing/network/ ).

I can not find any resources in general on a pass through LB. Both HAProxy and Nginx seems to be proxy LBs. I'm guessing that pass through LB would be redirecting the clients directly to the servers. In what scenarios it would be beneficial?

Are there any other type of load balancers except pass-through and proxy?

like image 377
Mohit Gupta Avatar asked Apr 04 '17 11:04

Mohit Gupta


People also ask

What is the difference between a proxy and a load balancer?

A reverse proxy accepts a request from a client, forwards it to a server that can fulfill it, and returns the server's response to the client. A load balancer distributes incoming client requests among a group of servers, in each case returning the response from the selected server to the appropriate client.

What is pass through load balancer?

SSL passthrough is the action of passing data through a load balancer to a server without decrypting it. Usually, the decryption or SSL termination happens at the load balancer and data is passed along to a web server as plain HTTP. But SSL passthrough keeps the data encrypted as it travels through the load balancer.

What is a proxy load balancer?

External TCP Proxy Load Balancing lets you use a single IP address for all users worldwide. The external TCP proxy load balancer automatically routes traffic to the backends that are closest to the user. With Premium Tier, External TCP Proxy Load Balancing can be configured as a global load balancing service.

What are the two types of load balancer?

Elastic Load Balancing supports the following types of load balancers: Application Load Balancers, Network Load Balancers, and Classic Load Balancers. Amazon ECS services can use these types of load balancer. Application Load Balancers are used to route HTTP/HTTPS (or Layer 7) traffic.


1 Answers

It's hard to find resources for pass-through load balancing because everyone came up with a different way of calling it: pass-though, direct server return(DSR), direct routing,...

We'll call it pass-through here.

Let me try to explain the thing:

  • The IP packets are forwarded unmodified to the VM, there is no address or port translation.

  • The VM thinks that the load balancer IP is one of its own IPs.

    In the specific case of Compute Engine Network Load Balancing https://cloud.google.com/compute/docs/load-balancing/: For Linux this is done by adding a route to this IP in the "local" routing table, Windows by adding a secondary IP on the network interface.

  • The routing logic has to make sure that packets for a TCP connection or UDP "connection" are always sent to the same VM.

    For GCE network LB see here https://cloud.google.com/compute/docs/load-balancing/network/target-pools#sessionaffinity

Regarding other load balancer types there can't be a definitive list, here are a few examples:

  • NAT. An example with iptables is here https://tipstricks.itmatrix.eu/use-iptables-to-load-balance-web-trafic/.

  • TCP Proxy. In Google Cloud Platform you can use TCP Proxy Load Balancing https://cloud.google.com/compute/docs/load-balancing/tcp-ssl/tcp-proxy

  • HTTP Proxy. In Google Cloud Platform you can use HTTP(s) Load Balancing https://cloud.google.com/compute/docs/load-balancing/http/

  • DNS, called "DNS forwarder". For example: dnsmasq http://www.thekelleys.org.uk/dnsmasq/doc.html, or bind in "forwarding" mode https://www.digitalocean.com/community/tutorials/how-to-configure-bind-as-a-caching-or-forwarding-dns-server-on-ubuntu-14-04

  • Database communication protocols. For example the MySQL Protocol with https://github.com/mysql/mysql-proxy

  • SIP protocol. Big list of implementations here https://www.voip-info.org/wiki/view/Open+Source+VOIP+Software#SIPProxies

As for the advantages of pass-through over other methods:

  • Some applications won't work or need to be adapted if the addresses on the IP packets is changing, for example the SIP protocol. See the Wikipedia for more on applications that don't play along well with NAT https://en.wikipedia.org/wiki/Network_address_translation#NAT_and_TCP/UDP.

    Here the advantage pass-through is that it does not change the source and destination IPs.

    Note that there is a trick for a load balancer working at a higher layer to keep the IPs: the load balancer spoofs the IP of the client when connecting to the backends. As of this writing no load balancing product uses this method in Compute Engine.

  • If you need more control over the TCP connection from the client, for example to tune the TCP parameters. This is an advantage of pass-through or NAT over TCP (or higher layer) proxy.

like image 144
Matt-y-er Avatar answered Oct 19 '22 03:10

Matt-y-er