29 April 2010

Protocol Overhead

ลองโหลด m0nowall มาเล่นดูแล้วลอง ทำตาม maxzerker

http://www.adslthailand.com/forum/viewtopic.php?t=17880

แล้วก็สมบูรณ์ดี แต่พอทำ Traffic shape แล้วลองโหลดไฟล์มาดูปรากฏว่า speed จากที่กำหนดใน pipe ของ traffic shape มันหายไปประมาณ 5% ตลอดเลยไปค้นหาข้อมุลเรื่อง overhead เพิ่มเติม ก็มีเว็บที่อธิบายการคำนวน Overhead ของแต่ละโปรโตคอลไว้ เก็บมาไว้เผือเ็ป็นประโยชน์ครับ

Ethernet
Ethernet frame format:

* 6 byte dest addr
* 6 byte src addr
* [4 byte optional 802.1q VLAN Tag]
* 2 byte length/type
* 46-1500 byte data (payload)
* 4 byte CRC

Ethernet overhead bytes:
12 gap + 8 preamble + 14 header + 4 trailer = 38 bytes/packet w/o 802.1q
12 gap + 8 preamble + 18 header + 4 trailer = 42 bytes/packet with 802.1q

Ethernet Payload data rates are thus:
1500/(38+1500) = 97.5293 % w/o 802.1q tags
1500/(42+1500) = 97.2763 % with 802.1q tags

TCP over Ethernet:
Assuming no header compression (e.g. not PPP)
Add 20 IPv4 header or 40 IPv6 header (no options)
Add 20 TCP header
Add 12 bytes optional TCP timestamps
Max TCP Payload data rates over ethernet are thus:
(1500-40)/(38+1500) = 94.9285 % IPv4, minimal headers
(1500-52)/(38+1500) = 94.1482 % IPv4, TCP timestamps
(1500-52)/(42+1500) = 93.9040 % 802.1q, IPv4, TCP timestamps
(1500-60)/(38+1500) = 93.6281 % IPv6, minimal headers
(1500-72)/(38+1500) = 92.8479 % IPv6, TCP timestamps
(1500-72)/(42+1500) = 92.6070 % 802.1q, IPv6, ICP timestamps

UDP over Ethernet:
Add 20 IPv4 header or 40 IPv6 header (no options)
Add 8 UDP header
Max UDP Payload data rates over ethernet are thus:
(1500-28)/(38+1500) = 95.7087 % IPv4
(1500-28)/(42+1500) = 95.4604 % 802.1q, IPv4
(1500-48)/(38+1500) = 94.4083 % IPv6
(1500-48)/(42+1500) = 94.1634 % 802.1q, IPv6


ฉบับเต็ม ดูได้ที่ http://sd.wareonearth.com/~phil/net/overhead/

0 comments:

Post a Comment