Các loại load balancer: ALB và NLB
Load balancer là điểm tiếp nhận chung: nhận request từ client và phân phối cho nhiều target, chẳng hạn EC2 instance. Hai loại chính khác nhau ở chỗ có phân tích nội dung request hay chỉ chuyển tiếp kết nối.
Application Load Balancer (ALB) phân tích nội dung request HTTP: path, tên miền, header. Network Load Balancer (NLB) hoạt động ở tầng 4 (listener TCP, UDP, TLS, QUIC), không phân tích nội dung HTTP; NLB có một IP cho mỗi AZ (gắn được Elastic IP) và xử lý được hàng triệu request mỗi giây. Ngoài EC2, target group có target type ip nhận cả tài nguyên on-premises kết nối qua Direct Connect hoặc Site-to-Site VPN (chỉ IP private). Thử từng yêu cầu của MFTECH, lần lượt với ALB và NLB:
Chọn một yêu cầu của MFTECH, sau đó nhấn Gửi request. Bật tuỳ chọn của tình huống (loại load balancer hoặc vị trí EC2) và gửi lại để so sánh kết quả.
MFTECH dự kiến mở rộng sang một Region tại Hoa Kỳ. Câu hỏi đặt ra: một load balancer có thể phân phối tải cho cả hai Region hay không?
- Ứng dụng web cần định tuyến theo URL, tên miền: ALB.
- TCP/UDP thuần, IP cố định cho đối tác, PrivateLink: NLB.
- Máy chủ UDP tại data center: NLB với listener UDP và target type ip (IP private, qua Direct Connect hoặc VPN).
- EC2 instance đặt trong private subnet; chỉ load balancer nằm trong public subnet.
- Nhiều Region: mỗi Region một load balancer, Route 53 hoặc Global Accelerator phía trước.
Load balancer types: ALB and NLB
A load balancer is the shared entry point: it receives requests from clients and distributes them across multiple targets, such as EC2 instances. The two main types differ in whether they inspect the request content or only forward connections.
An Application Load Balancer (ALB) inspects the content of HTTP requests: path, domain name, headers. A Network Load Balancer (NLB) works at layer 4 (TCP, UDP, TLS and QUIC listeners) and does not inspect HTTP content; an NLB has one IP per AZ (which can be an Elastic IP) and can handle millions of requests per second. Besides EC2, a target group with the ip target type also accepts on-premises resources connected through Direct Connect or Site-to-Site VPN (private IPs only). Try each MFTECH requirement, first with an ALB and then with an NLB:
Chọn một yêu cầu của MFTECH, sau đó nhấn Gửi request. Bật tuỳ chọn của tình huống (loại load balancer hoặc vị trí EC2) và gửi lại để so sánh kết quả.
MFTECH plans to expand to a Region in the United States. The question: can one load balancer distribute load across both Regions?
- Web applications that need routing by URL or domain name: ALB.
- Plain TCP/UDP, a fixed IP for partners, PrivateLink: NLB.
- UDP servers in a data center: NLB with a UDP listener and the ip target type (private IPs, over Direct Connect or VPN).
- EC2 instances sit in private subnets; only the load balancer is in public subnets.
- Multiple Regions: one load balancer per Region, with Route 53 or Global Accelerator in front.