Just made it to team matching for E5 at Meta. Your channel has been particularly helpful since you go into the actual technologies themselves and their pros and cons, which is not something you get in most systems design prep material. It is especially helpful for me coming from a startup background where I did not learn highly scalable systems on the job.
@jordanhasnolife51635 ай бұрын
Absolute legend - congrats and hope you're able to see it through to the offer!
@yiannigeorgantas1551Ай бұрын
The UDP broadcast + re-transmitting nodes is an interesting approach I hadn't considered. In my approach to the problem, I had used Kafka sharded by ticker to create a deterministic ordering of events for every market, and then have the matching engine, which in this case would be a Flink node, fan-out the events to all the clients. Essentially, I was thinking of something similar to notification service (video 19). In this approach though, we leverage UDP broadcast to fan-out, which is a lot more efficient because it operates at the network layer. The cost of using UDP though, is that we lose the message delivery guarantees, so we create re-transmitter nodes to re-implement those TCP protocol guarantees. This allows us to differ re-transmission to dedicated nodes instead of relying on the TCP protocol, which would have meant re-transmission handled by the matching engine, which would have reduced throughput.
@jordanhasnolife5163Ай бұрын
Yeah in practice I don't believe kafka is nearly fast enough for the latency that exchanges need to operate at
@torresoso5 ай бұрын
I just started working at a stock exchange, this is great timing
@jordanhasnolife51635 ай бұрын
Fwiw I wouldn't be surprised if the design is pretty different now! This is from like 10 years ago, but who knows!
@emenikeanigbogu93685 ай бұрын
I think a Pokémon go system design video would be fire!!!
@jordanhasnolife51635 ай бұрын
Interesting, haven't played since like 2015, what do you think the tough parts of this one would be
@emenikeanigbogu93685 ай бұрын
@@jordanhasnolife5163 Probably the caching of pokemons location as well as preventing location spoofing, scalability, real time interaction.
@Dusht985 ай бұрын
Detecting buildings and geolocation where pokemon spawns. Real time data processing maybe.
@LawZist5 ай бұрын
I guess it would be similar to nearby friends/ restaurant search using geohash
@jordanhasnolife51635 ай бұрын
@@LawZist Well I'd say this is my main concern. I also can't remember whether every user sees the same pokemon or the client itself just randomly generates them lol.
@dontdoit6986Ай бұрын
You missed the part where high-frequency trading firms placed their servers literally in the basement or in buildings next to the stock exchanges. This gave them an edge by executing trades faster than participants coming in from the wider internet. Those milliseconds of speed even allowed them to create 'dark pools' and run hypothetical trades to evaluate outcomes before deciding whether to execute or not. This gave them a huge advantage in gaming the system. Barclays and Credit Suisse were fined. the IEX was created to add a 350 millisecond "speedbump" in processing trades from some known HFT's. Of course, nothing else changed, and they do it to this day.
@jordanhasnolife5163Ай бұрын
Colocation is certainly a part of how money is made
@surenderthakran66223 ай бұрын
Very informative as always. One question though: why not use a log based message bus like Kafka instead on retransmitters?
@jordanhasnolife51633 ай бұрын
We're using UDP so messages may arrive out of order (don't even know if Kafka can work with UDP), Kafka can only store messages in the order they come in. Not sure if it's also too slow due to writing to disk.
@surenderthakran66223 ай бұрын
I meant instead of the order matcher broadcasting UDP messages it can push it's output to a message bus for the standby order matching nodes to consume. Definitely slower than UDP but much less complicated and more reliable than retransmission. It is a very interesting design though. We do not usually get to see UDP broadcast + retransmitters. I am wondering about other applications of this.
@jordanhasnolife51633 ай бұрын
@@surenderthakran6622 I imagine this is one of the few. Perhaps video chat retransmitting for recordings.
@surenderthakran66223 ай бұрын
@@jordanhasnolife5163 btw I had a system design round with one of the FAANG's yesterday. I was asked something similar to your top k leaderboard problem. Your video was a big help:-)
@jordanhasnolife51633 ай бұрын
@@surenderthakran6622 Veryglad to hear! Hope it works out, good luck!
@hello_interview5 ай бұрын
Jordan has done nothing wrong!
@jordanhasnolife51635 ай бұрын
Going down kicking and screaming
@beecal42792 ай бұрын
Thanks for the video; In 14:44 is there limitation for secondary to rebuild primary's state? do secondary engine need to have captured the original Order message in order to generate msg #2 & #3 based off of #1? also, does it still wotk if it only got #2 or #3 instead of #1 msg?
@jordanhasnolife5163Ай бұрын
Yep! The main idea here is that if we see any of the messages created by an order id we can back out the state, including the responses to it, as opposed to the original order.
@LeoLeo-nx5gi5 ай бұрын
Hi Jordan, thanks for sharing your knowledge here. Just one query :- I see we mentioned cons about both the partitioning techniques, so if partition by symbol would also not work, then what should be the ideal partitioning technique? (Should it be by orderID?)
@jordanhasnolife51635 ай бұрын
The ideal way of doing it is still by symbol ID, there's no perfect answer here, but you do want all the orders for the same product to be on the same node.
@seifeddinedridi48985 ай бұрын
Thanks for video Jordan, great work. A quick question: why not use a time-series database to store the trades? Do you think that would slow down the system considerably?
@jordanhasnolife51635 ай бұрын
You might have someone listening to exchange data putting it in a tsdb, but doing this in the matching engine itself would add a network call and a disk write which probably isn't feasible.
@NBetweenStations4 ай бұрын
Thanks Jordan! Question about buy and sell orders. Is the idea that the actually fulfillment of the orders is handled by a service outside of this design? Thanks!
@jordanhasnolife51634 ай бұрын
I'm not sure what you mean fulfillment. If you mean the delivery/recording of the stock changing hands, or the payment itself, that's done by others yeah.
@aforty13 ай бұрын
Thank you Jordan! ❤
@kevinburke3941Ай бұрын
Hey Jordan! Off topic but if you don't mind me asking, what made you want to switch to front end?
@jordanhasnolife5163Ай бұрын
Hehe mostly a joke I'd say I do full stack work
@htm3324 ай бұрын
For state machine replication does the replication happen synchronously? i.e. is the request pending until both primary and backup process it?
@jordanhasnolife51634 ай бұрын
I'd say asynchronously, but ideally we have enough machines listening to the matching engine that it's close to perfect in terms of not losing messages. Basically, if a message reaches a customer, it hopefully has reached at least one retransmitter.
@surajkumardwivedi71394 ай бұрын
Hey guys, what was the solution for increasing throughput? since we cannot partition since cross shard call would fc us up, we cannot dedicate different server for particular stock's transaction since atomicity would get fced up then what can we do?
@surajkumardwivedi71394 ай бұрын
ps: I respect your grind.
@jordanhasnolife51634 ай бұрын
Not really much else to be done. You can partition at the cost of atomicity across ticker symbols, or you can just try and make things run as fast as possible on an individual node via improved hardware and software.
@LokendraSingh-425 ай бұрын
50% is adding bugs to GUI 😂
@jordanhasnolife51635 ай бұрын
I had thought I said buttons but bugs works too
@lohitakshtrehan63795 ай бұрын
Yay new video!!!
@MK-qp2uv5 ай бұрын
Thank you so fucking much, I appreciate the time you spend to teach us. You are a legend.
@chaitanyatanwar81514 ай бұрын
Thanks
@JamilaJibril-e8h5 ай бұрын
Oh my boy wait you don't you can't do we even have life .....
@ShellyChen-u7q3 ай бұрын
that's that "my wife's boyfriend"?!!
@KratosProton5 ай бұрын
BitTorrent Sustem Design please
@jordanhasnolife51635 ай бұрын
Not too familiar with how torrenting works but I'll have to look into it
@KratosProton5 ай бұрын
@@jordanhasnolife5163 Thanks
@sohansingh20225 ай бұрын
❤
@songswithhr5 ай бұрын
Bro did someone ever tell u, u look like Garfield comic😭
@jordanhasnolife51635 ай бұрын
I'm cooked
@Jordan-777775 ай бұрын
infowars app system design
@jordanhasnolife51635 ай бұрын
Don't know anything about the app, care to elaborate on the tough parts?
@foxedex4475 ай бұрын
MY DREAMS COMING TRUE
@jordanhasnolife51635 ай бұрын
Well done I saw your commen
@darkstudio31704 ай бұрын
FYI : Your wife is cheating on you
@jordanhasnolife51634 ай бұрын
You'd have scared me if I had one
@darkstudio31704 ай бұрын
@@jordanhasnolife5163 I am stuck in team matching phase at Google , my recruiter told your feedback is positive but are not very great. It's been two months already, should I be hopeful 😔?
@ShellyChen-u7q3 ай бұрын
what's this? "my wife's boyfriend"?!!!
@jordanhasnolife51633 ай бұрын
Are you more surprised by the fact that I have a wife, or that she has a boyfriend?
@ShellyChen-u7q3 ай бұрын
@@jordanhasnolife5163 hahaha, both!!! thanks for replying me, what a surprise!!! You didn't expose much of your personal life, lol, I guess it is very ally with the channel name. Would definitely want to see your wife in the video one day, and, her boyfriend?!! lol, which will turn this channel to be "Jordan has drama life", hahaha
@jordanhasnolife51633 ай бұрын
@@ShellyChen-u7q Tragically, I have neither a wife, nor does my fictional wife have a boyfriend. It's just a r/wallstreetbets meme