Designing INSTAGRAM: System Design of News Feed

แชร์
ฝัง
  • เผยแพร่เมื่อ 20 พ.ค. 2024
  • This video is about designing Instagram for a system design interview. We are expected to design the server side so that all 4 mentioned features can be incorporated. System Design interviews evaluate a candidate's computer science fundamentals, architecture principles, etc.
    We start by building an entity relationship diagram. Here, the columns are defined as per the requirements. We then move to designing a microservice architecture. Each microservice represents a single component of the system.
    The newsfeed is built step by step with concepts like load balancing and caching as prerequisites. This completes the system design for Instagram.
    Looking to ace your next interview? Try this System Design video course! 🔥
    interviewready.io
    With video lectures, architecture diagrams, capacity planning, API contracts, and evaluation tests. It's a complete package!
    System Design playlist:
    • System Design BASICS: ...
    Some of the concepts discussed here:
    Tinder video: • System Design: TINDER ...
    Database reference: www.db-book.com/db7/
    Load Balancer: • What is LOAD BALANCING...
    Consistent Hashing: • What is CONSISTENT HAS...
    Publish-Subscribe: • What is the Publisher ...
    Chapters
    00:00 Introduction
    00:10 Feature Selection
    03:15 DB Schema
    09:45 User Followers and Following
    12:02 System Design
    21:32 Celebrity post fanout
    #SystemDesign #DesignInstagram #DesignInterview
    Become a channel member!
    / @gkcs
    You can follow me on:
    LinkedIn: / gaurav-sen-56b6a941

