
Load Balancing: L4/L7, HAProxy, NGINX, AWS ALB/NLB, GSLB และ Application Delivery
Load Balancing กระจาย traffic ไปยัง backend servers เพื่อ scalability และ high availability L4 Load Balancing ทำงานที่ transport layer (TCP/UDP), L7 ทำงานที่ application layer (HTTP/HTTPS), HAProxy เป็น open-source high-performance load balancer, NGINX เป็น web server + reverse proxy + LB, AWS ALB/NLB เป็น managed cloud load balancers, GSLB กระจาย traffic ข้าม data centers และ Application Delivery รวมทุกอย่างเป็น platform
ทุก web application ที่มี traffic สูง ต้องใช้ load balancer: single server handle ได้จำกัด (เช่น 10,000 concurrent connections), load balancer กระจาย traffic ไปหลาย servers → scale horizontally ถ้า server ตัวหนึ่ง fail → load balancer route ไป servers ที่เหลือ → zero downtime Netflix ใช้ load balancing หลายชั้นเพื่อ serve 250M+ subscribers
L4 vs L7 Load Balancing

| Feature | L4 (Transport) | L7 (Application) |
|---|---|---|
| Layer | TCP/UDP (IP + Port) | HTTP/HTTPS (URL, headers, cookies) |
| Decision Based On | Source/Dest IP, Port | URL path, hostname, headers, cookies, content type |
| Performance | Faster (no payload inspection) | Slower (parse HTTP, SSL termination) |
| SSL Termination | Pass-through (no inspection) | Terminate SSL → inspect → re-encrypt or plaintext to backend |
| Content Routing | ไม่ได้ (ไม่เห็น content) | /api → API servers, /static → CDN, /ws → WebSocket servers |
| Use Case | TCP services (database, SMTP, gaming) | Web applications (HTTP routing, API gateway) |
| Examples | AWS NLB, HAProxy TCP mode, LVS | AWS ALB, HAProxy HTTP mode, NGINX, Envoy |
Load Balancing Algorithms
| Algorithm | How | Best For |
|---|---|---|
| Round Robin | Rotate ทีละ server ตามลำดับ | Equal-capacity servers, stateless apps |
| Weighted Round Robin | Round robin แต่ server แข็งกว่าได้ weight มากกว่า | Mixed-capacity servers |
| Least Connections | ส่งไป server ที่มี active connections น้อยที่สุด | Long-lived connections (WebSocket, database) |
| IP Hash | Hash source IP → always same server (sticky) | Session persistence without cookies |
| Least Response Time | ส่งไป server ที่ response เร็วที่สุด | Heterogeneous backends (different response times) |
| Random | Random selection (with power of two choices) | Large server pools (simple, effective) |
HAProxy
| Feature | รายละเอียด |
|---|---|
| คืออะไร | Open-source, high-performance TCP/HTTP load balancer and proxy |
| Performance | Handle 1M+ concurrent connections, 100K+ requests/sec on single instance |
| Modes | TCP mode (L4) + HTTP mode (L7) — both in single config |
| Health Checks | TCP, HTTP (status code, body), custom scripts — remove unhealthy backends |
| SSL | SSL termination, SSL passthrough, SSL re-encryption |
| ACLs | Rich ACL system for routing: path, headers, cookies, source IP, SNI |
| Stats | Built-in stats page (real-time dashboard) + Prometheus exporter |
| Used By | GitHub, Stack Overflow, Reddit, Airbnb, Instagram |
NGINX

