UDP vs TCP

jmcoreymv

Diamond Member
Oct 9, 1999
4,264
0
0
I have been doing some bandwidth testing between two computers connected directly via a crossover cable. Both computers use 10/100 NICs. For some reason when I do a TCP bandwidth test between them I can get 93-94 MBit/s but when I do a UDP test I only get ~64 Mbit/s. I always thought UDP had a higher throughput capability and less reliability than TCP. (BTW I also lose about 1.7% of the UDP packets). Why is UDP slower?
 

jmcoreymv

Diamond Member
Oct 9, 1999
4,264
0
0
Dell Latitude C800 laptops running WinXP SP1 Pro with integrated 3Com 10/100 NICs. Test software was Iperf 1.7.0.
 

spidey07

No Lifer
Aug 4, 2000
65,469
5
76
you possibly have a cable problem. You shouldn't lose any packets on a LAN. zero.
 
Aug 27, 2002
10,043
2
0
how long is the cable? what kind of cable? what port negotiation? is IP header compression being used? (UDP packets don't use header compression afaik) do you drop any packets when you do a ping -t for any extended period of time? is this when sending or recieving? do you believe everything this syntetic test tells you? why are you testing this in the first place? am I up to the $100 question yet? ;)
 

jmcoreymv

Diamond Member
Oct 9, 1999
4,264
0
0
The cable was a brand new Belkin 10ft crossover CAT5E cable. If I do a ping -t -l 65500 overnight it will drop about a total of 100 packets out of 100000 or .1%.

Im doing these tests because I designed a 5-Port network switch and my company isn't ready to shell out the cash to properly test it yet (from a company like Spirent or Ixia) and until then I need to try and test the switch I designed as best as I can. I was trying to establish a baseline direct connection to compare.

If anyone has any other alternative recommendations I'd be open to that.
 

spidey07

No Lifer
Aug 4, 2000
65,469
5
76
Originally posted by: jmcoreymv
The cable was a brand new Belkin 10ft crossover CAT5E cable. If I do a ping -t -l 65500 overnight it will drop about a total of 100 packets out of 100000 or .1%.

Im doing these tests because I designed a 5-Port network switch and my company isn't ready to shell out the cash to properly test it yet (from a company like Spirent or Ixia) and until then I need to try and test the switch I designed as best as I can. I was trying to establish a baseline direct connection to compare.

If anyone has any other alternative recommendations I'd be open to that.

then you have a cable or driver/nic problem.

you should never, ever lose a single packet on a LAN. 1% packet loss on a LAN is considered bad.

It is not unheard of for a brand new cable to be bad.

That being said, TCP will adjust how much data it sends without an acknoldgement and is a reliable transport. UDP can achieve higher throughput but suffers greatly if there are dropped packets.

So - moral of the story is you shouldn't be getting any packet loss whatsoever on a LAN. You're ping tests show that you do have packet loss, hence TCP will yield higher throughput.
 

jmcoreymv

Diamond Member
Oct 9, 1999
4,264
0
0
I also get a similar amount of packet loss when doing a UDP test through a standard 5 port switch (not mine). In this case I am using completely different cables. Does this indicate it is probably the NIC's?
 

ScottMac

Moderator<br>Networking<br>Elite member
Mar 19, 2001
5,471
2
0
No. The problem is that there is no pacing with UDP and the receive buffer is overflowing / dropping frames.

It's pretty common. We saw this in the Lab all the time using the Smartbits and Chariot.

You *DO* push more data through the wire (throughput), but the amount accurately received up the stack is lower ("Goodput").

FWIW

Scott
 

cmetz

Platinum Member
Nov 13, 2001
2,296
0
0
jmcoreymv, quit. Now. Really. You're designing a switch and your company won't pay for proper QA? That's bad for everyone. Stupid, stupid management. Bad place. Leave.

Okay, that said...

Good NICs account for raw packets seen in hardware. I'd have to double check, but I believe the Intels do this right. So even if your stack is choking under the load, the sending NIC can count that a good frame was transmitted, and the receiving NIC can count that a good frame was received, and you can subtract the two and count your loss in between those points. This might be a better methodology than going user space on sender to user space on receiver, because many system-local hardware and software issues could cause loss too.
 

jmcoreymv

Diamond Member
Oct 9, 1999
4,264
0
0
Originally posted by: cmetz
jmcoreymv, quit. Now. Really. You're designing a switch and your company won't pay for proper QA? That's bad for everyone. Stupid, stupid management. Bad place. Leave.

We will eventually lease the proper equipment as a final test. But the price to buy it outright is just too high for us since once we design a product we keep it on the market for ~10 years. My goal is to do my best to make sure that when we do lease it for a month or so, that it should pass without problems (hopefully).