ความคิดเห็น • 589

  • @elliemay1748
    @elliemay1748 4 ปีที่แล้ว +696

    I interviewed for PayPal a few weeks ago, and this was the exact systems design question they asked. They said to me, “Do a system design for Instagram”. I smiled, because I had just watched this video a few days prior, and so I knew exactly how to answer. Thank you for this video, you helped me get a job, for real :)

    • @gkcs
      @gkcs  4 ปีที่แล้ว +74

      Congratulations!

    • @sonushete4431
      @sonushete4431 3 ปีที่แล้ว +4

      wow awesome Elli May got job in Paypal 😁

    • @brandonzheng1092
      @brandonzheng1092 3 ปีที่แล้ว +16

      What's there to be proud of when you've seen the answer to an interview question beforehand?

    • @ashishsharma-nz5pq
      @ashishsharma-nz5pq 3 ปีที่แล้ว +76

      @@brandonzheng1092 so one should not feel proud anyways, cuz he/she had studied that in books b4... lame perception

    • @pratik3106
      @pratik3106 2 ปีที่แล้ว +11

      @@brandonzheng1092 I sense happiness rather than pride, none of that this person said implies proudness, and even if so, why not? I'd be proud.

  • @samanrajaei8129
    @samanrajaei8129 3 ปีที่แล้ว +31

    Damn this kid is good. Better than most of the "veteran" system architects I've worked with.

    • @dijoxx
      @dijoxx 3 ปีที่แล้ว +6

      You must have worked with some really crappy architects if that is indeed the case.

  • @Tuanvu-tb1mh
    @Tuanvu-tb1mh 4 ปีที่แล้ว +83

    Hi Sen, for the database design I think you should go from Logical ERD first then derive Physical Tables from there, it is more natural approach

  • @apurvsawant5703
    @apurvsawant5703 3 ปีที่แล้ว +3

    All the important concepts are explained very simply and this is what makes this video amazing.

  • @AtomicAkshay
    @AtomicAkshay 3 ปีที่แล้ว +1

    Great video man, really appreciate the fact that you've been posting such indetail conceptual content for free.

  • @theakatsuki2113
    @theakatsuki2113 2 ปีที่แล้ว +2

    Wow his content is really at next level
    I love this guy and respect his efforts and the amount of hard work he puts in each and every video

  • @amlanroy5274
    @amlanroy5274 ปีที่แล้ว +2

    Well, I wasn't even looking for this. Just got a random recommendation and now I'm watching this with full focus at 3AM.
    Never thought this day would come😂
    Awesome video.

  • @ci7alex1
    @ci7alex1 4 ปีที่แล้ว +5

    Explains a lot why there are so many well paid people behind each successful online service, so complex, wow

  • @HarkiratSaluja
    @HarkiratSaluja 4 ปีที่แล้ว +9

    Probably the first video of the system design I have seen. Being a front end developer, I had a fair idea about the things but the way you explained just wow

  • @augmentos
    @augmentos 3 ปีที่แล้ว +17

    Would love to see a system design of notifications (activity feed) in twitter/IG etc. Aggregate etc.

  • @HemantSharma-fw2gx
    @HemantSharma-fw2gx 5 ปีที่แล้ว +14

    Thanks for explaining the practical use of all we study in our syllabus..Your videos are superb!

    • @gkcs
      @gkcs  5 ปีที่แล้ว +4

      Glad to hear that!

  • @antarikshsrivastava2562
    @antarikshsrivastava2562 4 ปีที่แล้ว +1

    Absolutely loved your explanation Gaurav. Thank you :)

  • @ChitranshuVashishth
    @ChitranshuVashishth 5 ปีที่แล้ว +7

    I'm not even a CSE student. But watching your videos, Gaurav, actually intrigues a lot and motivates me to actually learn more about programming and design some my own scalable system one day. Thanks Gaurav.

    • @blasttrash
      @blasttrash 5 ปีที่แล้ว +3

      Try coding train channel. You can watch most of his videos and have fun. Its like watching a movie and he does real coding. For example watch this video, even if you dont know programming, you will still understand it and its so much fun.
      Coding the snake game
      th-cam.com/video/AaGK-fj-BAM/w-d-xo.html

  • @yog2915
    @yog2915 4 ปีที่แล้ว +1

    Fantastic work it is because of people like you skills of general masses are also rising

  • @johnfrades
    @johnfrades 3 ปีที่แล้ว

    Awesome man, im glad to see your channel, subscribed immediately! Very helpful!

  • @nitinjoshi4636
    @nitinjoshi4636 5 ปีที่แล้ว +1

    Awesome content.. what I am looking for always get from your videos.
    Keep it up.

  • @ankitgoyal8556
    @ankitgoyal8556 3 ปีที่แล้ว +1

    Loved this playlist, thank you brother

  • @aditikhedkar8514
    @aditikhedkar8514 5 ปีที่แล้ว +1

    I always wait for your videos!very good content
    Thankyou!! :)

  • @devarajt6965
    @devarajt6965 5 ปีที่แล้ว +30

    hi Bro.. Actually the way you explained the stuff is very simple and clear.. Thanks for your time for making such videos..

    • @gkcs
      @gkcs  5 ปีที่แล้ว +4

      Thank you!

  • @xReisk
    @xReisk 4 ปีที่แล้ว +4

    As a backend developer who strugles to do projects due to thinking to much and taking a lot of time to make dumb things... I think I have found one awesome channel for me.
    Thanks for your videos man!

    • @gkcs
      @gkcs  4 ปีที่แล้ว +2

      😁

  • @bmw1553
    @bmw1553 3 ปีที่แล้ว +3

    Gaurav, first of all, thank you for a fantastic, simple and clear explanation. Second of all, I can imagine the work went in to put this video, it must be humongous task in preparing the right content, taping, editing, etc. Great work!

    • @gkcs
      @gkcs  3 ปีที่แล้ว +1

      Thank you!

  • @alexkuzmichev9051
    @alexkuzmichev9051 4 ปีที่แล้ว +1

    I'm so glad I found your channel. Keep up the good work! Nice videos:)

    • @gkcs
      @gkcs  4 ปีที่แล้ว

      Thanks 😁

  • @A.n.a.n.d.k.r.
    @A.n.a.n.d.k.r. 4 ปีที่แล้ว +4

    I didn't knew the dbms subject was so much exciting....

  • @AlphaWatt
    @AlphaWatt 2 ปีที่แล้ว

    Thank you very much for this. Excellent explanation through such a complicated topic. Really helped me think through a follower service I have been struggling to commit to.

  • @dbtechprojects2392
    @dbtechprojects2392 3 ปีที่แล้ว +1

    Thanks for posting this, the part on how to handle the news feed helped me out a lot, originally I could only think of the first method which the administrative tasks are way too high, precomputing the news feed is an option I didn't even think about. thanks :)!

    • @gkcs
      @gkcs  3 ปีที่แล้ว

      Glad it helped 😁

  • @pankilpanchal1996
    @pankilpanchal1996 4 ปีที่แล้ว +4

    Just a test message weather you reads it or not.
    BTW very good system design playlist.

  • @sankalparora9374
    @sankalparora9374 ปีที่แล้ว

    Amazing stuff - not only informative - but interesting!
    Thanks!

  • @shubhammehta319
    @shubhammehta319 3 ปีที่แล้ว +2

    Hi Gaurav,
    I love the way you explain things. This video actually sums up all the major components, including the DB structures and High-level architecture.
    I have one question regarding the design, which is more on low-level design, it would be great if you can create a video on that.
    Q. If I need to design the data storage in-memory, which data structure we should use to store the posts. likes, follower data, such that we can fulfill the given features efficiently.
    Thanks,

  • @bianbian621
    @bianbian621 4 ปีที่แล้ว +1

    great video! the animation part is awesome. I like all your system design videos.

    • @gkcs
      @gkcs  4 ปีที่แล้ว

      Thank you 😁

  • @anotherdigitalnomad9429
    @anotherdigitalnomad9429 3 ปีที่แล้ว +2

    This was such a good video. Thanks!

  • @ZeroInfinityCoder
    @ZeroInfinityCoder 5 ปีที่แล้ว +10

    @Gaurav i think it should be "postId" in place of "activityId" in "comment table" when you were explaining feature no. 2
    as let say we want to find all the comments for a particular post , then we will look into comment table for column postId.
    correct me if i am wrong

  • @prakhargurawa
    @prakhargurawa 5 ปีที่แล้ว

    Awesome explanation ..your videos are really helping ..keep it up bro :) :)

  • @code_report
    @code_report 5 ปีที่แล้ว +31

    Great video!

    • @gkcs
      @gkcs  5 ปีที่แล้ว +15

      When code_report says something, you better believe it 😎

  • @siddharthbhola4231
    @siddharthbhola4231 4 ปีที่แล้ว +2

    @GauravSen: Excellent video! Please help me with a question:
    Can you please explain the reasoning/thought-process behind choosing a Relational database for Users and Feed Schema?? What factors do you consider when taking such a decision?
    Thanks and Regards

  • @emmanuelevbuomwan2665
    @emmanuelevbuomwan2665 4 ปีที่แล้ว

    Concise, at the same time; broad and easy to understand.

    • @gkcs
      @gkcs  4 ปีที่แล้ว

      Thanks 😁

  • @harkirat1
    @harkirat1 5 ปีที่แล้ว +1

    Great Explanation. Clear and concise.

    • @gkcs
      @gkcs  5 ปีที่แล้ว

      😁

  • @shradheytripathi7564
    @shradheytripathi7564 5 ปีที่แล้ว +1

    Loved the explanation :) Nice work.

    • @gkcs
      @gkcs  5 ปีที่แล้ว

      Thank you!

  • @chathurabuddi
    @chathurabuddi 3 ปีที่แล้ว

    What a wonderful channel!!! just subscribed

  • @Arikshtein
    @Arikshtein 5 ปีที่แล้ว +2

    Well done. Very good way of presenting complex stuff like this. Waiting for more: 2 or 3 = )

    • @gkcs
      @gkcs  5 ปีที่แล้ว

      Thank you!

  • @harisridhar1668
    @harisridhar1668 2 ปีที่แล้ว +3

    13:30 Hi Gaurav - thanks for pointing out the need for a load balancer with the snapshot technique stored onto Gateway for network routing when we horizontally scale the server-side. But why is communicating with the load balancer inefficient? Is this to avoid constant network calls ( which are slow ) and to utilize the SS, which can be stored into memory-side on the Gateway application?

  • @yuxiongzhu4249
    @yuxiongzhu4249 5 ปีที่แล้ว +11

    Hi Gaurav, thanks for this great post. You look so young, how could you be so knowledgeable?

    • @vikaspizza
      @vikaspizza 3 ปีที่แล้ว +24

      He is actually 45 years old. He designed a system that removes aging signs from his youtube uploads...

  • @a2zlearninghub67
    @a2zlearninghub67 5 ปีที่แล้ว +3

    Hey gourav sir😊🙏
    Nice overview and well explained.
    You r really great person who share our personal experience. 👍

    • @gkcs
      @gkcs  5 ปีที่แล้ว +1

      Thanks Sandip!

  • @praveen3123
    @praveen3123 5 ปีที่แล้ว +6

    Hey Gaurav great videos bro.. Every software engineer should know system designs to build scalable, robust applications.. keep rocking!

    • @gkcs
      @gkcs  5 ปีที่แล้ว +2

      Thank you!

    • @praveen3123
      @praveen3123 5 ปีที่แล้ว +1

      @@gkcs by the way now you're a software engineer with at least 3- 4 years of experience by now. Do you still practice algorithms? I'm in this dilemma whether to practice or take it light

    • @gauthamhonnavara
      @gauthamhonnavara 5 ปีที่แล้ว +1

      @@praveen3123 Never stop learning !

  • @pratiksinha5737
    @pratiksinha5737 4 ปีที่แล้ว

    @gaurav sen
    Great video......it literally gave me an insight on how to use the theoritical knowledge we have gained as a CS engineer in real Practical Designing

  • @sahajarora2162
    @sahajarora2162 4 ปีที่แล้ว +2

    Hi Gaurav! Very thankful to you for sharing your knowledge with the rest of the world!
    I have 3 questions about the GATEWAY: 1) Is it a Micro-Service? If not, what exactly is it (i.e what does it contain)? 2) It seems like a single point of failure, looking at the diagram. 3) If we have multiple instances of a Gateway, then would the Load balancers be needed in between Client and the Gateway Service ?

  • @AlgoHacks
    @AlgoHacks 5 ปีที่แล้ว +4

    Awesomely explained 😊
    I guess it's just not that simple as it seems after your explanation.
    Great work is being done behind the scene.
    Thanks for all the awesome videos.

    • @gkcs
      @gkcs  5 ปีที่แล้ว

      Thanks Ashutosh!

  • @nayankhanna2367
    @nayankhanna2367 3 ปีที่แล้ว +11

    Been addicted to this channel recently and binge watching it even though I have my exams ongoing xD. Man you are the best. (saying this from my experience of having watched more than 100 "Real" Coding TH-camrs) My Systems Design knowledge is growing leaps and bounds by watching these and I plan to implement these good designs just after my tests are over. I have worked on several Applications as a backend developer, and always stressed heavily on scalability, flexibility, ACID properties. But, your channel has taught me a lot more good techniques and design concepts.

    • @gkcs
      @gkcs  3 ปีที่แล้ว +4

      Thank you 😁

    • @MichaelAMomo
      @MichaelAMomo 2 ปีที่แล้ว

      Seriously man,
      It is a great help

  • @aakashjapi4394
    @aakashjapi4394 4 ปีที่แล้ว +11

    Great video! That said, in your descriptions of the database schema, you should mention hotspotting as a justification for certain decisions as well. Namely, a very good reason to not add a "likes" column to posts is that it creates a lot of contention on rows in a single table, especially because single posts can get hundreds of thousands of likes. You arrived at the same conclusion - building tables that allows for writes to avoid contention and thus reads to be aggregations (which can then utilize caching) - but I think focusing on the larger problem of hotspotting motivates your design decisions better.

    • @rujotheone
      @rujotheone 3 ปีที่แล้ว +3

      Noob question, please what is hotspotting

    • @osmanbaskaya7400
      @osmanbaskaya7400 ปีที่แล้ว

      @@rujotheone some records are getting queried more than others. the specific instance that contains the record will be much busier than the rest of the system. you're not balancing the load ideally uniformly.

  • @erichaymer5130
    @erichaymer5130 3 ปีที่แล้ว

    Fabulous video. Looking forward to more video. Can you elaborate on empirically optimize a ranked feed?

  • @freedom1225jjy
    @freedom1225jjy 4 ปีที่แล้ว

    also would be nice to have more videos on ER diagram ! thank you!

  • @raveenamewani7963
    @raveenamewani7963 4 ปีที่แล้ว +1

    Hi Gaurav, I really like your videos they are very clear and to the point. I would like you to share in one of your videos how the Amazon Market Place Design will look and work like

  • @darkwoodmovies
    @darkwoodmovies 6 หลายเดือนก่อน

    Great video, ty. I'm building an app that does something tangential to this, really helpful for real-world work!

  • @pman-codes
    @pman-codes 4 ปีที่แล้ว +159

    Hi Gaurav,
    Greetings. I love your work, I am a subscriber and a frequent liker. However, I find an implicit assumption in your system which considers the Instagram mobile app as thin clients. The process of storing the posts in the cache in the server would result in an unscalable system. I believe the posts are cached in the user's app memory(cache and physical storage), considering that these apps have a considerable chunk of internal storage used. An added proof for this would be if you try to open up Instagram in offline mode you can still see past posts and a toast message which says "couldn't refresh feed". I would like to have the cache on the user's system and then an identifier that is stored in a place where you are storing the cache of the post on the server.
    (considering the news feed functionality. This can be applied for other uses too. )
    Thanks.

    • @gkcs
      @gkcs  4 ปีที่แล้ว +33

      This is a very good point. Thanks for posting 😁

    • @vikask7246
      @vikask7246 4 ปีที่แล้ว +7

      @@gkcs can you explain system design for telegram

    • @dustindiaz
      @dustindiaz 3 ปีที่แล้ว +4

      @@gkcs the posts ARE stored in application cache... but it doesn't invalidate the fact that mobile apps aren't still thin clients. a user can delete an app, or visit from a third party integration (not built by instagram) -- in which case these timeline feeds are still stored in horizontal caches. you wouldn't believe the amount of money instagram/twitter/etc spend on memcache to make this happen.

    • @adminwadidaw576
      @adminwadidaw576 3 ปีที่แล้ว +2

      @@dustindiaz so which way do i have to follow? Do i need to cache posts in client side?
      I confuse in like sectiob , whenever user click like, should the client side make a request?

    • @dustindiaz
      @dustindiaz 3 ปีที่แล้ว +2

      admin wadidaw caching on the client is helpful when revisiting an application. This way a user can be presented with information immediately.
      Caching on the server, on the other hand, is necessary for large scale services to deliver things like timelines since raw sql queries based on this system design would cause the system to fall over with just a decent amount of traffic

  • @MOhan-ur4ei
    @MOhan-ur4ei 5 ปีที่แล้ว +3

    Your English is awesome bro!!

  • @tharinda
    @tharinda 2 ปีที่แล้ว

    Much appreciated. Love it ❤🔥

  • @vibhorgupta5862
    @vibhorgupta5862 4 ปีที่แล้ว +2

    Great video ! Thanks a lot for these videos, have been very helpful for me.
    If you get time can you also publish a video on UBER's design.

  • @ajayguru2116
    @ajayguru2116 4 ปีที่แล้ว +1

    Amazing content!

  • @hellenruthes2056
    @hellenruthes2056 ปีที่แล้ว

    I love your videos :) Thanks for sharing!

  • @Yan-rv8mi
    @Yan-rv8mi 3 ปีที่แล้ว +14

    7:16 I think we do need a "type" on the Activity table. For example, suppose there's a postID being "123" and a commentID also being "123". Since both postID and commentID can be interpreted as activityID on Activity table, if there a row on activity table with activityID being "123" we don't know it's for the post or for the comment, unless we have a column "type" to distinguish between them.

    • @jellyrabbits375
      @jellyrabbits375 2 ปีที่แล้ว +1

      True in this case, it depends on your system though. In case where the id is a UUID, then there won't be a case where postId and commetId would be equal.

  • @kapilrules
    @kapilrules 6 หลายเดือนก่อน

    awesome explanation of fan-out scenario

  • @gautamtyagi8846
    @gautamtyagi8846 3 ปีที่แล้ว

    thanks, really helpful explanation.

  • @purusottam-tb1sw
    @purusottam-tb1sw 4 ปีที่แล้ว

    Great explanation man.

  • @ivailotenevv
    @ivailotenevv 4 ปีที่แล้ว

    Awesome, keep up the good work :)

  • @vikashdhanabal8984
    @vikashdhanabal8984 5 ปีที่แล้ว +2

    hi Gaurav bro, it was amazing .waiting for more such videos

    • @gkcs
      @gkcs  5 ปีที่แล้ว

      Thanks!

  • @jayanthmanklu8642
    @jayanthmanklu8642 5 ปีที่แล้ว

    Hi Gaurav,
    Your energy is just unmatched!
    Audience Request: Please consider doing a video on how would one architect IRCTC Tatkal Booking scenario - with hundreds of thousands of tickets sold in 2 to 3 minutes time duration. Thanks

    • @gkcs
      @gkcs  5 ปีที่แล้ว

      I'll try to work on this 😁

  • @user-mt6kv1dw7m
    @user-mt6kv1dw7m 2 ปีที่แล้ว +1

    Nice video! I have one question, though: If we precompute the feed, what happens when a user scrolls past the 20 posts we have cached? Then we would have to compute the rest of the feed at the request of the user, which would be inefficient, right? Sorry if I didn't understand that correctly.

  • @anastasianaumko923
    @anastasianaumko923 11 หลายเดือนก่อน

    Very elaborate, thank you! 🤩

  • @amitagnihotri30
    @amitagnihotri30 5 ปีที่แล้ว +12

    From Designing Tinder to Instagram, in a very short time :D

    • @gkcs
      @gkcs  5 ปีที่แล้ว +5

      Hahaha, just 6 months 😉

  • @raghav4296
    @raghav4296 5 ปีที่แล้ว +3

    Awesome video series on this channel 💚. One request Gaurav- Could you please share insights on how the video&audio based systems are designed,built and the kind of algorithms/libraries that go into transcoding on scale, as they are computationally intensive tasks. Thanks.

    • @gkcs
      @gkcs  5 ปีที่แล้ว +2

      Thank you!
      I'll get to designing Netflix/TH-cam in a while. That will be fun! 😁

  • @sunnyshekhar862
    @sunnyshekhar862 5 ปีที่แล้ว

    Take a break from daily routine work. And watch #GauravSen's design videos... You'll get both the idea and chull (read Motivation ) to work on your own projects.
    Kudos !! Great work Gaurav 🙌👏😊

  • @RaviKumar-jg1hc
    @RaviKumar-jg1hc 5 ปีที่แล้ว +2

    It's amazing... please keep it going...

    • @gkcs
      @gkcs  5 ปีที่แล้ว +3

      On it! 😁

    • @RaviKumar-jg1hc
      @RaviKumar-jg1hc 5 ปีที่แล้ว

      Yes, hahaha...

  • @kennethcarvalho3684
    @kennethcarvalho3684 ปีที่แล้ว

    Life is incomplete without a Gkcs design video

    • @gkcs
      @gkcs  ปีที่แล้ว

      Hahaha!

  • @newenglandbarbell4647
    @newenglandbarbell4647 4 ปีที่แล้ว

    What a talent 👏🙌

  • @vishalarora6068
    @vishalarora6068 4 ปีที่แล้ว +25

    what you said is load balancer is work of service discovery or metadata service like zookeeper/consul/etcd and what you described as gateway is the work of load balancer or reverse proxy.
    Looks like you haven't used these systems practically(I am not blaming) and trying to inform others based on(your interpretation of) what you read online.

    • @zshanz
      @zshanz 4 ปีที่แล้ว +1

      good point.

    • @adamberry7536
      @adamberry7536 3 ปีที่แล้ว +1

      Can I ask a question about your comment. I totally agree what he's describing as a load balancer is actually more like Zookeeper. But I'm confused about the gateway comment. My understanding, which I may be wrong about, is that a gateway will handle authentication, authorization, and then route the incoming HTTP request to one or more services to accomplish the task at hand depending on the configuration. So yes, it sort of acts as a reverse proxy with the addition of authentication logic and possibility of making synchronous service calls. But I don't see how the gateway is a load balancer. It doesn't distribute API calls based on load. It distributed then based on function. If you wanted load balancer between a service and the gateway or a service and another service you would still need a load balancer. Is this correct?

  • @AdventureTrekRide
    @AdventureTrekRide 5 ปีที่แล้ว

    Awesome video. you are doing just great :)

    • @gkcs
      @gkcs  5 ปีที่แล้ว

      Thanks!

  • @alicebobson2868
    @alicebobson2868 3 ปีที่แล้ว

    this was very useful, thanks

  • @rifatfaisal4743
    @rifatfaisal4743 5 ปีที่แล้ว +3

    i went through the whole thing and i can assure as a newbi i found it interesting you got a new sub mate.
    can you make videos on beginner stuff of coding as your way of projecting information is very easy for people to take in thank you

    • @gkcs
      @gkcs  5 ปีที่แล้ว +1

      Thanks!
      I have some in my task list, let's see if I can get to it. Will take me lots of time to finish the other stuff first though 🙂

  • @anuragagnihotri5238
    @anuragagnihotri5238 2 ปีที่แล้ว

    @Gaurav at 20:55
    You said regular polling/http requests (I assume would be using some connection pool, not establishing tcp connection for each poll request) from clients/cellPhones asking for updates from server will have bandwidth/battery issues.
    But even when we go with LongPolling/Websockets, its actually keeping either connection always(Wbsockets) open/connected or maintain connection for longer period(Long Polling) between client and server for realtime data transfer but this will also have battery and bandwidth issues right? So mainly how do we measure Pros/Cons for this specific Instagram case between Long Polling vs WebSockets?

  • @krutikpatel906
    @krutikpatel906 2 ปีที่แล้ว +9

    Hi Gaurav, thank you for amazing content. Can you please share your thoughts on why you chose SQL database for all these data instead of NoSQL? Since the volume is high and eventual consistency seems to be ok, can we use NoSQL database for this kind of data?
    Thanks

  • @NikPnchl7
    @NikPnchl7 3 ปีที่แล้ว +1

    Will we store the post meta-data in a relational db ? Would that quickly fall apart given the scale of Insta ? Or would a nosql like Cassandra be the way to go with the tables you've described ? What do you think ?

  • @zhong8842
    @zhong8842 3 ปีที่แล้ว +2

    The design before 11:19 seems mostly logical and doesn't seem to require too much knowledge on cs infra.

  • @rittwikarudra626
    @rittwikarudra626 3 ปีที่แล้ว

    Very good explanantion Gaurav. The way instagram generates feed today has changed drastically with their new graph api which focuses more on relationships. It would be great to see a video on that.

    • @gkcs
      @gkcs  3 ปีที่แล้ว

      I'll look into it :)

  • @GilP-BM
    @GilP-BM 4 ปีที่แล้ว

    Great video man 💯

  • @nishantkumarbundela8482
    @nishantkumarbundela8482 3 ปีที่แล้ว +1

    After watching this video, Instagram would never be the same for me, ever again.

  • @samirhere4341
    @samirhere4341 4 ปีที่แล้ว

    Thank you for all the videos. Can you share a video on amazon and amazon subscriptions system

  • @abhishekgupta4570
    @abhishekgupta4570 5 ปีที่แล้ว +9

    lot of learning with video and bro one request can u make video on your uber interview about question asked roundwise and that HR round which was pretty tough as you mentioned in video (Got job in uber).

    • @gkcs
      @gkcs  5 ปีที่แล้ว +11

      Thanks Abhishek!
      I won't be mentioning the questions asked, because we aren't allowed to. "Got hired" will turn to "Got fired". 😝
      You can go through the content on the channel, it's more extensive than an interview set 😁

  • @AseshShrestha
    @AseshShrestha 2 ปีที่แล้ว

    Love you system design videos. Love from Nepal 👍

  • @abhaysoni8631
    @abhaysoni8631 2 ปีที่แล้ว

    @Gaurav Sen , hello, thanks for the video, my question is why did you go for a table based db here , any specific reason, and i was thinking for maintaining post comment wont the subset pattern of mongodb be more better option here.

  • @pablo_aldana
    @pablo_aldana ปีที่แล้ว

    Awesome video! thanks a lot Gaurav for this very insightful. I have a question tho regarding of likes and feeds. When retrieving the feed, what would you say is the best way of knowing if the user has liked the post that is seeing at this moment? As calling the DB every time seems a bit overkilling.
    Keep cracking on!

  • @rohan1456
    @rohan1456 4 ปีที่แล้ว +1

    05:05 select count (*) from likes where post/parent_id = 'xyxyx' AND type = post.
    mentioning this incase anybody gets confused

  • @adityasrivastava5322
    @adityasrivastava5322 2 ปีที่แล้ว

    Amazing way of presenting the core concept Gaurav.. Really helpful, thanks.. :) Do we have any probability of learning about the chat feature as well .?

  • @himanshusingh694
    @himanshusingh694 4 ปีที่แล้ว

    Hi Gaurav,
    This video is very good and your explanation of topics is simply super! Kudos! Thanks for sharing knowledge with us.
    Can you please make a video for Designing an online chess game?

  • @sitharthanmirudhul5411
    @sitharthanmirudhul5411 3 ปีที่แล้ว

    Very good explanation bro!

  • @AbhishekGupta-kv9ne
    @AbhishekGupta-kv9ne 2 ปีที่แล้ว

    @Gaurav : For sending notifications to user why should we use Long polling or Web sockets instead of SSEs (Server side events).

  • @JaswinderSingh-uw2hf
    @JaswinderSingh-uw2hf 2 ปีที่แล้ว +2

    Regarding Hybrid approach : practically User1 follows the ordinary user and celebrity as well. now when post done by ordinary user it will push to user1 but when post by celebrity, system/client has to pull. now how client know when it has to pull ? @gaurav sen sir, can you please explain. or correct me if I misunderstood something...

  • @urunovtimes5816
    @urunovtimes5816 3 ปีที่แล้ว

    Good and nice explanation.
    keep going and more improvement

  • @swapnilgt
    @swapnilgt ปีที่แล้ว

    In the use-case celebrity, the decision has also be made on the basis if the polling is affecting the user's device battery or not. WorkManager on Android is a great way to achieve that. It optimises the resources and takes decision when to give a CPU chunk to a particular application only when the device has decent resources to spare. This could could surely save a lot of CPU clocks on our server end for sending PUSH.

  • @shishirkumar8335
    @shishirkumar8335 5 ปีที่แล้ว

    Great Video.
    For use case user-follower scenario, I see technical solution as Graphical DS problem (considering time). Reason is fetching feed both side will become simple and fast.
    Looks like an interesting problem to analyze/compare various SD approaches against above use case.

    • @gkcs
      @gkcs  5 ปีที่แล้ว

      You could try...

  • @PramodShetty
    @PramodShetty 5 ปีที่แล้ว +1

    Since the following table(user Id, follower id, timestamp) can grow very big, sharding or indexing would be required.
    On which column should that be done. If I index one of the this id columns, one of the service, getFollowing or getFollower will be affected badly.