Load balancing in Layer 4 vs Layer 7 with HAPROXY Examples

preview_player
Показать описание


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)

Stay Awesome!
Hussein
Рекомендации по теме
Комментарии
Автор

this playlist just keep getting better and better honestly it may be the greatest channel in the tech field

bahaaeldeen
Автор

"More we repeat more we learn!" that's the way to teach - thank you so much Nasser, you are the best!

anamulkabir
Автор

dude, i simply love the way you articulate. It is like listening to a story. I tried to look up some other videos on this topic. But frankly speaking, the difference between Layer 4 and 7 was never explained so easily. Hats off to you Hussein

siddharthshukla
Автор

Great, I am a unix sysadmin and you helped me understand some old stuff making it easier. Those good old days!

amitbistk
Автор

Very well explained, thanks so much! Your way of explaining with an intent to capture audience attention but the same time not compromising the technical details is very nice.

aarthydesikan
Автор

I randomly came here from your NAT video just for fun. I didn't expect to leave with a clear understanding of this. You're awesome.

robertluong
Автор

Hi Hussein!
I recently came across your channel and now I wish I had found this earlier. Thanks for the amazing informatic videos.

SunilRana-tmlm
Автор

Hey man, thanks for the video, it was informative.
Your funny style made it even more interesting.

SinghGaurav
Автор

I dont know if I would have understood L4 and L7 R-Proxy better...
THANKS A LOT!

Bow to you!

iammjpops
Автор

the best channel ever with real-world application of tech

aniekutmfonekere
Автор

Ur content is super great! And ur narration 😂 just when I’m losing my attention you say something funny and then I’m paying attention again 😆😆 many thanks!

fireystella
Автор

HI Hussein ! I'm so happy to have found a channel with such a great content. I have noticed that besides the videos, your slides are also very clear and concise. It would be really helpful if you could also share a link to them ! Keep up the good work

eraldkeshi
Автор

An excellent demostration of difference between the 2 Load balancers, good job Hussein !!

jeetendrashinde
Автор

A great explanation with a lot of energy. Love it!

xavierk
Автор

thank you, for your hard work. you are such an amazing person, sharing all this wonderful knowledge.

subhamprasad
Автор

Thanks for making our life easy and also for making your videos a lot more entertaining. :D

rishabhjain
Автор

thanks for this great video, helps a lot for preparing system design interviews!

wangsonny
Автор

this helped me have a better understanding of the difference between a Layer 4 Load Balancer and a Layer 7 Load Balancer.
Now I understand that an ingress is a Layer 7 Load Balancer

davidlira
Автор

29:50 "I dont want the load balancer to look at my data." Sir, the fact that you dont have a million subscribers is a crime on humanity.

arunsatyarth
Автор

He killed me with the "pew pew pew" at the round robin demonstration

ujemvi