Hello Interview - SWE Interview Preparation
Hello Interview - SWE Interview Preparation
  • 12
  • 216 559
Kafka Deep Dive w/ a Ex-Meta Staff Engineer
Kafka is a must-know technology for System Design interviews. This video, with a former Meta staff engineer, breaks down the essentials, starting at a high level and working our way down into more and more detail.
00:00 Intro
01:53 Motivating Example
08:09 Overview
18:41 When to Use
23:43 Deep Dives
41:54 Conclusion
Full writeup here:
www.hellointerview.com/learn/system-design/deep-dives/kafka
Connect with me on LinkedIn:
www.linkedin.com/in/evan-king-40072280/
Preparing for your upcoming interviews and want to practice with top FAANG interviewers like Evan? Book a mock interview at:
www.hellointerview.com
Good luck with your upcoming interviews!
Переглядів: 3 337

Відео

System Design Interview: Design Top-K Youtube Videos w/ a Ex-Meta Senior Manager
Переглядів 5 тис.День тому
00:00 Intro 01:44 The Approach 02:46 Requirements 09:46 Core Entities & API 15:25 High-Level Design 29:09 Deep Dives 47:46 Conclusion A step-by-step breakdown of the popular FAANG system design interview question, design a service to calculate the top-k UA-cam videos by view, which is asked at top companies like Meta, Google, Amazon, Microsoft, and more. Stefan, a former Meta senior manager and...
Interview with a Meta EM: AI Impact on SWEs, Team Match, Ramp-Up, How to Learn
Переглядів 4,9 тис.14 днів тому
In the first of our Hello Interviews series, Stefan interviews Christian, an EM at Meta, about his career path, the role of software engineers in the tech industry, and how to be effective in a big company. * Make It Stick - The Science of Successful Learning, Peter C. Brown // www.amazon.com/gp/product/0674729013/ * The Death of the Junior Developer, Steve Yegge // www.linkedin.com/feed/update...
Redis Deep Dive w/ a Ex-Meta Senior Manager
Переглядів 10 тис.21 день тому
Redis (Valkey, MemoryDB, Garnet, Dragonfly, etc.) is one of the most versatile and useful technologies to know for your system design interview with companies like Meta, Google, Amazon, and others. Walk through essential elements of Redis in system design interviews: how it's used, how it works under the covers, and common patterns you're likely to see in practice. 00:50 Why Redis 01:51 Redis a...
System Design Interview: Design a Web Crawler w/ a Ex-Meta Staff Engineer
Переглядів 13 тис.Місяць тому
00:00 - Intro 01:58 - The Approach 4:08 - Requirements 10:31 - System Interface & Data Flow 14:48 - High Level Design 18:20 - Deep Dives 1:04:09 - Conclusion A step-by-step breakdown of the popular FAANG system design interview question, Design a Web Crawler, which is asked at top companies like Meta, Google, Amazon, Microsoft, and more. Evan, a former Meta Staff Engineer and current co-founder...
System Design Interview: Design an Ad Click Aggregator w/ a Ex-Meta Staff Engineer
Переглядів 20 тис.2 місяці тому
00:00 - Intro 01:55 - The Approach 4:16 - Requirements 10:49 - System Interface & Data Flow 14:12 - High Level Design 29:43 - Deep Dives 52:10 - Conclusion A step-by-step breakdown of the popular FAANG system design interview question, Design an Ad Click Aggregator, which is asked at top companies like Meta, Google, Amazon, Microsoft, and more. Evan, a former Meta Staff Engineer and current co-...
System Design Interview: Design Dropbox or Google Drive w/ a Ex-Meta Staff Engineer
Переглядів 30 тис.2 місяці тому
00:00 - Intro 02:03 - The Approach 3:18 - Requirements 8:17 - Core Entities & APIs 15:10 - High Level Design 27:33 - Deep Dives 55:55 - Conclusion A step-by-step breakdown of the popular FAANG system design interview question, Design Dropbox or Google Drive, which is asked at top companies like Meta, Google, Amazon, Microsoft, and more. This question is most commonly asked at Google and Amazon,...
System Design Interview: Design Uber w/ a Ex-Meta Staff Engineer
Переглядів 44 тис.3 місяці тому
00:00 - Intro 01:51 - The Approach 3:01 - Requirements 10:20 - Core Entities & APIs 20:47 - High Level Design 32:55 - Deep Dives 1:01:32 - Conclusion A step-by-step breakdown of the popular FAANG system design interview question, Design Uber, which is asked at top companies like Meta, Google, Amazon, Microsoft, and more. This question is most commonly asked in Google and Meta System Design Inte...
System Design Interview: Design Ticketmaster w/ a Ex-Meta Staff Engineer
Переглядів 51 тис.4 місяці тому
00:00 - Intro 01:31 - The Approach 2:36 - Requirements 9:20 - Core Entities & APIs 17:38 - High Level Design 35:18 - Deep Dives 58:10 - Conclusion A step-by-step breakdown of the popular FAANG system design interview question, Design Ticketmaster, which is asked at top companies like Meta, Google, Amazon, Microsoft, and more. This question is most commonly asked in the Meta Product Architecture...
Design FB Live Comments: Hello Interview Mock
Переглядів 11 тис.4 місяці тому
This is an anonymized recording of a real mock interview conducted on www.hellointerview.com. This is being shared in an anonymized fashion with the written consent of the candidate. In this session, the candidates was asked to design FB Live Comments feature. Interesting in doing a mock interview yourself with one of our FAANG senior engineers and managers? Checkout www.hellointerview.com to g...
System Design Interview Walkthrough: Design Twitter
Переглядів 26 тис.10 місяців тому
Designing Twitter's System Architecture: A Deep Dive Join me as we delve into the intricate system design of Twitter, one of the world's most popular social media platforms. From understanding the core requirements of the platform to the nitty-gritty of microservices, we'll explore how to architect a system that can handle millions of tweets, retweets, likes, and more. In this video, we'll cove...

