28: Bidding Platform (eBay) | Systems Design Interview Questions With Ex-Google SWE

Поділитися
Вставка

КОМЕНТАРІ • 59

  • @hotnonsense5892
    @hotnonsense5892 19 днів тому +5

    Hey Jordan, just wanted to say I just landed an E5 role at Meta and your videos were a big part of helping me get past the system design interview. It wasn't the only resource I used, but it was definitely a huge help, especially early on in my study when it helped me fill a lot of holes in my knowledge. Thanks so much for producing these videos!

    • @jordanhasnolife5163
      @jordanhasnolife5163  19 днів тому

      Woo!! Congrats man and good luck in the new role!

    • @aishwaryakala9653
      @aishwaryakala9653 18 днів тому

      Congrats! Mind sharing your resources and learning paths so that it could help others as well.

    • @hotnonsense5892
      @hotnonsense5892 18 днів тому

      @@aishwaryakala9653 Hello Interview blogs and videos are awesome. They also help with getting the logistics of how to structure and pace the interview.
      I watched System Design Fight Club videos, but the videos are so unfocused and long-winded you really have to watch them at high speed and skip over large parts.
      DDIA is a great read, although I can't directly attribute anything I did in any interviews to it (there isn't enough time usually), I do think it helped reinforce and internalize a lot of ideas I'd only skimmed. Also Kleppmann is also a great, engaging writer.
      I read Alex Xu's books and... idk personally I kind of hated them and found some of his solutions very questionable, but maybe that's just me. The writing isn't that great and some of it is a real slog to get through. It seemed to me like he didn't get anyone to proof-read or edit them. A lot of people like them though.
      Though even for material that is bad, reading it can still help because it stimulates your mind to think about what's wrong with it and come up with your own better solution.
      More important than any specific resource... practice! At least for Meta you have only 35 to 40 minutes after accounting for introductions and questions at the end. Write down checkpoints/milestones for how many minutes you can spend on each step of your system design and practice consistently hitting them. Being able to come up with a great design in 2 hours is pointless because they will cut you off long before then.
      I practiced with a random design prompt every day and a timer and made sure I was hitting those checkpoints. Also consider that in the real interview you will probably get interrupted sometimes.
      Also if you can afford it, consider some paid mocks.

    • @hotnonsense5892
      @hotnonsense5892 17 днів тому +3

      ​@@aishwaryakala9653
      Hello Interview blogs and videos are great. They also help with getting the logistics of how to structure and pace the interview.
      Various other random YT videos on topics I felt I didn't understand. I watched System Design Fight Club vids, but the videos are so unfocused and long-winded you really have to watch them at high speed and skip over large parts.
      DDIA is awesome, although I can't directly attribute anything I did in any interviews to it (there isn't enough time usually), I do think it helped reinforce and internalize a lot of ideas I'd only skimmed. Also Kleppmann is also a great engaging writer.
      I read Alex Xu's books and... idk personally I kind of disliked them and found some of his understanding of some systems a bit questionable, but maybe that's just me. The writing isn't always great and it's a slog to get through some parts. He needed better editing and proof-reading imo. A lot of people like them though.
      Even for material that you don't agree with, reading it can still help because it stimulates your mind to think about what's wrong with it and come up with your own better solution.
      But more important than any specific resource... practice! At least for Meta you have only 35 to 40 minutes after accounting for introductions and questions at the end. Write down checkpoints/milestones for how many minutes you can spend on each step of your system design and practice consistently hitting them. Being able to come up with a great design in 2 hours is pointless because they will cut you off long before then.
      Practice with a random design prompt every day and a timer and make sure you're hitting your time checkpoints. Also consider that in the real interview you will probably get interrupted sometimes.
      Also if you can afford it, consider some paid mocks.

  • @Ambister
    @Ambister 19 днів тому +5

    You look like Marv from Home Alone after the iron fell on his face. Love the vids tho

  • @jporritt
    @jporritt 17 годин тому +1

    Hi Jordan. Kafka ordering is only guaranteed within a partition. To get Kafka to have guarantee ordering therefore you need to configure a topic to have only one partitoin.

    • @jordanhasnolife5163
      @jordanhasnolife5163  16 годин тому

      Yeah we partition by auctionid here

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

      @@jordanhasnolife5163 Ah…sorry, yes!

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

    Very nice video, Jordan.
    One question I have is: how do we accurately restore the Auction state on the server if both the Bid Engine and Backup Engine go down?

  • @AkritiBhat
    @AkritiBhat 3 дні тому +1

    one quick question, how would we handle hot auctions near the deadline. When there are too many bids. In that case, we might need to have Kafka before our bidding engine

    • @jordanhasnolife5163
      @jordanhasnolife5163  3 дні тому

      Agreed, we lose any request response ability for our requests but what can ya do

  • @jordiesteve8693
    @jordiesteve8693 22 години тому +1

    in the 2nd pseudo code, you enqueue some bids into an in-memory queue, and then ship to kafka, am I right?

  • @golabarood1
    @golabarood1 11 днів тому +1

    Thanks Jordan for an amazing upload as always!
    A question from the last slide -
    - what is the use of Auction DB? Is it just for the bidding engine to read and write some state that it needs? As looks like only bidding engine is interacting with it.

    • @jordanhasnolife5163
      @jordanhasnolife5163  10 днів тому

      Yeah, we basically need it to write end auction result as well as query for existing auctions if users want to bid.

  • @LUN-bo2fb
    @LUN-bo2fb 18 днів тому +1

    Jordan, how do you feel about the delivary framework that's suggested by vast amount of youtubers.
    Functional and nonfunctional requirement -> back of envelop estimation -> list down core entities -> API design -> high level design -> deep dive.
    I found you have your own style of delivary. and it is still smooth.

    • @jordanhasnolife5163
      @jordanhasnolife5163  18 днів тому +1

      I used to do this in the 1.0 playlist. I found that it wasted a lot of time for me, and I think that most people are pretty capable of figuring out the APIs that you need fairly quickly. The high level design to deep dive is something I've considered doing more, which is why I tend to have these overview slides. I don't think giving a high level design without some initial discussion first makes much sense to me.

    • @LUN-bo2fb
      @LUN-bo2fb 18 днів тому +1

      @@jordanhasnolife5163 Yes I think high level design always goes into very similiar form if you do it without discussion on how you are going to handle and store data.
      I am still thinking if I should draw a high level diagram in my upcoming interview or not. I did this in a mock interview, and eventually, the interview still ask me how data model looks like and how I handle race condition.
      I think put the high level design after presenting data model to do a quick summarization of current discussion may be a good idea.

  • @nikhilm9494
    @nikhilm9494 18 днів тому +2

    Hey Jordan, Do you plan on bringing back the low level system design videos anytime going forward?

    • @jordanhasnolife5163
      @jordanhasnolife5163  17 днів тому +1

      At least for the time being, I'm planning to stick with distributed systems design. That being said, I'm sure I'll eventually fall into a rut, and once I do I may revisit these!

  • @Raymondhjc
    @Raymondhjc 15 днів тому +1

    Hey Jordan, do you plan to do a email system design?

  • @perfectalgos9641
    @perfectalgos9641 18 днів тому +1

    At the 31:28th second, why do we need an Bid Gateway behind LB? I think It should be other way around BidGateway and then LB for Bid Engine.

    • @jordanhasnolife5163
      @jordanhasnolife5163  17 днів тому

      Technically you'd want one for both. The bid gateway is likely going to be run by many servers which we can round robin to. Finding the right bidding engine will depend on the id of the auction.

  • @Av-cu6gm
    @Av-cu6gm 14 днів тому +1

    Why we have auction db mysql, when it's decided to choose kafka and time series as source of truth?

    • @jordanhasnolife5163
      @jordanhasnolife5163  14 днів тому

      This is just for the metadata of the auction itself, not the bids

  • @popricereceipts4279
    @popricereceipts4279 17 днів тому +1

    So how does the bid engine actually determine the ordering? Like what is the actual logic?

    • @jordanhasnolife5163
      @jordanhasnolife5163  17 днів тому +1

      You just grab a lock, increment the sequence number by 1, release the lock.

  • @techlifewithmohsin6142
    @techlifewithmohsin6142 19 днів тому +1

    Love the content, can you also make a video on UA-cam Analytics like Video counts, watch time with no double view on given time period and extensible to have new metrics for content creators.

    • @jordanhasnolife5163
      @jordanhasnolife5163  18 днів тому

      I'd say this sounds a lot like the "top K" problem, but instead of getting the top K you compute it for all of them.

    • @techlifewithmohsin6142
      @techlifewithmohsin6142 18 днів тому

      @@tttrrrrr1841 Yeah I saw this on Leetcode only, can you add more details. You mean you used video chunk_id to get the count and its time_window can be used to multiply the count to get total watch time?

    • @techlifewithmohsin6142
      @techlifewithmohsin6142 18 днів тому

      @@tttrrrrr1841 you mean you used video segment_id events to aggregate and then use video_id to perform those metrics operations at the query time.?

    • @techlifewithmohsin6142
      @techlifewithmohsin6142 18 днів тому +1

      @@tttrrrrr1841 Can you also tell what was the question you had in second round of SD?

    • @jordanhasnolife5163
      @jordanhasnolife5163  17 днів тому

      @@tttrrrrr1841 lol funny enough I did not see your leetcode comment, this one was me I promise

  • @firefly_3141
    @firefly_3141 13 днів тому +1

    Hey Jordan your linkedin?

  • @mdasifqureshi
    @mdasifqureshi 19 днів тому +2

    One thing I wanna point out is that if the primary goes down, the backup server will have to wait to be caught up with all the kakfa messages in its partition before it can start serving requests. So we can have some unavailability, which is ok here since we are trading it for consistency.
    Another thing is that since kafka already guarantees ordering within a partition I don't think we need the sequence numbers. Since bid engine is evaluating the bids in a serial order through a critical section and also persists messages to kafka in that critical section, the ordering of messages in kafka will be consistent with the sequence numbers making them redundant. @jordan let me know if I missed something.

    • @mdasifqureshi
      @mdasifqureshi 19 днів тому +1

      On reviewing the pseudocode it seems like we are writing to kafka in a background thread. I don't think thats feasible as it'll violate our durability guarantees. I think have to persist to kafka before we acknowledge a bid.

    • @jordanhasnolife5163
      @jordanhasnolife5163  19 днів тому

      1) Totally agree that you'd have to wait for the backup to read all Kafka messages. You could mitigate this by sending messages to the backup first and then it puts them in Kafka, but there are tradeoffs there. The sequence numbers were just for the case where we publish to Kafka on a another thread

    • @jordanhasnolife5163
      @jordanhasnolife5163  19 днів тому

      As for the separate Kafka thread thing, I registered a handler for when we get the ack at which point we return to the user. But then is it truly synchronous?

    • @mdasifqureshi
      @mdasifqureshi 19 днів тому

      @@jordanhasnolife5163 Got it. But I wonder if there is any benefit to using a separate thread to publish to kafka.
      If we use a single bg thread that reads for the in memory queue and publishes to kafka, I'd say lets just use the main thread as pusblishing to kafka is the bottleneck so having multiple thread doesn't really improve response time to client.
      If we use multiple bg thread that reads for the in memory queue and publishes to kafka( which eliminates the main bottleneck through parallelism), then the messages will be out of order in kafka. Now sequence number do come to rescue here but consider a scenario where I successfully published sq no 5 but the primary died before publishing sq no 4. Since the determination of whether sq no 5 was accepted/rejected depends on sq no 4, loosing sq no 4 which sq no 5 is persisted will create inconsistency in our system.
      Interested in hear your thoughts on this.

    • @mdasifqureshi
      @mdasifqureshi 19 днів тому

      @@jordanhasnolife5163 Got it. Though I am having trouble understanding what the benefit of having a separate thread to publish messages is.
      I don't think we can use multiple bg thread to publish to kafka because that would screw up ordering and can create inconsistency like sq no 5 is persisted while the primary died before persisting sq no 4. And since sq no 4 was used in the determination of sq no 5's accepted/rejected status this would lead to inconsistency.
      And if were using a single bg thread might as well use the main thread and publishing to kafka will be bottleneck in the bid processing. using a single background thread just changes where we wait i.e. do we wait before entering critical section(main thread scenario) vs after entering critcal section(bg thread scenario)

  • @riyakaushik3585
    @riyakaushik3585 19 днів тому +2

    The first viewer on a Saturday Evening? damn thats sad

  • @foxedex447
    @foxedex447 19 днів тому +1

    Bro exposing his company system design 💀💀

    • @scuderia6272
      @scuderia6272 19 днів тому +3

      Has he worked at eBay?

    • @jordanhasnolife5163
      @jordanhasnolife5163  19 днів тому

      No never lmao, I'm a bit confused here

    • @foxedex447
      @foxedex447 19 днів тому +1

      ​@@scuderia6272 no i meant like "he getting the system design from his company and putting it here", like he has a bidding system in his company and putting it here not on ebay XDD

    • @foxedex447
      @foxedex447 19 днів тому +2

      @@TenFrenchMathematiciansInACoat GUYS ITS JUST A JOKE 😭

    • @scuderia6272
      @scuderia6272 19 днів тому +1

      😂