I think the reason why they put authors in every single item is to re-use the design of items both in the home page and search page. Overall I really enjoyed this video, I have always been intrigued by Tiktok because how seamless their whole experience is.
This made me think about using some sort of reverse proxy that changes the schema of APIs, in the sense of trimming down fields, and making API responses better suited to different clients that only need specific fields.
1:53 Right under selected 'Network' tab, right next to 'Disable cache' checkbox there is a 'No Throttling' drop down. If you need to slow down your network you can try that next time.
Responses are compressed as GZIP so there's not much difference in the payload size. When fetching from DB, any sensible ORM will use the cached author record, so the only price to pay is object -> JSON serialization. But it does make frontend developers' job a lot easier. Anything you need to display a feed item is packed into a single object.
I agree, most cost would be at the serialisation level, but I feel reducing the compressed data too would make a difference on user experience. And since browser anyway can cache the author details there’s not much point of fetching it with every request.
I think the reason it fetched everything with the first request is because It uses server side rendering, running all the frontend javascript and logic in the backend and sending the final result as an html css
Great video! Love seeing system design architectures of popular services like this (as much as I despise the idea and 'infectious' nature of TikTok, personally)
Yes, it's very helpful for novice to gain introspection into industry standards. It's also useful for interview prep, especially if you anticipate the interviews will have a system design component
2 reasons why you'll bring all the data for each video 1. the type of db used; if nosql then they don't want to waste resources on filters. 2. you'll need the info things like tracking and you don't want to go back to the db for it
Thanks Hussein! Had to save for later since I made it halfway thru the video before realizing I wasn't caffeinated enough to follow what was going on 😂
Thanks Hussein, perfectly explained. I was devtooling prime video the other day and they also stream the videos through https, but obviously the video sent via the request is encrypted/encoded(it contains some random colors in the video and the actual video is not visible). So do they decrypt/decode the content of the video dynamically on the go, if so, shouldn’t this be an expensive operation? Also just asking, why streaming a video through web sockets is not a good idea ?
Not too sure but if I had to guess.. probably bandwidth and performance. Keep in mind that those vids arent been fetched from storage direclt, they are probably in edge cache locations which are MUCH more easy to scale and they dont take a *shit* on resources because you dont need 2 way communication... Side note: Currently working with IOT devices through webSockets and they are a *fucking pain* to scale... i would exhaust all htto related options before even comming close to websockets 😉
@@jaydeep-p thats what I was thinking. I know some streaming sites embed metadata in the actual video stream so when the video gets leaked to different sites they can track when and where it got leaked from.
Have you done a video on paging. Cursor got me curious on how it works on the backend. Many databases provide a token on per query basis but in general how is that implemented at database level? It cannot be a row number that can be stored with each row in database table since pagination happens on a specific query which could have filters.
@Charan so in that case the results will always be somehow sorted or datbase is pulling the lowest timestamp first. For next page client will need the max timestamp seen in the result so that next query can do " select * from T where created_at > prev_max_time." Without sorting the timestamp its not possible so won't it create performance problem?
Hey Hussein! Thanks for all these great videos! Can you please make a video about some good beginner backend projects... A lot of companies in india don't really lookout for dedicated backend Developers in the early stage of their career or in college for an internship.... But I'm highly interested in backend development
Can you explain / elaborate on the OPTIONs requests more, why is the OPTION method being used? you briefly mentioned some stuff, but didn't fully follow your train of thought
Wow thanks, always learning from your videos. About not using Offset, I see how it can be avoided when paginating a whole table, but how to avoid it when there is filtering and sorting on different columns according to your experience ?
As long as you have a column to order on and filter on the last value you read you should be able to I gave examples here ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-WDJRRNCGIRs.html
So why is the options request bad? If it would be the other way around the mobile page would need to query it with options. Having 2 API endpoints for the same thing is even worse.
you have really great content and I love them, but they are too long and half of it is just chit-chat. Sometimes I want to watch something quickly but nah, always putting them in `watch later`. Tried to watch with 1.5x speed but then I missing some interesting stuff.
RE including all author info on each video item, I'd guess they did the math and realised that the number of request for these author-specific pages is minuscule compared to requests to their general feed page, so it wasn't worth optimizing for - i.e. in 99% of cases, you WANT all that author data in there, because you don't yet know the author. There's value to simplicity.