КОМЕНТАРІ

  • @VyasaVaniGranth
    @VyasaVaniGranth 36 хвилин тому

    Thank you for the video! Isn't this exactly what Lambda architecture is and not a "hybrid between lambda and kappa"?

  • @wanningwei831
    @wanningwei831 2 години тому

    We can definitely go deep on the CDC part, we have normalized data in our main db, but ES is denormalized, how do we handle fanout, shall the CDC consumer call back etc

  • @schan263
    @schan263 2 години тому

    What is this "Premium AI System Design Mocks" on your website?

    • @hello_interview
      @hello_interview 2 години тому

      Still a work in progress, but we're building AI-powered mock interviews that (a) actually give you good feedback, and (b) are reflective of what you'd expect to see in FAANG interviews. Launching once we feel confident they're good enough - feel free to join the waitlist of you want to hear from us when that happens or be part of alpha testing.

  • @rahulbm
    @rahulbm 3 години тому

    Great content. Really liking it. Can you please do a deep dive on TiDB, Rocks DB and Cassandra too

  • @shrishtigupta6902
    @shrishtigupta6902 3 години тому

    Thank you for this detailed video. But a quick question here - I'm still confused when to use RabbitMQ and when to use Kafka? Because both of them can be helpful for all the use cases

  • @htm332
    @htm332 6 годин тому

    re: the ticketmaster example. Partitioning a single event across multiple partitions would break fairness no?

  • @prashantsalgaocar
    @prashantsalgaocar 6 годин тому

    amazing discussions and pointers as always.. Evan... always look forward to your videos..

  • @user-vq5md3eu8v
    @user-vq5md3eu8v 12 годин тому

    How is delayed kafka solution different from the aggregation windows? If we keep the kafka queue alive for 7 days to enable delayed reads internally it is the same thing, only divided not by minute, but by each kafka message. Moreover, there is kafka message overhead. Large memory usage is stated as the main problem of the first approach, but how is it solved with kafka?

    • @hello_interview
      @hello_interview 8 годин тому

      Great question. If we take for granted that the infrastructure already has view events in Kafka, the space costs there can be spread across other subsystems in the infra. Beyond this, the aggregation approach has worse performance since you need to sum across many windows to create aggregations (somewhat mitigated by exploiting their hierarchy) and more complexity. But if you happened to bring it up in the interview and solve those issues I think it's viable.

  • @dmytroopria867
    @dmytroopria867 14 годин тому

    Thank you for making such videos, it helps a lot Have you thought about making postgres sharding based on location? I think Uber doesn't support all cities, just a predefined list of locations

    • @hello_interview
      @hello_interview 6 годин тому

      Sharding by location/region is a great idea and makes the scaling challenges of this problem much more bearable. The volume in a city (even a big one) is going to be dramatically lower than globally.

  • @ItsMeIshir
    @ItsMeIshir 18 годин тому

    Thanks for the video, Stefan.

  • @ItsMeIshir
    @ItsMeIshir 20 годин тому

    Good video. Thanks for making it.

  • @randymujica136
    @randymujica136 23 години тому

    Great explanation as always! I keep watching your videos over and over. As a previous commenter mentioned, it would be great a deep dive on ZooKeeper, it’s mentioned many times in Orchestration/Coordination scenarios along with Consistent Hashing and I think it would be valuable to understand how it works.

    • @hello_interview
      @hello_interview 22 години тому

      Feel free to vote for what you want to see next here! www.hellointerview.com/learn/system-design/answer-keys/vote

  • @WyattsDeBestDad
    @WyattsDeBestDad 23 години тому

    In terms of Horizontal Scaling, from the accompanying article: "Horizontal Scaling With More Brokers: The simplest way to scale Kafka is by adding more brokers to the cluster. This helps distribute the load and offers greater fault tolerance. Each broker can handle a portion of the traffic, increasing the overall capacity of the system. It's really important that when adding brokers you ensure that your topics have sufficient partitions to take advantage of the additional brokers. More partitions allow more parallelism and better load distribution. If you are under partitioned, you won't be able to take advantage of these newly added brokers." My understanding is that Kafka can be scaled horizontally dynamically, perhaps as a system sees an unanticipated increase in volume. If thats correct, does the above imply that partitions can be added dynamically too? In the example cited, LeBron James campaign, I took that to mean that you'd add extra partitions for that campaign in anticipation of the additional traffic. In the case of hot partitions, can one of the prescribed techniques ( say random salting or compound keys ) be added on the fly? If this is non trivial can you maybe link to how this is achieved? Thanks so much!

    • @hello_interview
      @hello_interview 22 години тому

      In general, these are things handled by managed versions of Kafka, such as AWS MSK or Confluent Cloud. How they dynamically scale depends on each managed service. Typically, handling hot partitions is still not managed dynamically and requires conscious effort on the part of the developer.

  • @danielryu6527
    @danielryu6527 День тому

    I have a system design tomorrow and this is a perfect timing to watch!

  • @ediancomachio2783
    @ediancomachio2783 День тому

    You have amazing teaching skills! The World Cup example was incredibly good and entertaining to watch. I’ve paused my interview journey for now, but I always watch your videos for the pure knowledge they provide. Thank you so much!

  • @YoungY2-uu9rj
    @YoungY2-uu9rj День тому

    Thank you. Love every video published so far.

  • @Nick-lw7rj
    @Nick-lw7rj День тому

    First off, thank you for these videos and resources, they are very valuable to anyone studying for interviews. I'm curious though, how would you improve the interview process as someone who's been on both sides of it for a number of years? I question the value of these interviews given that people are being asked to design massive systems, for billions of users, engineered by hundreds/thousands of people over a number of years, which were iteratively improved over time. They're expected to have a pretty ideal solution by having researched the problem or similar ones ahead of time, or much less often, having faced similar problems themselves. If someone was asked to actually design a system in a real production environment, they would spend ample time researching it ahead of time anyway, so I don't necessarily understand the value of them knowing it up front in an interview. I'm also curious how you would react if you were still interviewing people, and a candidate proposed a solution that's an identical or near-identical copy of yours. Would you pass them as long as they understood why each component is needed, and why certain technologies should be used over others? Would you have time to properly gauge that in a 45 minute interview once they've finished their design?

    • @hello_interview
      @hello_interview День тому

      That's a big topic! One that likely requires a full blog post. I will say that, in general, we agree. The interview process within big tech is stuck in a local minima and is in need of a facelift. But as long as the supply of engineers exceeds demand, there isn't much incentive for companies. Their hiring process may have poor recall, but if precision stays high, they don't really care.

    • @Nick-lw7rj
      @Nick-lw7rj День тому

      @@hello_interview agreed about a needed facelift, until then, the grind continues :) thanks again for these

  • @SaurinShah1
    @SaurinShah1 День тому

    Thank you for all you guys do!

  • @muhamadgafar273
    @muhamadgafar273 День тому

    @hello_interview I'm confused about the way the distributed lock works. User 1 calls reserve and acquires the lock for a ticket to Eminem's concert. User 2 calls reserve but the system responds saying that ticket has now been reserved User 2 is a malicious user and calls confirm_ticket before User 1 calls it How does the reservation system in this design prevent User 2 from stealing the ticket from User 1?

    • @hello_interview
      @hello_interview День тому

      It does not let you book a ticket that you did not reserve. The key here is actually knowing who reserved the ticket, so the lock should really be a key value pair of: ticketId:userId

    • @muhamadgafar273
      @muhamadgafar273 День тому

      @@hello_interview ah okay, that makes more sense now. Thank you.

  • @patrickshepherd1341
    @patrickshepherd1341 День тому

    I don't know if you'll see this, but please read if you do. I've been having a lot of trouble lately, and I would really value even just some very brief advice. I've been watching your videos a lot to prepare for an upcoming interview. I'm a PhD computer scientist, but I left professorship about a year ago to work in industry. I've been REALLY unsuccessful in landing anything, but there's never any feedback, so I don't know what I'm doing wrong. Just a lot of anonymous rejections. I'm literally facing bankruptcy. I have an interview on Wednesday, and so I'm learning all I can about modern system design. I'm hopeful, but trying not to get too excited. I'm really thankful for your videos and all the information you provide, though. It's really helping. Hypothetical question: if you became a single parent with no education at 24, but buckled down and raised your kid and took care of your sick mom and made it through an undergrad and a phd over the course of 10 years, and maybe don't have a huge professional footprint because your grad work + all the course materials you made don't add up to a very impressive github profile, what can you do to stand out more? Keeping a house running and raising a kid and taking care of a sick parent doesn't get many stars on your repos, but I think it speaks a lot to adaptability, perseverance, problem solving acumen, etc. But those aren't things you can typically bring up in a cover letter or resume, and you're not supposed to talk about it in interviews, so it just looks like I haven't done anything serious outside of my grad software. It feels like a catch 22. Can you give me any advice? I could wallpaper a house with all the rejects/ignores I've gotten. Thank you again for your great videos!

    • @hello_interview
      @hello_interview День тому

      Really sorry to hear what you've been going through; it's not easy. We work with so many candidates lately who are similarly struggling to land a job in this market. I wish I had a silver bullet, but unfortunately not many novel insights I can offer here. Referrals help. I'd try to leverage connections as best you can if the main challenge is getting through the door to the first interview. Beyond that, look for companies with take-home assessments as the first round. This widens the number of candidates that get a shot and puts things back in your control; just need to crush the take-home.

  • @karvinus
    @karvinus День тому

    I always struggled to choose between queues, stream and pub-sub but this video makes it super easy to understand what to use and when to use.

  • @fatemehrezaei3727
    @fatemehrezaei3727 День тому

    Thank you so much. Love your channel. Please provide a deep dive on Redis too. 🙏

  • @abhilashbandi3866
    @abhilashbandi3866 День тому

    Superb. Someone who has just theoretical knowledge on Kafka helped me understand this "topic" little better. Request for a video on ZooKeeper (I think Kafka moved away from ZooKeeper to kRaft)

    • @hello_interview
      @hello_interview День тому

      Yah exactly right re-kRaft. Consensus something I maybe should have mentioned but, while key to internals, not really necessary to know about in an interview.

    • @abhilashbandi3866
      @abhilashbandi3866 20 годин тому

      @@hello_interview Thank you for the videos. Do interviews at staff/ principal level focus on consensus? At least, glance them?

  • @rjl-s5p
    @rjl-s5p День тому

    In the section about using Kafka for messenger, how would the topics and partitions for a messaging application like Messenger be structured to achieve low latency and high throughput? For example, if there are 1 billion users on the platform, would there be one billion topics, or a single topic with a billion partitions, one for each user (which I don't think is possible since the recommendation is 4k partitions per broker and max of 200K per cluster)? Is there a different approach that could be considered? What are the tradeoffs for each option? And great video. Thank you for doing this.

    • @hello_interview
      @hello_interview День тому

      Some alternatives discussed here: www.hellointerview.com/learn/system-design/answer-keys/whatsapp

  • @3rd_iimpact
    @3rd_iimpact День тому

    Listening via AUX while I’m driving. Love it. Curious to see it visually later.

  • @trueinviso1
    @trueinviso1 День тому

    Love these deep dives, thanks!

  • @rupeshjha4717
    @rupeshjha4717 День тому

    Good going, please keep continuing this series! I had a question regarding consumer concurrency, which is not discussed in this video. Let's say I have 1 consumer group with 2 consumers running and topic having partition of 8, then each consumer will be assigned with 4 partitions when concurrency = 1, how the consumer gets affected if consumer concurrency is changed to 2 now ?

    • @yiannig7347
      @yiannig7347 День тому

      Are you asking what happens if consumer threads are increased from 1 to 2 for a single consumer instance in a group? If so, the consumer is still a single client of the broker, like kafka-client-01 and kafka-client-02. With more threads, the consumer can process messages from its assigned partitions concurrently, improving throughput. However, it still handles the same number of partitions overall.

    • @hello_interview
      @hello_interview День тому

      Thanks for the assist!

  • @akshayjhamb1022
    @akshayjhamb1022 День тому

    For handling kafka consumer down we could turn manual commit offset on, There's option of AutoCommit Offset and a timer limit also when we should autocommit. Though Great video for revision for kafka. Also it would have been great if you had mentioned number of kafka consumer application limitations based on number of partitions.

  • @anuragtiwari3032
    @anuragtiwari3032 День тому

    Liked even though I haven't watched the video. I know it will be a banger !

  • @getmanfg78
    @getmanfg78 День тому

    You are the best at what you do, after listening to your videos I cannot now like and tolerate other system design videos, please make more content for system design

  • @benie871
    @benie871 День тому

    Thanks so much for these deep dive videos 🙌. Also your system design videos are very helpful in my learning journey.

  • @SantoshKumar2
    @SantoshKumar2 День тому

    Most awaited topic. Thank you for the detailed and insightful video on Kafka. Your every video is a gold mine. 🙏🏻 ❤

  • @elbee189
    @elbee189 День тому

    First! Shoutout to this channel! It really prepared me for all my system design interviews this cycle

  • @yottalynn776
    @yottalynn776 День тому

    Very nice explanation! When actually crawling the pages, it could be blocked by the website owner. Do you think we need to mention this in the interview and provide some solutions like using rotating proxies?

    • @hello_interview
      @hello_interview День тому

      Good place for depth! Ask your interviewer :)

  • @brvenkat1
    @brvenkat1 День тому

    The best system design video i have come across, main thing i did not realize 1 hour went by

  • @sachinpateltech
    @sachinpateltech День тому

    Amazing content

  • @Analytics4u
    @Analytics4u День тому

    There is no mention of shardimg here ?

  • @_elevated_
    @_elevated_ День тому

    Step one: use weak authentication for your organizational logins.

  • @ItsMeIshir
    @ItsMeIshir День тому

    The flow is top notch.. Great videos guys 🙌

  • @Analytics4u
    @Analytics4u День тому

    is this asked in product design or system design at meta

    • @hello_interview
      @hello_interview День тому

      Both

    • @Analytics4u
      @Analytics4u День тому

      @@hello_interview do they ask questions like design distributed cache or it’s always product centric and then focus shifts

  • @kamalsmusic
    @kamalsmusic День тому

    If we increment the video freq and then insert that videoID:freq pair into the heap if the freq is bigger than the floor, isn't it possible that the heap would have multiple entries of frequencies for the same video? For example, say k = 3 (So I assume heap size is capped to 3 in this case): watch event for video1 comes in, so counts = {video1: 1}, heap = [(1, video1)] watch event for video2 comes in , so counts = {video1: 1, video2: 1} heap = [(1, video1), (1, video2)] watch event for video1 comes in again, so counts = {video1: 2, video2: 1}, heap = [(1, video1), (1, video2), (2, video1)] In order to test if the incoming element is bigger than the floor, we have to use a min heap so that is why 1,video1 is at the top Say another watch event for video1 comes in again, then: counts = {video1: 3, video2: 1}, At this point we could remove (1,video1) from the top of the heap (since heap size == 3 now) and get: [ (1, video2), (2, video1), (3, video1)] Basically the issue is cause the frequencies of the video changes over time, there could be old freq data and new freq data in the heap at the same time for the same video. Because of this, I don't think just heapifying the existing heap is enough. I think what we would have to do is run through the entire counts to generate the heap. This is much costlier than heapifying though. Heapifying is O(K), while the former is NlogK, where N = # of videos on each shard, and N could be pretty large.

  • @RaymondLei_yunyunzai
    @RaymondLei_yunyunzai День тому

    The sound at 50:25 is more than critical to pass the interview😅😅😅 where do I learn that?

  • @awb19892
    @awb19892 День тому

    I had a couple senior engineers I worked with early in my career who ripped apart my PRs and my designs, which helped me learn a ton. At some point after sitting through a bunch of design reviews (most of which I didn't author) and listening to the senior/team lead ask all these questions, suggest we stick a queue instead of something and make it async, talk about fan-out strategies, the simplicity of immutable data vs. mutable, etc. I really learned a ton and took those lessons with me. I still had to study a lot for design interviews because I never actually worked with web sockets and so on. I can't imagine that many people, even at FAANG companies, have created systems from the ground up (instead of coming in and building on top of what exists) that serviced millions or hundreds of millions of users. My first couple rounds of design interviews I messed up for sure.

  • @aaa-hw2ty
    @aaa-hw2ty День тому

    400gbps nic😂

  • @SaurinShah1
    @SaurinShah1 2 дні тому

    One question I have with this problem and your solution is, the top k heap will constantly need to be updated with views coming in for the videos inside. i.e. lets say you have 3 video with views as [v1: 100, v2: 150, v3:200], if we get chunk of views for v1 (say 75), new heap will look like [v2:150, v1:175, v3:200]. How would the heap handle modifying values of videos that exist within the heap. Another problem with a heap is, read entire heap is usually in the order of nlogn and would require you to poll entire heap(unless there is some other method I am not aware of).

    • @hello_interview
      @hello_interview День тому

      This is a very common DSA pattern: you maintain a hash table of the nodes in the heap. This allows you to look up nodes by key in O(1). The vast majority of updates are not going to change the ordering and are constant time. The updates aren't a problem. Iterating over a heap (which is backed by a binary tree or array) can be done in linear time.

    • @SaurinShah1
      @SaurinShah1 День тому

      ​@@hello_interview Firstly. Thanks so much for the comment :) I love your videos and am learning a lot from them. Not sure I follow (and may just be my lack of grasping tbh). "you maintain a hash table of the nodes in the heap." ok. but how does the ordering of nodes in the heap update with change in the hash table? In real terms, lets say a video goes viral. How does it make its way into the heap and go to the back of the heap (assuming min heap) as it becomes more popular. My basic question is, a heap from what I understand is a data structure that stores data in a manner that you will always have the min/max on top of the heap. As you poll elements, you get them in a sorted manner. If an element within the heap needs to be updated, then you need to remove the specific element(which wouldn't easily do as it would need to perform restructuring of the tree underneath). So, for our use case, when more views of a videos come in, we need to update elements within the heap, which would entail removing all elements in the heap and readding them back after adding new views we've received. Alternate(or maybe this is what you are alluding to) solution algorithmically would be, TreeMap of (view count -> Set<video>) as the "Heap" along with Map of (video -> view count) [backed by sql or in memory db] 1. when new view counts come in for a video, store the view count existing of the video and then update it based on new view counts. 2. If the new view count > min(view count of treeMap), treeMap.get(newViewCount).add(video) 3. if the original view count > min(view count of treemap), treeMap.get(originalViewCount).remove(video) 4. prune treemap to only contain K videos. Also, this process needs to be batched to avoid concurrency issues. "Iterating over a heap (which is backed by a binary tree or array) can be done in linear time." Understood. We could maybe cache the results with a ttl of lets say 30s so that we are not doing it again and again.

    • @hello_interview
      @hello_interview День тому

      So as a nudge: this isn't a distributed system problem and you don't need to invoke SQL, you can do this in a few dozen lines of your favorite language. I'd highly recommend you try implementing a heap. Once you do, it'll be clearer how you might implement an increment(key) and decrement(key) that run in constant time iff the ordering of elements doesn't change.