| Feature | รายละเอียด |
|---|---|
| คืออะไร | Web server + reverse proxy + load balancer + HTTP cache |
| Architecture | Event-driven, non-blocking I/O → handle 10,000+ concurrent connections efficiently |
| Load Balancing | Round robin, least connections, IP hash, random (upstream module) |
| L7 Features | URL routing, header manipulation, caching, rate limiting, gzip compression |
| NGINX Plus | Commercial version: active health checks, session persistence, DNS service discovery, dashboard |
| vs HAProxy | NGINX: web server + LB (better for static content, caching) | HAProxy: pure LB (better for complex routing) |
| Market Share | 34%+ of all websites use NGINX (most popular web server) |
AWS Load Balancers
| Type | Layer | Use Case | Features |
|---|---|---|---|
| ALB (Application) | L7 (HTTP/HTTPS) | Web apps, microservices, containers | Path/host routing, WebSocket, gRPC, WAF integration |
| NLB (Network) | L4 (TCP/UDP/TLS) | High performance, static IP, gaming | Millions of RPS, static IP/EIP, ultra-low latency |
| CLB (Classic) | L4 + L7 (legacy) | Legacy EC2-Classic | Deprecated — migrate to ALB/NLB |
| GWLB (Gateway) | L3 (IP) | Inline security appliances | Route traffic through firewalls/IDS transparently |
GSLB (Global Server Load Balancing)
| Feature | รายละเอียด |
|---|---|
| คืออะไร | Distribute traffic across multiple data centers/regions globally |
| DNS-Based | Return different IP based on client location, health, load → DNS resolves to nearest DC |
| Anycast | Same IP advertised from multiple locations → BGP routes to nearest (CDN approach) |
| Policies | Geographic (nearest), weighted (ratio), failover (primary/backup), latency-based |
| Health Checks | Monitor each DC’s health → remove unhealthy DC from DNS/anycast |
| Products | AWS Route 53, Cloudflare, F5 BIG-IP DNS, NS1, Akamai GTM |
ทิ้งท้าย: Load Balancing = Scale, Availability, Performance
Load Balancing L4 vs L7: L4 (TCP/UDP, fast, no content inspection) vs L7 (HTTP, content routing, SSL termination) Algorithms: round robin, weighted, least connections, IP hash, least response time, random HAProxy: pure LB (1M+ connections), rich ACLs, TCP+HTTP modes, used by GitHub/Reddit NGINX: web server + LB + cache, event-driven, 34% market share, NGINX Plus for enterprise AWS: ALB (L7 web), NLB (L4 performance), GWLB (security appliances) GSLB: DNS-based or anycast, geographic/latency routing, multi-DC failover Key: L4 for raw performance, L7 for intelligent routing — most apps need L7 with proper health checks and algorithms
อ่านเพิ่มเติมเกี่ยวกับ Kubernetes Networking CNI Service Mesh Ingress และ Cloud Networking VPC Transit Gateway ที่ siamlancard.com หรือจาก icafeforex.com และ siam2r.com
บทความที่เกี่ยวข้อง
- PCIe 5.0 NVMe Benchmark ทดสอบความเร็วจริง 20260312113456
อ่านเพิ่มเติม: เทรดทองคำ XAU/USD | EA Semi-Auto ฟรี
อ่านเพิ่มเติม: สัญญาณเทรดทอง | Panel SMC MT5
อ่านเพิ่มเติม: TradingView ใช้ฟรี | EA Semi-Auto ฟรี
อ่านเพิ่มเติม: โค้ด EA Forex ฟรี | Smart Money Concept
อ่านเพิ่มเติม: โค้ด EA Forex ฟรี | EA Semi-Auto ฟรี
อ่านเพิ่มเติม: เทรดทองคำ XAU/USD | ดาวน์โหลด EA ฟรี
อ่านเพิ่มเติม: EA Forex ฟรี | EA Semi-Auto ฟรี
อ่านเพิ่มเติม: TradingView ใช้ฟรี | XM Signal EA
อ่านเพิ่มเติม: ราคาทอง Gold Price | EA Semi-Auto ฟรี
อ่านเพิ่มเติม: ราคาทอง Gold Price | XM Signal EA
อ่านเพิ่มเติม: สัญญาณเทรดทอง | Smart Money Concept
เนื้อหาที่เกี่ยวข้อง: บทความ Networking ทั้งหมด
อ่านเพิ่มเติม: โค้ด EA Forex ฟรี | XM Signal EA
อ่านเพิ่มเติม: TradingView ใช้ฟรี | ดาวน์โหลด EA ฟรี
อ่านเพิ่มเติม: เทรดทองคำ XAU/USD | EA Semi-Auto ฟรี
อ่านเพิ่มเติม: เทรด Forex | Panel SMC MT5
FAQ
Load Balancing: L4/L7, HAProxy, NGINX, AWS ALB/NLB, GSLB และ Application Delivery คืออะไร?
Load Balancing: L4/L7, HAProxy, NGINX, AWS ALB/NLB, GSLB และ Application Delivery เป็นหัวข้อสำคัญในวงการเทคโนโลยีที่ช่วยให้การทำงานมีประสิทธิภาพมากขึ้น ไม่ว่าจะเป็นด้าน IT, Network หรือ Server Management
ทำไมต้องเรียนรู้เรื่อง Load Balancing: L4/L7, HAProxy, NGINX, AWS ALB/NLB, GSLB และ Application Delivery?
เพราะ Load Balancing: L4/L7, HAProxy, NGINX, AWS ALB/NLB, GSLB และ Application Delivery เป็นทักษะที่ตลาดต้องการสูง และช่วยให้คุณแก้ปัญหาในงานจริงได้อย่างมืออาชีพ การเรียนรู้ตั้งแต่วันนี้จะเป็นประโยชน์ในระยะยาว
Load Balancing: L4/L7, HAProxy, NGINX, AWS ALB/NLB, GSLB และ Application Delivery เหมาะกับผู้เริ่มต้นไหม?
ได้แน่นอนครับ บทความนี้เขียนให้เข้าใจง่าย เหมาะทั้งผู้เริ่มต้นและผู้มีประสบการณ์ มี step-by-step guide พร้อมตัวอย่างให้ทำตามได้ทันที
Load Balancing: L4/L7, HAProxy, NGINX, AWS ALB/NLB, GSLB และ Application Delivery — ทำไมถึงสำคัญ?
Load Balancing: L4/L7, HAProxy, NGINX, AWS ALB/NLB, GSLB และ Application Delivery เป็นหัวข้อสำคัญในวงการ IT ที่ System Admin, Network Engineer และ DevOps Engineer ควรเข้าใจเป็นอย่างดี การรู้เรื่องนี้จะช่วยให้ทำงานได้มีประสิทธิภาพมากขึ้น แก้ปัญหาได้เร็วขึ้น และเป็นทักษะที่ตลาดแรงงานต้องการสูง
เริ่มต้นเรียนรู้ Load Balancing: L4/L7, HAProxy, NGINX, AWS ALB/NLB, GSLB และ Application Delivery
แนะนำ path การเรียนรู้:
- อ่านเอกสาร official — เริ่มจาก documentation ของเครื่องมือ/เทคโนโลยีนั้นๆ
- ทำ lab จริง — ตั้ง VM หรือ Docker container แล้วลองทำตาม tutorial
- ทำ project จริง — ใช้กับงานจริงหรือ side project เรียนรู้จากปัญหาที่เจอ
- อ่าน best practices — ศึกษาว่าคนอื่นใช้งานจริงยังไง มี pitfall อะไร
- เข้า community — Reddit, Stack Overflow, Thai IT groups เรียนรู้จากคนอื่น
เครื่องมือที่แนะนำสำหรับ Load Balancing: L4/L7, HAProxy, NGINX, AWS ALB/NLB, GSLB และ Application Delivery
| เครื่องมือ | ใช้สำหรับ | ราคา |
|---|---|---|
| VS Code | Code editor หลัก | ฟรี |
| Docker | Container + Lab environment | ฟรี |
| Git/GitHub | Version control | ฟรี |
| VirtualBox/Proxmox | Virtualization สำหรับ lab | ฟรี |
FAQ — Load Balancing: L4/L7, HAProxy, NGINX, AWS ALB/NLB, GSLB และ Application Delivery
Load Balancing: L4/L7, HAProxy, NGINX, AWS ALB/NLB, GSLB และ Application Delivery คืออะไร?
Load Balancing: L4/L7, HAProxy, NGINX, AWS ALB/NLB, GSLB และ Application Delivery เป็นเทคโนโลยี/ความรู้ด้าน IT ที่ช่วยให้การทำงานมีประสิทธิภาพมากขึ้น อ่านรายละเอียดทั้งหมดในบทความนี้
Load Balancing: L4/L7, HAProxy, NGINX, AWS ALB/NLB, GSLB และ Application Delivery เหมาะกับผู้เริ่มต้นไหม?
เหมาะครับ บทความนี้อธิบายตั้งแต่พื้นฐาน มี step-by-step guide พร้อมตัวอย่างให้ทำตาม
เรียนรู้ Load Balancing: L4/L7, HAProxy, NGINX, AWS ALB/NLB, GSLB และ Application Delivery ใช้เวลานานไหม?
พื้นฐานใช้เวลา 1-2 สัปดาห์ ขั้นกลาง 1-3 เดือน ขั้นสูงต้องใช้ประสบการณ์จริง 6 เดือน+
อ่านเพิ่มเติม: SiamLanCard.com | iCafeForex.com | Siam2R.com
Best Practices สำหรับ Load Balancing: L4/L7, HAProxy, NGINX, AWS ALB/NLB, GSLB และ Application Delivery
Load Balancing: L4/L7, HAProxy, NGINX, AWS ALB/NLB, GSLB และ Application Delivery มี best practices ที่ผู้เชี่ยวชาญแนะนำ:
- Documentation — จด document ทุกอย่างที่ทำ เพื่อให้คนอื่น (หรือตัวเอง 6 เดือนหลัง) เข้าใจ
- Version Control — ใช้ Git สำหรับทุก config/code เก็บ history ย้อนกลับได้
- Automation — automate task ที่ทำซ้ำๆ ด้วย script/Ansible/Terraform
- Monitoring — ตั้ง monitoring + alerting ให้รู้ปัญหาก่อน user
- Backup — กฎ 3-2-1 เสมอ 3 copies, 2 media, 1 offsite
ทรัพยากรเรียนรู้เพิ่มเติม
- Official Documentation — แหล่งเรียนรู้ที่ดีที่สุด อ่าน docs ก่อนเสมอ
- YouTube Tutorials — ดู video walkthrough เข้าใจเร็วกว่าอ่าน
- GitHub Examples — ดู code ของคนอื่น เรียนรู้จาก real projects
- Lab Practice — ตั้ง VM/Docker ฝึกจริง ไม่มีอะไรดีกว่าลงมือทำ
อ่านเพิ่มเติม: iCafeForex | XM Signal EA ฟรี | SiamLanCard | Siam2R
Best Practices สำหรับ Load Balancing: L4/L7, HAProxy, NGINX, AWS ALB/NLB, GSLB และ Application Delivery
Load Balancing: L4/L7, HAProxy, NGINX, AWS ALB/NLB, GSLB และ Application Delivery มี best practices ที่ผู้เชี่ยวชาญแนะนำ:
- Documentation — จด document ทุกอย่างที่ทำ เพื่อให้คนอื่น (หรือตัวเอง 6 เดือนหลัง) เข้าใจ
- Version Control — ใช้ Git สำหรับทุก config/code เก็บ history ย้อนกลับได้
- Automation — automate task ที่ทำซ้ำๆ ด้วย script/Ansible/Terraform
- Monitoring — ตั้ง monitoring + alerting ให้รู้ปัญหาก่อน user
- Backup — กฎ 3-2-1 เสมอ 3 copies, 2 media, 1 offsite
ทรัพยากรเรียนรู้เพิ่มเติม
- Official Documentation — แหล่งเรียนรู้ที่ดีที่สุด อ่าน docs ก่อนเสมอ
- YouTube Tutorials — ดู video walkthrough เข้าใจเร็วกว่าอ่าน
- GitHub Examples — ดู code ของคนอื่น เรียนรู้จาก real projects
- Lab Practice — ตั้ง VM/Docker ฝึกจริง ไม่มีอะไรดีกว่าลงมือทำ
อ่านเพิ่มเติม: iCafeForex | XM Signal EA ฟรี | SiamLanCard | Siam2R
ลิงก์พันธมิตร XM Global — การเทรดมีความเสี่ยง ผลในอดีตไม่รับประกันผลในอนาคต
