What are the chances of losing a UDP packet?
Asked Answered
A

3

29

Okay, so I am programming for my networking course and I have to implement a project in Java using UDP. We are implementing an HTTP server and client along with a 'gremlin' function that corrupts packets with a specified probability. The HTTP server has to break a large file up into multiple segments at the application layer to be sent to the client over UDP. The client must reassemble the received segments at the application layer. What I am wondering however is, if UDP is by definition unreliable, why am I having to simulate unreliability here?

My first thought is that perhaps it's simply because my instructor is figuring in our case, both the client and the server will be run on the same machine and that the file will be transferred from one process to another 100% reliably even over UDP since it is between two processes on the same computer.

This led me first to question whether or not UDP could ever actually lose a packet, corrupt a packet, or deliver a packet out of order if the server and client were guaranteed to be two processes on the same physical machine, guaranteed to be routed strictly over localhost only such that it won't ever go out over the network.

I would also like to know, in general, for a given packet what is the rough probability that UDP will drop / corrupt / or deliver a packet out of order while being used to facilitate communication over the open internet between two hosts that are fairly geographically distant from one another (say something comparable to the route between the average broadband user in the US to one of Google's CDNs)? I'm mostly just trying to get a general idea of the conditions experienced when communicated over UDP, does it drop / corrupt / misorder something on the order of 25% of packets, or is it more like something on the order of 0.001% of packets?

Much appreciation to anyone who can shed some light on any of these questions for me.

Antirachitic answered 25/2, 2013 at 4:35 Comment(3)
Guess you never had a bad internet connection ;p UDP is mostly used in scenario's where it is impossible for the receiver to respond. Example data transmission over satellite, radio waves, etc.Slight
Rather than "where it is impossible for the receiver to respond" I'd say it's used in scenarios where losing a packet doesn't really matter (much), like audio/video streaming, video conferencing etc.Chifforobe
Speaking from experience here, I have a project in which two programs communicate via UDP and from time to time a packet loss happens, I can't imagine why, they run on the same computer and communicate via the loopback interface. So yeah, it's a good thing you had to implement your gremlin function because even though the reliability is high (I don't have any stats, but I'm thinking above 99.9% or even higher on the loopback), packet loss still happens.Trampoline
O
12

if UDP is by definition unreliable, why am I having to simulate unreliability here?

It is very useful to have a controlled mechanism to simulate worst case scenarios and how both your client and server can respond to them. The instructor will likely want you to demonstrate how robust the system can be.

You are also talking about payload validity here and not just packet loss.

This led me to question whether or not UDP, lose a packet, corrupt a packet, or deliver it out of order if the server and client were two processes on the same machine and it wasn't having to go out over the actual network.

It is obviously less likely over the loopback adapter, but this is not impossible.

I found a few forum posts on the topic here and here.

I am also wondering what the chances of actually losing a packet, having it corrupted, or having them delivered out of order in reality would usually be over the internet between two geographically distant hosts.

This question would probably need to be narrowed down a bit. There are several factors both application level (packet size and frequency) as well as limitations/traffic of routers and switches along the path.

I couldn't find any hard numbers on this but it seems to be fairly low... like sub 5%.

You may be interested in The Internet Traffic Report and possibly pages such as this.

Once answered 25/2, 2013 at 6:13 Comment(0)
M
15

Packet loss happens for multiple reasons. Primarily it is caused by errors on individual links and network congestion.

Packet loss due to errors on the link is very low, when links are working properly. Less than 0.01% is not unusual.

Packet loss due to congestion obviously depends on how busy the link is. If there is spare capacity along the entire path, this number will be 0%. But as the network gets busy, this number will increase. When flow control is done properly, this number will not get very high. A couple of lost packets is usually enough that somebody will reduce their transmission speed enough to stop packets getting lost due to congestion.

If packet loss ever reaches 1% something is wrong. That something could be a bug in how your congestion control algorithm responds to packet loss. If it keeps sending packets at the same rate, when the network is congested and losing packets, the packet loss can be pushed much higher, 99% packet loss is possible if software is misbehaving. But this depends on the types of links involved. Gigabit Ethernet uses backpressure to control the flow, so if the path from source to destination is a single Gigabit Ethernet segment, the sending application may simply be slowed down and never see actual packet loss.

For testing behaviour of software in case of packet loss, I would suggest two different simulations.

  1. On each packet drop it with a probability of 10% and transmit it with a probability of 90%
  2. Transmit up to 100 packets per second or up to 100KB per second, and drop the rest if the application would send more.
Malaysia answered 25/5, 2013 at 11:9 Comment(1)
A source for the numbers here would be useful.Romanticist
O
12

if UDP is by definition unreliable, why am I having to simulate unreliability here?

It is very useful to have a controlled mechanism to simulate worst case scenarios and how both your client and server can respond to them. The instructor will likely want you to demonstrate how robust the system can be.

You are also talking about payload validity here and not just packet loss.

This led me to question whether or not UDP, lose a packet, corrupt a packet, or deliver it out of order if the server and client were two processes on the same machine and it wasn't having to go out over the actual network.

It is obviously less likely over the loopback adapter, but this is not impossible.

I found a few forum posts on the topic here and here.

I am also wondering what the chances of actually losing a packet, having it corrupted, or having them delivered out of order in reality would usually be over the internet between two geographically distant hosts.

This question would probably need to be narrowed down a bit. There are several factors both application level (packet size and frequency) as well as limitations/traffic of routers and switches along the path.

I couldn't find any hard numbers on this but it seems to be fairly low... like sub 5%.

You may be interested in The Internet Traffic Report and possibly pages such as this.

Once answered 25/2, 2013 at 6:13 Comment(0)
T
4

I was spamming udp packets over wifi to some nanoleaf panels and my packet loss was roughly 1/7000.

I think it depends on a ton of factors.

Transponder answered 28/6, 2021 at 7:59 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.