Photo by ThisIsEngineering from Pexels: https://www.pexels.com/photo/code-projected-over-woman-3861969/

What happens when you open a TikTok?

by Omar Kamali / March 09, 2023 / in Digital Infrastructure, Series, TikTok

This article is part of my series on Digital Infrastructure.

Do you ever stop and think about the countless invisible components working behind the scenes to bring an app like TikTok to life on your phone and allow you to watch addictive videos?

In this article, we will take a closer look at the fascinating world of digital infrastructure by examining what happens when you open an app like TikTok. We'll dive into the different components that work together seamlessly to make the app function, and provide a glimpse into the complexities of the digital world.

We will explore everything from the physical servers that store TikTok's data to the content delivery networks that ensure videos load quickly and smoothly. Along the way, we'll touch on topics like cloud computing, data management, and more. By the end of this article, you'll have a better understanding of the fascinating world of digital infrastructure and how it makes the online experiences we take for granted possible.

The Journey of a TikTok

TikTok has very addictive content. Have you ever found yourself opening TikTok without thinking, only to look up an hour later and realize you've been scrolling through your "For You" page for far too long? What makes TikTok work so seamlessly from a technical perspective? Let's take a closer look. Don’t get intimidated by the technical terms, we’ll go through each.

Cloud servers are not literally up in the sky
Cloud servers are not literally up in the sky

There are several components involved in the journey of a TikTok to your phone. First, there's your device, whether it be a phone or tablet, which serves as the gateway to the internet. We can’t connect to the internet directly through our brains yet (thankfully?). Then there's your internet connection, whether it be through WiFi or cellular data, which allows you to actually connect to the internet. The next components at play are the servers and content delivery network (CDN), which work together to deliver the TikTok to your device.

When you open TikTok, your phone sends a request over the internet to TikTok's servers, which are located in data centers around the world. But what is an internet request and how does the app know which servers to send it to?

An internet request is very similar to a letter, or an email, except that it’s made from a computer and sent to another computer. Essentially, it’s a form of machine-to-machine communication. Usually, a request is a piece of text describing what is being requested, and an address identifying who to send that piece of text to. 

Different types of requests are used to retrieve different kinds of information. When you open an app like TikTok on your phone, it needs to know which server to communicate with. To find out, your phone first sends an internet request of a certain type called DNS (Domain Name Service). This request goes to a DNS server, which acts like a phone book and provides the address of the TikTok server. But what kind of address is that, how does the DNS server work, and how does your request get to it? We'll dive into those topics in a future article about DNS. Keep reading and make sure to subscribe to my newsletter to stay in the loop.

A simplified view of what happens in a DNS request. The DNS service is usually provided by other companies and does not belong to TikTok.
A simplified view of what happens in a DNS request. The DNS service is usually provided by other companies and does not belong to TikTok.

With the server’s address in hand, after DNS comes the HTTP request. The phone communicates with TikTok’s servers, asking them to send over the video you requested. The servers then process the request and retrieve the necessary data to display the TikTok on your screen. This data includes the video file itself, as well as information about the creator, caption, and any other content associated with the video.

But the journey isn't over yet. Once the servers have retrieved the data, it needs to be delivered to your device. This is where the content delivery network comes in. The content delivery network is a system of servers that are strategically located around the world to ensure fast and efficient delivery of content to users. When you open TikTok, the content delivery network determines which server is closest to you and delivers the data to that server if it’s not there already, which then delivers the data to your device.

With the address in hand (90.54.2.150 in this example), your phone can finally request and download the TikTok you wanted to watch
With the address in hand (90.54.2.150 in this example), your phone can finally request and download the TikTok you wanted to watch

Overall, the journey of a TikTok from the servers to your device involves several different components working together seamlessly to provide you with the content you crave, seamlessly and reliably.

The Device

Have you ever noticed that your phone seems to slow down or run out of space when you've been scrolling through TikTok for too long? That's because the device you're using plays a crucial role in the journey of a TikTok.

When you click the TikTok app icon on your device, your phone processes the request and sends a signal to your internet connection to start loading the app. The processing power of your device is critical to ensure that the app runs smoothly, and that the videos load quickly.

But did you know that the quality of the video and the lifespan of your device's battery are also impacted by the presence of special chips in your phone? For example, some devices have video decoders that can help improve the quality of the video and reduce battery consumption.

Another aspect to consider is phone storage space. As you scroll through TikTok, your device caches some of the videos you watch to make them load faster the next time you open them. This caching can take up a lot of space on your device and is normally cleaned up automatically, but sometimes you might occasionally have to empty your phone's cache to free up storage space.

Oof
Oof

So the next time you open TikTok, remember that your device is a critical component in the journey of a TikTok. Without it, you wouldn't be able to enjoy those viral dance videos or laugh at the latest memes.

The Internet Connection

