HACKER Q&A
📣 gardenhedge

Techwise, how did TikTok get so good?


You may like or dislike Tiktok based on it's content and style of delivering that content but I think everyone has to admit that technically it is quite the achievement.

It's video based and delivers video really well. It rarely buffers or fails to load. Compare that to the Reddit video player or the Twitter video player or Vimeo. It's much better. Netflix loads poorly initially for me quite a bit (granted it's trying to load much higher quality).

How did they manage to get the engineering talent when seemingly FB, MS, Netflix, Amazon, Google are all fighting for that talent?


  👤 guptaneil Accepted Answer ✓
I don’t have any unique insights into TikTok nor do I use the app, but TikTok has several product advantages over those other platforms:

1. They only have a queue of videos. That means there is one video playing and they know exactly what the next N videos are going to be, so they can start buffering them early

2. The video plays are high intent. If you launch TikTok, you are 100% going to watch videos. This is not true for Reddit or Twitter, making it harder for them to preemptively buffer content or over-optimize their architecture just for video playback.

3. As you noted, the videos are lower quality and shorter than YouTube or Netflix videos. They also are exclusively optimized for mobile, so don’t need to worry about streaming videos larger than a phone screen.

4. Most videos in your feed might be a similar style. This one is a stretch but I wouldn’t be shocked if TikTok uses some ML to extrapolate highly compressed videos early in the buffer.

5. Depending on who you believe, ByteDance might have financial backing and motivations that make it easier to throw more money at this problem than its American competitors.


👤 zeehio
Last week I was travelling on a different country. I was mostly without WiFi and I bought a prepaid SIM card with some GB. TikTok ate 2GB of "background data" in two days, even if I did not open the app.

So it's not hard for me to guess how they do it...

(Yes, background data is now disabled for TikTok on my phone... I learned my lesson)


👤 nostromo
> Compare that to the Reddit video player

This is worthy of it's own question. Why is Reddit's player so uniquely bad? It's worse than any other video player on the entire internet.


👤 zippy2
I've noticed that TikTok will show you unfamiliar content about every 10 or so videos. I suspect this is to explore it's knowledge graph of categories you might be interested in, and also keeping things fresh. I've found this mechanism fantastic, as it's shown me videos of places around my hometown that I've gone out to visit that I would have no idea even existed in the first place. This on top of a more traditional learning algorithm makes it very addictive.

If you compare this to YouTube, you can tell they've resorted their algorithm back to a more curated list of recommended videos. This blocks new content creators out and keeps the recommended list stale. You can also tell they've weighted videos with the highest ad revenue, so you're more likely to get frustrating long ads with vapid click bait style content. It's no wonder why YouTube lost the top spot of video sites, as they've put advertising ahead of content creators and viewers.

I've bought several products from TikTok ads. I usually never buy things based on online ads. Because their ads are skippable, and have to demonstrate their use instantly, they're very effective. Again, compared to YouTube, their ads tend to focus on long droning corporate agendas and visions. These don't make me want to use the platform.


👤 brutus1213
Here you go: https://arxiv.org/abs/2204.12954 .. not from TikTok but some researchers who reverse engineered some network aspects. Thought the paper is well worth the read.

Systems research people are not valued enough .. my understanding is a bunch (not sure about number) of ex-MSR folks went to ByteDance .. sizable pay bumps.


👤 insane_dreamer
Most people don't realize that mobile app penetration in China happened earlier and to a much greater degree than in US/Europe, because many people skipped the PC stage and went straight to mobile. Apps like Weibo, Weixin (WeChat) and Zhifubao (Alipay), were used by a very large percentage of the population. It was very rare to meet someone anywhere in China who didn't have Weixin on their phone (and I left in 2017 so probably even more now). Tech was very mobile-first. All that to say, Chinese companies like Tencent had tons of experience creating very full-featured and well-designed mobile apps that could handle a LOT of traffic given the sheer numbers in China. So while I don't particularly like or use TikTok, it doesn't at all surprise me that it is so slick. People assume ByteDance was a new company but its Toutiao news aggregation app was extremely popular in China before it bought/merged Douyin + Musicaly to create TikTok.

👤 hot_gril
People have answered about the inherent easiness of preloading videos. It's still a challenge. Users skip videos very frequently, right? And when you first open the app, it already has a video playing. Twitter's video player seems worse than it should be. Netflix has a harder job due to the quality, so I give them a pass.

IIRC TikTok for a long time wasn't even using TLS encryption for client-server traffic, which is rare. Whoever is cutting corners like that is very focused on just making the thing work and fixing the issues later, which has its pros and cons. In a US big tech company, experienced devs would throw a fit over things like this and slow down the project to catch those details. I work with people like that. I'm guessing (as not a TikTok employee) that TikTok is more top-down, plus video is its main focus. Maybe they're preloading aggressively, user's battery and data plan be darned.


👤 dan-robertson
To write something obvious: companies generally don’t succeed or fail based on their technology. A good user experience is necessary for TikTok to do well but it doesn’t matter whether they achieve because of ‘good’ tech, whatever that is, or in spite of it.

I think there were a few things for the business where tech was important:

- being good at serving/storing videos

- the recommendation engine. There are two parts, one is taking user preferences as a strong signal (not a tech decision) and another is recommendation algorithms which produce this effect (I think they’re rote a paper that suggested things about how this worked)

- being an app people wanted to use (weakly tech but mostly not)

I think a some of the explosive growth came from the app having been iterated on a bunch in China first so it seemed more polished when it reached the west. But I could be pretty wrong there.

To answer the question about engineering talent:

- Chinese people will go to the US, get great educations at US universities, some get denied work visas or otherwise choose to return to China. TikTok can employ them in a less competitive labour market and not fight companies like Google which don’t operate in China.


👤 chevman
What sold me on Tik Tok (I'm a early 40 year old guy!) was realizing how their algo allowed you to drill in to a musical emotional trip like no other platform that I've seen to date.

You find a video, with a song, that you vibe with. Now, click on the bottom right sound graphic and you can watch ALL the videos produced with that sound and vibe.

It is part of the core product!

So good it's hard to describe :)


👤 karmasimida
I think technologies wise TikTok is similar to that of Youtube Shorts

Both seems to preload about 10 secs of next 4-5 videos.

I think here is the trick: if your recommendation gets sufficiently good, then user won't eagerly scrolling next just to get content they would actually watch, which makes serving less of noticeable problem. There is a feedback loop here.

On TikTok I rarely gets content that would skip at first sight, which speaks to strength of its algorithm.

Don't know about Reddit/Twitter, but Netflix's video is a whole different business overall, all the DRAM and stuff.


👤 micro_cam
TikTok’s parent co, bytedance, has multiple social video products in China. They have been genuinely investing in being good at serving and recommending video for a while.

If you search arxiv.org for bytedance you can see some of the work they have published. I’m sure there is lots more they haven’t.

I suspect a lot of learnings from other products went into the product design of tik tok as well in terms of how to balance exploiting a users knon interests with showing them novel stuff, how to give anything the chance to go viral etc.


👤 NoPicklez
It's hyper focused on the feed that is just videos' that it determines for you. Therefore it is able to prepare and buffer multiple videos ahead.

I also think that for the public feed, people so see similar videos based on demographic etc so there is a form of caching that is likely applied.

Videos are all small clips as well and they're being loaded from TikToks content servers. With reddit and twitter you are often watching a video linked from another website.

I agree, Reddits video player is garbage.


👤 dbbk
"It rarely buffers or fails to load" this is because the next 6 or so videos are known and buffered ahead of time. This isn't really the case on other sites.

👤 comte7092
I’m just going to answer this last part:

> How did they manage to get the engineering talent when seemingly FB, MS, Netflix, Amazon, Google are all fighting for that talent?

China is both a huge labor market along with the largest mobile phone market in the world. Add to that fact that the great firewall has created a parallel internet, it’s been fairly inevitable that China will end up with some tech giants. Even with all the money that American tech giants have, they are at a disadvantage when it comes to tapping the massive labor market and consumer market within China.

Note that the same thing is happening with EVs. In ten years, the auto market will have several dominant Chinese automakers a la what happened with Germany and Japan in the 70s and 80s.


👤 swang720
They have a gigantic pool of talented engineers to hire from in China.

👤 sgwizdak
This paper by various folks at Bytedance hints at their recommender architecture: https://arxiv.org/pdf/2209.07663.pdf

👤 birdymcbird
new companies have structural advantages.

amazon for example is services architecture. many frameworks and solutions built once for shopping/seller use case. now you want to join Y space? incentive to reuse tooling and framework that already exist. get to market quickly. sound like big advantage but the tools were built for problem X. with problem Y, we have hacks on top of hacks to fit square into circle.

“you want to build mobile apps? okay. we only know how to do services really.” so even how you build code or how to branch and release strategy missing or expertise is only in some specific business division who did everything so custom when they invent it first time that it not really work for you.

so if you observe you company like amazon try do 100 different things at once. sound good and impressive and stock grow. but 98 thing executed very poorly and not close to best in class experience.

this my exact experience at two different company.

once you get over these problem, then u focus on optimization. N second videos? Okay.. let’s preload them..let use lower resolution..let’s have warm cache of recommendations if you like this vide, meaning you watch it for greater than S second..let invest in custom recommendation pipeline with online and offline training to expand dataset of video recommendation so u eyes stay on a video longer while we preload next one.

because we smaller nimble build what we need now without politic of tech alignment across orgs and ownership territory battle going up to separate director or VPs.

this me experience and me sure there are other things too.


👤 nate_martin
Compared to Netflix and even YouTube, TikTok has an extremely tight dopamine feedback loop. Any buffering of a video after a scroll event could result in the user's attention being lost and the session ending. My guess is that they've spent a lot of time optimizing video load because of how correlated with their revenue it is. For Netflix doing this optimization might not be worth the increased infrastructure cost.

👤 timmit
No one mentioned the UX design of Tiktok?

From what I can recall, TikTok was the first one to let you to swipe to watch/switch videos, so users can easily be stuck on it, no matter the short video's quality is good or bad, interesting or boring. Since one single swipe, you changed to another, the cost is very low for user even the video quality is not good.


👤 muzani
I think it's eastern tech culture. East tends to assume everyone is interchangeable and not as intelligent, and tries to bring people up via education. Whereas West tends to just hire talent and let them figure it out.

Not everyone here speaks a common language, and if it is, it's almost certainly English. So documentation and communication is greatly simplified, smaller words, and a lot of conversing through code.

Let's compare two mature technologies between east and west, Google Maps vs Huawei Map SDK:

Google map quickstart: https://developers.google.com/maps/documentation/android-sdk...

Huawei map: https://developer.huawei.com/consumer/en/doc/development/HMS...

There's subtle differences here, but Google tends to use a lot more English words, and Huawei talks mostly in code.

System analysts are common, who act as living documentation. Basically people who you can always interrupt to ask questions. PM isn't sure if a feature is possible? Ask the analyst. Dev doesn't know the right endpoint or understand how something works? The analyst takes time to explain it to them. They generally don't hold the responsibility of development and during periods of low utilisation, they learn the architecture or do R&D.

In MMOs, they would be the tank, while the devs focus on being DPS.

So personally, I think the key is that they rely less on the skill of the individual, and focus heavily on teamwork. Also this is probably an analysis of Huawei more than ByteDance/TikTok, but I assume the culture is more similar.


👤 noodleman
Reddit is not a great comparison. It looks like the video elements of reddit were cobbled together quickly and just left in place since it sort of worked. It won't annoy too many users when most content doesn't use reddit's video player.

If TikTok did this, 100% of it's users would be affected.


👤 dandongus
I think most people here are vastly, vastly overestimating the size of the videos with all this talk about buffering in the comments.

The average video on tiktok, at least for the webapp version, appears to be around 1 megabit (0.125 megabytes) per second when the h264 option is used, and only half of that rate when using ByteDance's 'own' (essentially hevc) format.

I would reckon nearly all internet users, even many mobile ones, have more than enough bandwidth (and low enough latency and loss) to stream many of these tiktok videos in real time simultaneously, let alone a single one at a time.

Tiktok's backend infrastructure may be impressive, but the same could be said for the other companies you listed such as Google.


👤 jasmer
I don't think feeding those videos is a terribly hard engineering challenge for Engineers who are organized and are backed with the right financing. And who for one reason or another seem to be motivated to work almost 7 days a week.

Reddit is crap because of organizational history, and it's no a huge revenue-rich company, in a market with very high salaries.

TikTok has a a few magic ingredients, but 'dancing girls' as a starting point is one of them, the other is the learning algorithm. BTW I do not think that algorithm is magic - just good.

If you see how some Chinese companies have so many focused people and adapt so reactively to things, and they're backed by ample money.


👤 EMIRELADERO
Disclaimer: speculation

TikTok is a Chinese company. The source code is mostly written in China. I'd say that TikTok is the Chinese equivalent of a FAANG company.

They get the talent because the fight is happening in the FAANG space, they are not there.


👤 jalino23
I'm curious about this as well. Specially how their videos barely buffer and almost instant. you could say that they can preload them cause for you is mostly VOD, but they have live as well and it may not be as instant. its still feels pretty instant no matter how fast you scroll. I don't know how to inspect their app but their website version is using video/x-flv progressive download for playback. which surprised cause

1. I thought flash was deprecated by the browser and

2. I thought the industry has moved onto HLS/Dash or stream via websockets for live streaming.


👤 ggwp99
In buffering, the first 20 (N) posts are pre-determined and can therefor be buffered when still on the first video. What I find amazing is their extremely accurate recommendation page that keeps you hooked to the application. Honestly I needed to delete it after the first week since I spent so much time on it.

👤 prvc
How big is a typical TikTok video compared to a Vimeo one? And if "buffering" is your problem, perhaps it's caused by something other than the company serving the video.

👤 reportgunner
It's simple, they don't use their smartest developers to work on intrusive ways to bother the user with ads. They work on serving content to users instead.

👤 fxtentacle
Quite simply, TikTok is using (and paying for) A LOT of traffic. That allows them to cache the first X seconds of the next Y videos. If you choose the values correctly, it takes you longer to swipe up Y times than it takes them to cache the Y+1 th video, on average.

I'm sure if Reddit had government-level funding to burn, they'd also find some ways to improve their video player.


👤 yafbum
I think it preloads a shitload of stuff ahead, before you deciding to watch it. Predictive caching.

Engineering talent is historically mostly China based, and over there they can get Silicon Valley quality people for half the price and twice the working hours => order of magnitude engineering cost advantage over all the companies you mentioned.


👤 daxfohl
I'm curious how cloud they are. Maybe they have an advantage by starting after the maturity of cloud platforms, using the latest and greatest, and avoiding all the redesign cycles? Or maybe they don't cloud at all and that is their advantage? Or maybe that has nothing to do with it.

👤 amelius
> Compare that to the Reddit video player or the Twitter video player or Vimeo. It's much better.

The difference between TikTok and e.g. Reddit is that on TikTok the user wants some video, whereas on Reddit the user wants that video.


👤 amadeuspagel
> How did they manage to get the engineering talent when seemingly FB, MS, Netflix, Amazon, Google are all fighting for that talent?

By hiring people in china? Not everyone wants to move to the US.


👤 kart23
tiktok has exactly one video format, and the videos are small and can compromise on quality because they’re intended to be viewed on mobile. processing becomes a lot easier when you only need to transcode to one format. and also it’s a linear feed, so they can preload the next videos ahead of time. just open up your browser console and you can see for yourself how big each video is and their preloading.

i definitely wouldn’t call this evidence that their tech is good though.


👤 ipaddr
There videos are tiny so buffering is less of an issue

👤 mt_
A product being viral doesn't mean it's good, it's just sufficient for the usage.

👤 yeetard
never before seen so much cope in a HN comment section. lmao

👤 keepquestioning
Is the tiktok tech REALLY that good?

👤 908B64B197
Remember Vines?

As they say, "Good artists copy, great artists steal"...

Being headquartered in a jurisdiction that doesn't care for intellectual property sure must be convenient.


👤 jesterson
Because while FB, MS, Netflix, Amazon, Google went woke, chinese look for talents.

And you probably haven’t seen other chinese apps like xiaolongshu - it's algorithms are amazing in showing you content of your interest. Ethically there may be some compromises across, but it does great things.


👤 lofaszvanitt
Here is your answer from a book called The American Trap:

Americans are very proud of their "process". ... Americans love their processes. In their jobs they rarely express their creativity. Conversely, they expend a lot of energy and time adhering to their processes.

Maybe?