Home » QoS (Quality of Service): DiffServ, Queuing และ Traffic Shaping
QoS (Quality of Service): DiffServ, Queuing และ Traffic Shaping
QoS (Quality of Service): DiffServ, Queuing และ Traffic Shaping
QoS (Quality of Service) เป็นชุดของ mechanisms ที่ควบคุมการจัดลำดับความสำคัญของ network traffic เพื่อให้ critical applications (voice, video) ได้รับ bandwidth และ latency ที่ต้องการ DiffServ (Differentiated Services) เป็น QoS model ที่ใช้กันมากที่สุด ใช้ DSCP marking สำหรับจำแนก traffic แล้วใช้ queuing algorithms และ traffic shaping สำหรับ enforce policies
เมื่อ network congested ทุก traffic ถูกปฏิบัติเท่ากัน (best-effort) ทำให้ voice call สะดุด, video conference กระตุก แม้ว่า bandwidth จะเหลือพอสำหรับ non-critical traffic QoS แก้ปัญหานี้: classify traffic → mark priority → queue ตามความสำคัญ → shape/police ตาม policy
QoS Models
Model
วิธีทำงาน
Scalability
Best-Effort
ไม่มี QoS — FIFO (First In First Out)
Simple, ไม่ guarantee อะไร
IntServ (Integrated Services)
Per-flow reservation (RSVP) — reserve bandwidth per application
ไม่ scale (state per flow on every router)
DiffServ (Differentiated Services)
Per-hop behavior (PHB) — classify + mark → each hop treats traffic by class
Scales well (no per-flow state)
QoS Operations
Step
Operation
Where
1. Classification
Identify traffic type (ACL, NBAR, DSCP, CoS)
Ingress (access layer)
2. Marking
Set DSCP/CoS value ใน packet header
Ingress (trust boundary)
3. Policing
Rate-limit traffic ที่เกิน committed rate (drop or re-mark excess)
Ingress or egress
4. Queuing
จัด traffic เข้า queues ตาม class → schedule ส่งออก
Egress (during congestion)
5. Shaping
Buffer excess traffic → send at configured rate (smooth bursts)
Egress
6. Congestion Avoidance
Drop lower-priority traffic ก่อนที่ queue จะ full (WRED)
Egress
DSCP (Differentiated Services Code Point)
DSCP Name
DSCP Value
PHB
Use Case
EF (Expedited Forwarding)
46
Low latency, low jitter, low loss
Voice (RTP)
AF41
34
Assured Forwarding class 4
Interactive Video
AF31
26
Assured Forwarding class 3
Streaming Video
CS6
48
Class Selector 6
Network Control (routing protocols)
CS5
40
Class Selector 5
Signaling (SIP, H.323)
AF21
18
Assured Forwarding class 2
Transactional Data (ERP, CRM)
CS1
8
Class Selector 1
Scavenger / Bulk (backup, P2P)
DF (Default)
0
Best-Effort
General internet traffic
Queuing Algorithms
Algorithm
วิธีทำงาน
Use Case
FIFO
First In First Out (no priority)
Default (no QoS)
PQ (Priority Queuing)
Strict priority — high priority queue ส่งก่อนเสมอ
Voice (but can starve other queues)
WFQ (Weighted Fair Queuing)
Fair scheduling ตาม flow weights
General (Cisco default on slow links)
CBWFQ (Class-Based WFQ)
Allocate bandwidth % per class → fair within class
Enterprise QoS (most common)
LLQ (Low Latency Queuing)
PQ + CBWFQ — strict priority for voice + bandwidth guarantee for others
Best practice (voice + data QoS)
LLQ (Recommended)
Queue
Type
Bandwidth
Traffic
Priority Queue
Strict Priority (LLQ)
≤ 33% of link
Voice (EF) — always sent first
Class 1
CBWFQ
Guaranteed %
Interactive Video (AF41)
Class 2
CBWFQ
Guaranteed %
Critical Data (AF21)
Class 3
CBWFQ
Guaranteed %
Bulk Data (AF11)
Default
CBWFQ
Remaining %
Best-effort (DF)
Policing vs Shaping
Feature
Policing
Shaping
Action on excess
Drop or re-mark excess traffic
Buffer excess → send later (delay)
Burst handling
Drop bursts ที่เกิน rate
Absorb bursts → smooth output
Direction
Ingress or egress
Egress only
Latency impact
ไม่เพิ่ม latency (drop ทันที)
เพิ่ม latency (buffer + delay)
Use Case
ISP enforcing customer rate, ingress rate-limit
Match sub-rate circuit (e.g., 100M port shaped to 50M)
Token Bucket
Single or dual token bucket
Token bucket with buffer
WRED (Weighted Random Early Detection)
Feature
รายละเอียด
คืออะไร
Congestion avoidance — randomly drop packets before queue full
วิธีทำงาน
เมื่อ queue depth > minimum threshold → start randomly dropping lower priority
Advantage
ป้องกัน tail drop (ที่ drop ทุก traffic เท่ากัน) + prevent TCP synchronization
DSCP-based
Higher DSCP = lower drop probability, lower DSCP = higher drop probability
ไม่ใช้กับ Voice
อย่าใช้ WRED กับ EF (voice) — voice ต้อง priority queue
QoS Design Best Practices
Practice
รายละเอียด
Mark at trust boundary
Classify + mark ที่ access layer (ใกล้ source ที่สุด)
4-8 classes maximum
อย่ามีมากเกินไป (complex + hard to manage)
Voice = Priority Queue ≤ 33%
Voice ต้อง strict priority แต่ไม่เกิน 1/3 ของ bandwidth
End-to-end QoS
QoS ต้อง configure ทุก hop (access → distribution → core → WAN)
Don’t trust endpoints
Re-mark DSCP ที่ switch ingress (อย่า trust PC markings)
Bandwidth sum ≤ 100%
ผลรวม bandwidth allocation ทุก class ต้อง ≤ 100% ของ interface
Test with traffic generator
ทดสอบ QoS policy ด้วย iperf3, traffic generator ก่อน production
ทิ้งท้าย: QoS = Prioritize What Matters
QoS DiffServ model: classify → mark (DSCP) → queue → shape/police EF (DSCP 46) = voice (strict priority), AF classes = data tiers LLQ = best practice (priority queue for voice + CBWFQ for data) Policing = drop excess (ingress), Shaping = buffer excess (egress) WRED = congestion avoidance (drop low priority before queue full) End-to-end: mark at access layer → enforce every hop → WAN
อ่านเพิ่มเติมเกี่ยวกับ Network Load Balancing และ SD-WAN Architecture ที่ siamlancard.com หรือจาก icafeforex.com และ siam2r.com