Packet Loss over HTTP
Asked Answered
Z

1

5

While interning at a video conferencing company, there was much talk of packet loss. Wikipedia states the following:

Packet loss is typically caused by network congestion.

I understand that because video requires such massive amounts of data to be sent over the wire, packets are bound to be lost.

What I don't understand is why packet loss is not experienced in other cases such as HTTP requests and AJAX calls. If packet loss is truly due to congested networks, why have I never experienced it with my own HTTP requests?

Are HTTP connections invulnerable to packet loss, or are the requests that I am sending too small to be affected. If HTTP is immune to packet loss, why is this the case?

Zouave answered 7/8, 2015 at 6:29 Comment(3)
The TCP/IP layer underlying HTTP and many other protocols detects packet loss, and will retransmit lost packets until they're acknowledged. At the application level, this manifests itself not as missing data, but by increased latency/jitter. So you wouldn't notice it unless you were paying careful attention to timing.Linger
@JimLewis Interesting. Now are there any reasons this is not implemented in more intensive communications like video? I assume that resending packets would be too costly or it would be irrelevant as the frames per second are so fast and dropped packets would hardly be noticeable.Zouave
@BrianTracy: audio/video are typically transmitted using UDP instead of TCP. By its very nature, UDP is lossy. Audio/video can lose packets without severely degrading the overall experience, some amount of loss is typically acceptable. That is not so with TCP protocols, like HTTP, where any data loss is fatal.Roping
U
8

Packet loss for congestion can occur with any protocol based on IP. If there is congestion routers in the middle between two machines can drop IP datagrams as IP is a best-effort protocol.

The difference is that video is usually transmitted over UDP protocol while HTTP is transmitted over TCP protocol. IP is a layer 3 protocol. TCP and UDP are two types of layer 4 protocol.

UDP is not connection oriented nor reliable. This means that if a datagram is dropped in the middle, no end-point node realizes about that (unless there is a highe layer protocol implementing reliability). The datagram is lost.

TCP is a connection oriented and reliable protocol. Explained in a simple way, the node receiving an TCP segment will send acknowledgements for the data received. If a TCP segment is lost in the middle, the receiving node will not send an ACK (acknowledgment) and the sending node will have a timeout after certain time. Upon timeout, the sending node will re-transmit the missing data. This is why the receiving node will either receive the whole HTTP message or, in an extreme case, there is going to be an error in the application telling you that something like "the connection is broken" (this means if there is problem both ends will realize about it).

Unbelief answered 7/8, 2015 at 9:20 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.