This is why YouTube uses UDP.
UDP is an Internet streaming protocol such as TCP.
So if you want to learn why YouTube uses UDP and all the technical details, then you’re in the right place.
- YouTube Gold Digger Pranks: How Real?
- YouTube Unsubscribing You From Channels: Why?
- YouTube Vanced: Safe to Use?
- Complete History of YouTube
YouTube and UDP
Everybody loves to watch a good video sometimes. It’s become a daily routine.
There are so many videos of animals doing funny stuff, babies being cute, TV show bloopers, just to name a few.
There’s just something about video as a medium that captivates our attention.
Luckily, there are so many streaming platforms we can choose from. One of them is YouTube, arguably the original video streaming platform. But we all have our preferences.
Some of us just want to binge-watch our favorite TV shows, so we have subscriptions for Netflix, Amazon Prime, HBO Go, and many others.
But YouTube has it all. From “how-to” videos to laughing dogs, it’s a streaming platform like no other, and it has about 400 hours of video uploaded every minute. It’s an incredibly influential platform, and it’s not lost any momentum.
It basically has anything and everything on it. That’s what makes it so great.
So, how does YouTube work?
Internet and Streaming Protocols
Data flows through the Internet using different protocols.
Technically, we need the protocols to send and receive data packets. So, the traffic that takes place online and in our networks needs protocols to regulate the data.
These protocols make sure that when you send a photo to your loved ones, they don’t receive a duplicate or a partial photo. It’s like the situation when we try to load a web page and get a broken image icon.
So, when we download things, these protocols have time to work and ensure that the data is complete and there are no duplicates or partial items.
However, when streaming videos using YouTube on our devices, the data is immediately available for consumption. It loads, and we watch it immediately.
The protocols for data packet transmission are TCP (Transmission Control Protocol) and UDP (User Datagram Protocol), and there are specific protocols used for streaming, such as the RTSP (Real Time Streaming Protocol).
The Transmission Control Protocol is one of the first protocols that complements the IP (Internet Protocol). The Internet Protocol makes the Internet work. It’s the foundation of data transport.
However, the TCP is the protocol responsible for smooth data packet transmission. This means that it resolves problems like loss of packets, packets that are out of order, corrupted packets, and duplicates.
Suppose a data packet is lost or duplicated. In that case, TCP requests another transmission of the data that isn’t there or is out of order.
The TCP regulates the transmission, and we get complete data when we go online because of it. It’s a protocol that is part of any operating system today.
The User Datagram Protocol is also one of the most important protocols in the Internet Protocol Suite. It’s a little different from TCP.
The UDP doesn’t send requests to other participants in the network. There’s no need for communication before the transmission. This means that it can send messages, datagrams to other network members.
Datagrams are very basic units of transfer. When a datagram is transferred, there’s no need for any prior communication. It only needs an address for delivery.
However, the delivery isn’t guaranteed, and it won’t be confirmed either. It’s not as reliable as the TCP. That’s why these two work together consecutively or intermittently to accommodate the needs of the users.
To put it plainly, the UDP is a connectionless program. It can send a lot of packets to multiple users simultaneously, as it is much faster than the TCP, but it is also unreliable. It’s very convenient for streaming services.
The Real-Time Streaming Protocol is also a network control protocol that takes care of streaming media servers. RTSP is used to communicate between two endpoints.
Basically, when we’re on a streaming app such as Netflix, YouTube, or Amazon Prime, we look for a TV show or a movie.
When we find the program we want to watch, we click Play. The video plays immediately. When we click on Pause, the video stops playing.
This is how the RTSP works. However, it’s not actually implemented into the mentioned streaming services. Although, we may come across it if we open YouTube as a mobile version of the site on a desktop computer.
So, what makes streaming work?
There are multiple methods of routing communication, and multicast communication is one of them—multicast simply refers to multiple casts to multiple devices.
Unlike unicast communication, where data is transmitted from one computer to another, multicast is group communication. It’s a method of data transmission where data gets sent to multiple destinations at a time.
It’s not like broadcast either. A broadcast transmits data to all the network members at the same time and all the same data.
Multicast only sends data to specific members that request certain data. It’s used in video streaming and IPTV (Internet Protocol Television).
Think about Netflix. You and your friends are watching the same TV show, but you’re in different parts of town.
Netflix will let you and your friends watch the same TV show at the same time in different locations on different devices.
However, other people that don’t have Netflix on, or didn’t even subscribe to Netflix, don’t get to watch the TV show because they didn’t request it. In that case, Netflix doesn’t send any data to those users.
YouTube UDP and TCP
Video-on-demand services such as YouTube need to have these protocols to ensure that the viewers get what they want when they want it. It’s a simple process. We search for a video, click on it, or tap it, and it plays.
We rarely even see the buffering icon these days.
Incredibly, TCP connections are the ones that are most frequently used for streaming videos.
Streaming begins with the initial buffering. After that, it reaches a steady state, where buffering and the video continue doing their thing simultaneously.
Surprisingly, YouTube uses both UDP and TCP connections. The ratio of the uses of these two protocols is 62.5 % UDP sessions and 37.5 % TCP sessions.
So, why does it use UDP more than TCP?
Well, as we said before, UDP doesn’t require communication before it sends data packets. This makes UDP perfect for streaming live videos.
However, the TCP ensures the data is reliable and complete, so it accounts for data loss.
When these two work in combination, they make streaming almost perfect. We’re not speaking about videos that are already uploaded.
We’re speaking about live video streaming as well. This is where UDP definitely has an advantage over TCP.
Live video streaming requires UDP because there’s little communication between the host and the users when watching a live stream. It’s definitely faster loading, but it can come with some jitters.
That’s what happens when using an unreliable protocol. However, both protocols belong to the same thing that makes smooth data packet transmission.
The transport layer contains many protocols and ensures smooth data transmission. It includes both the TCP and UDP protocols, and it’s responsible for data delivery from application processes to hosts.
It forms data segments and works with the source and destination port number to establish communication between different hosts. Hosts are different computers or devices participating in networks.
The port number is the thing that completes the message address of a destination or source network. Basically, it’s the numbers after the colon next to the IP address. They are used to identify the messages forwarded after a request is sent to a server.
When we play a game online, the port numbers let us perform different actions in a reasonable time.
Instead of clicking on the button and waiting for your avatar to move in the game, it immediately responds in real-time.
So, the transport layer provides communication services to app processes running on hosts. It’s a type of logical communication where there’s no need for a physical connection between the hosts.
This layer is implemented in all end systems, meaning in the computers, but it’s not present in the network routers. The transport layer also guarantees the bandwidth.
The most important thing is that the transport layer uses UDP or TCP to communicate with the IP (Internet Protocol) in the internet layer.
So, we need the transport layer because both UDP and TCP are part of it. We need them to establish communication between applications and the Internet.