When you click on the TikTok app icon, your device sends a request to the internet to access the app. This request travels through your internet connection, which is typically provided by your internet service provider (ISP).

A fast and stable internet connection is essential for a smooth TikTok experience. Slow internet speeds can cause the app to buffer or freeze, while a weak connection can result in low-quality videos that pixelate and lag. So, if you're having trouble with your TikToks, it might be time to check your internet speed or consider upgrading your internet plan.

Artist depiction of internet cables
Artist depiction of internet cables
Actual internet submarine cables crossing oceans and countries (Photo by ISPI https://ispionline.it)
Actual internet submarine cables crossing oceans and countries (Photo by ISPI https://ispionline.it)

But it's not just the internet connection speed that affects your TikTok experience. The quality and stability of the connection also matter. For example, if you're using a public Wi-Fi network with a lot of users, the connection might be unstable, leading to a frustrating TikTok experience. Similarly, if you're using a cellular data connection in a crowded area with poor signal, you might experience slow loading times or low-quality videos.

The Servers

One of the most important components in the journey of a TikTok is the server.

A server is essentially a computer program that receives requests from a device, processes them, and sends back the appropriate response. When you open TikTok, your device sends a request to the server to retrieve the app's content and information. The server then processes this request and sends back the response, which includes the TikTok content that you see on your screen.

Artist depiction of servers in the cloud
Artist depiction of servers in the cloud
Actual servers in a datacenter, providing what’s called the cloud service (Photo by Brett Sayles from Pexels)
Actual servers in a datacenter, providing what’s called the cloud service (Photo by Brett Sayles from Pexels)
This is what a single server looks like. A very large and noisy computer (Photo By Dmitry Nosachev - Own work, CC BY-SA 4.0)
This is what a single server looks like. A very large and noisy computer (Photo By Dmitry Nosachev - Own work, CC BY-SA 4.0)

The importance of reliable and efficient servers cannot be overstated. In fact, a slow or unreliable server can cause frustrating delays and interruptions in the delivery of content. It's not uncommon for a server to receive hundreds or even thousands of requests at once, especially for popular apps like TikTok. To handle this demand, servers need to be powerful and capable of quickly processing large amounts of data. Additionally, servers need to be maintained and monitored to ensure that they are running smoothly and efficiently. 

Now you might have noticed me talking about servers in plural. Servers work usually in groups and support each other’s work to ensure a highly available service even when one or more servers encounter technical difficulties. How does this work in practice? We will cover it in our future Cloud Computing article.

In short, servers are the backbone of many online services and their reliability is critical for delivering a seamless user experience.

The CDN

Have you ever wondered how a video you want to watch can be delivered to your device within seconds? That's where content delivery networks (CDNs) come in.

CDNs are a network of servers connected together with a very fast network connection and located all over the world. They are also cloud servers, with a very precise task: they work together to deliver content quickly and efficiently. When you open TikTok, the request is sent to the closest server in the CDN, which then delivers the content to your device. This helps to reduce latency and ensures that the video loads quickly.

A depiction of a CDN server network, spread out around the globe to be close to users
A depiction of a CDN server network, spread out around the globe to be close to users

In addition to delivering content quickly, CDNs also keep a copy of popular content on servers located closer to the user. This means that the content is already stored on the server, so it doesn't have to travel as far to reach the user, further reducing latency and improving delivery speed. How do CDNs predict which content is worth keeping a copy of? Learn more in the upcoming article about CDNs.

CDNs play a critical role in the delivery of content, particularly for global apps like TikTok that have users all over the world. Without a CDN, users may experience slower load times and buffering, which can make for a frustrating user experience and prevent an app like TikTok from becoming globally popular in the first place.

Conclusion

In conclusion, opening an app like TikTok on your phone involves a complex journey through various components of digital infrastructure. The device is the first piece of the puzzle, processing the request to open the app and interacting with the internet connection. The internet connection is essential for communicating with the servers that process the request and deliver the content to the user. Reliable and efficient servers are crucial for delivering content quickly and smoothly, and a content delivery network plays a key role in caching content to improve delivery speed and reduce latency.

Understanding digital infrastructure is becoming increasingly important as we rely more on digital technologies in our daily lives. As we continue to explore this topic, we'll delve deeper into the technical aspects of each component, and how they work together to deliver the digital experiences we take for granted.

So the next time you open an app like TikTok, take a moment to appreciate the complex journey that your device and the internet connection must undertake to deliver the content to you. And be sure to stay tuned for more articles in this series, where we'll continue to explore the fascinating world of digital infrastructure.

-

All illustrations in this article are authored and copyrighted by Omar Kamali, except where mentioned explicitly.

Get my latest articles and updates
At most one email a month and no spam.

Omar Kamali
Written by Omar Kamali, Founder, CEO @ Monitoro, & Strategic Technology Advisor.