Load balancing in Layer 4 vs Layer 7 with HAPROXY Examples
>> YOUR LINK HERE: ___ http://youtube.com/watch?v=aKMLgFVxZYk
💻 More software engineering videos • Software Engineering by Example • • Load balancing is process of balancing incoming requests to multiple machines, processes or services. In this video we will explain two types of load balancers, layer 4 and layer 7. • Chapters • 0:00 Intro • 6:00 L4 Load balancer • 9:10 L4 Load Balancer Pros and Cons • 16:18 Example L4 Load Balancer with HAPROXY • 22:30 L7 Load Balancer • 27:00 L7 Pros and Cons • 31:00 Example L7 Load Balancer with HAPROXY • 37:00 Summary • • Layer 4 (4/3) • Take content forwards it based on basic rules, it knows ip and port and perhaps latency of the target service. • Layer 4 - haproxy, NLB • Pros • great for simple packet-level load balancing • Fast and efficient doesn’t look at the data • More secure as it cant really look at your packets. So if it was compromised no one can look • Uses NAT • One connection between client and server NATed • Cons • Cant do smart load balancing based on the content, such as switch request based on requested media type • Cant do microservices with this type • Has to be sticky as it is a stateful protocol (all segments) • • Layer 7 (Nginx , haproxy) • This type of proxy actually looks at the content and have more context, it knows you are visiting the /users resources so it may forward it to a different server. Essential and Great for microservices , it knows the content is video:image etc.. • • it can also cache.. we cant really do caching on layer 4 because we have no clue whats in the packets. • But expensive because it has to decrypt and look and compute • • Layer 4 - haproxy, nlb • great for simple packet-level load balancing • fast and efficient doesn’t look at the data • More secure as it cant really look at your packets. So id it was compromised no one can look • Uses NAT • One connection between client and server NATed • Layer 7 - examples nginx • Smart routing based on the url (microservices) flexible • Provide caching • Expensive need to decrypt • Secuirty, you have to share your certificate with the load balancers. Id compromised attacker has access to all your data. • Proxy creates multiple connection (client to proxy/proxy to server) • • • Image thumbnails https://www.haproxy.com • • Support me on PayPal https://bit.ly/33ENps4 • Become A Patron / hnasr • Stay Awesome! • Hussein
#############################
