Advertisement

UDP Speed

Started by July 05, 2002 09:07 AM
2 comments, last by Dominik_78 22 years, 7 months ago
Hi, on a LAN i''ve created a test (was java not cpp) that transfered Packetes via UDP over to an other PC. I found out that 1500 bytes are the best choise for packetsize. Why? I got about all the 100 MBit Network was able to transfer. I was very suprised to see bigger (and smaller packets) where slower than this size. Why is it slower to transfer at 64 byte ? I got about 120 kb/s at that packetsize. at 1500 byte i got about 9 MB/s and with bigger packets the speed droped again... (this can be due to the switch that cut the bigger packets into smaller... right??) The values I mentioned are the arriving data not the send data. I just care about how much arrives not has been send...) thank you Dominik
The smaller the packet, the bigger percent of bandwidth is used for the packet header, hence you want as a big a packet as possible to minimize the overhead. However when you make bigger packets you''ll run into packet collisions, which with bigger packets can be costly (you have to retransmit the whole thing). Hence there is a balance in packet size that varies depending on the bandwidth and quality of your connection (this is how most internet speedup programs work, by tweaking your packet size and a few other parameters).
Advertisement
The IP layer may fragment a datagram if it''s too large for the physical layer. The size when it''s fragmented is dependent on how large frames that can be transmitted over the physical layer, probably Ethernet in your case. Ethernet is limited to 1500 byte data including higher layer headers and excluding Ethernet header. This fragmentation takes time, and can cause performance hits, so make sure you stay below this limit.

If you want to make sure no fragmentation will occur, do not send more than 512 bytes per datagram. Any software/hardware used in communicating over IP is required to handle datagrams of at least 500 + something bytes (can''t remember exact number) including headers, which should be 512 bytes of user data when headers for higher layer protocols are removed.
I believe the maximum packet size that guarantees that no IP-level fragmentation will occur is 576 bytes including headers. However, the package may still be fragmented if it is tunneled over a ATM link, but I would not worry too much about that.

This topic is closed to new replies.

Advertisement