Case study

AWS Load Balancing

Kiến trúc phân phối lưu lượng, health check, thay instance lỗi và Auto Scaling trên AWS.An AWS architecture for traffic distribution, health checks, failed-instance replacement, and Auto Scaling.

awsload-balancing
AWS Load Balancing — Kiến trúc phân phối lưu lượng, health check, thay instance lỗi và Auto Scaling trên AWS.

Bài toánProblem

Một ứng dụng chỉ chạy trên một instance tạo ra điểm lỗi đơn và khó hấp thụ biến động lưu lượng. Bài toán không chỉ là thêm load balancer, mà còn phải quyết định health check, cách scale, trạng thái phiên và quan sát lỗi.An application running on one instance creates a single point of failure and cannot absorb traffic variation well. The challenge is not merely adding a load balancer; it also requires health checks, scaling policy, session strategy, and observability.

Cách tiếp cậnApproach

Thiết kế sử dụng Application Load Balancer trước một nhóm instance trải trên nhiều availability zone. Ứng dụng được định hướng stateless; session và dữ liệu bền vững được đưa ra dịch vụ phù hợp thay vì gắn với từng máy.The design places an Application Load Balancer in front of instances distributed across availability zones. The application is treated as stateless, with sessions and durable data moved to appropriate shared services rather than individual hosts.

Kiến trúcArchitecture

Luồng kiến trúc gồm DNS, listener, target group, Auto Scaling Group, health check và lớp quan sát bằng metric/log. Security group giới hạn đường vào; deployment và drain time được tính để tránh cắt request đang xử lý.The architecture covers DNS, listeners, target groups, an Auto Scaling Group, health checks, and metric or log observability. Security groups restrict entry paths, while deployment and draining behavior prevent active requests from being cut off.

Quy trìnhProcess

Quy trình lab kiểm tra trạng thái healthy/unhealthy, phân phối request, thay instance lỗi, scale-out theo tải giả lập và scale-in an toàn. Mỗi bước ghi lại tín hiệu quan sát và điều kiện khôi phục thay vì chỉ xem trang có mở được hay không.The lab workflow tests healthy and unhealthy states, request distribution, failed-instance replacement, simulated scale-out, and safe scale-in. Each step records observability signals and recovery conditions rather than only checking whether a page loads.

Kết quảResults

Case study hoàn thiện sơ đồ và kế hoạch kiểm thử cho kiến trúc cân bằng tải, bao gồm health check, thay instance lỗi, scale-out theo tải giả lập và scale-in an toàn.The completed case study delivers an architecture diagram and validation plan covering health checks, failed-instance replacement, simulated scale-out, and safe scale-in.

Bài họcLessons learned

Health check là một contract về khả năng phục vụ, không phải ping đơn giản. Scale chỉ đáng tin khi ứng dụng stateless, metric phản ánh đúng nhu cầu và hành vi scale-in đã được thử trước.A health check is a serving-readiness contract, not a simple ping. Scaling is trustworthy only when the application is stateless, metrics reflect demand, and scale-in behavior has been tested.