This was the first video I'd seen from this channel. This is some next-level system design content. Way more in-depth than other videos I've seen. Unfortunately, it doesn't look like there have been any recent uploads, which is really too bad.
Normally I play videos in 1.5x or 2x. Your videos have so much information that I am afraid of losing some fundamentals if I play in 2x. Outstanding quality. Please keep making such videos.
This is absolutely the best content on RUclips on the system design topic! No "scratching the surface" bullshit, but rather very in-depth and concrete explanation on how to navigate successfully through the system design interviews. Thank you Mikhail for your great efforts! Большое спасибо, Михаил! One thing bothers me though, there haven't been any recent updates on the channel. I'm pretty sure, all the people here will appreciate and support if Mikhail decides to continue his endeavours and uploads new videos! Anyway, thanks a lot!
Appreciate your efforts on aggregating and delivering such quality content in such a lucid manner. I don't think there is better content than this anywhere on youtube especially for system design topics. Wow ! (Y)
I almost never comment on RUclips but this undoubtedly deserves an exception. Thank you for the superb quality content you’ve put together. I wouldn’t be surprised if this series becomes the de facto video resource for systems design and architecture interviews. Hope you keep uploading!
this is the best video for systems design I've ever watched. I listened to it at 50% speed to write down every word whereas I usually watch YT vids at 1.5x -- each sentence was invaluable.
13:17 Strictly speaking, using a database as a backend message store is a valid option (because database = storage engine + high level type system). The problem is that FIFO message ordering semantics, that is usually expected from queues, is not easily achievable on the top of off-the-shelf databases. Because the latter are usually designed for a different query/update patterns than it's common for queues. But some databases can handle this custom case perfectly, and some queues (Kafka) are even positioning themselves as a databases.
can't thank you enough for this video. All of these components are building blocks and the interviewer can dig deep as to how the requests are handled from client to server. Awesome video
I don't think any other youtube video on System Design goes this deep into explaination. Thanks for your efforts in bringing these videos to all of us.
Thank you for summarizing precisely about what can be covered in a 40 minute time limit. Knowledge is one part which is built over learning and experience. Your video really helps to focus on structuring and expressing the knowledge in a coherent manner. Thank you.
Mikhail is the best. His system design videos are systematic and top notch with respect to quality and crispness. Presenting how to finish a complete design in 35 to 40 mins Wow, this is a great feat and only way for us. Prior to watching these videos my ideas and presentation is messy and dis-organized, but these videos gave me the basic sense what is expected in System Design and how to approach it. I take down the notes while watching the videos and try to apply these principles to other interview questions. This is greatly helping with my preparation. Can't thank you enough Mikhail, you are one of my best teachers.
These videos are best resource among all I have gone through. I am surprised, why this channel is not posting any more videos. Good Work and thank you !
5:10 load balancer availability/single point of failure, can assign multiple A DNS records for our domain (multiple IPS ) when we want multiple load balancers 8:00 usd cases for frontend service 9:15 request deduplocation to achieve exactly once or at most once semantics (the ack response could be lost when sending back to user, so user will retry and we don’t want to process duplicate requests that we already housed) 12:00 reusable components for other system designs
I have seen a bunch of youtubers for system design interview...this one is one of the better ones...good way of using graphics while talking instead of mundane approach of heavy talking and using a whiteboard....Great job buddy...I am gonna explore all your video now
Summary(notes): 1. Problem statement: Producer sends data and exactly one of the consumers gets the data 2. Resolving ambiguity in the problem statement by asking questions such as scale, priority, and so on... 3. Just focus on the core set of requirements - sendMessage(messageBody), receiveMessage() 4. SLA numbers for the non-functional requirements 5. Components: LB, Control Plane(Metadata-Service), Data Plane-1(Frontend), Data Plane-2(Back-end) 6. FE: Required Cross cutting concerns such as billing, throttling, the most important - routing to Backend since the Backend is stateful and so on. 7. Metadata Service: Caching Layer for routing information and metadata ( high consistency required in case of very few writes, R/W Ratio) 8. Backend Service: API Handling Layer, Storage and so on. Since Backend has to be HA and fault tolerant as it requires a consensus service like ZooKeeper or In-Cluster and Out-Cluster management strategy. ---- Extend the above design of queue creation with queue deletion, message deletion, message replication, delivery semantics( exactly once delivery not supported because it requires 2PC) and Pull vs Push messages, security and monitoring. --- Scalability Bottlenecks, use-case exntensability and use-case supported/limitations?
It is full of quality content, It took me around 2-3 hours to completely watch along with preparing notes for this video. And 9 pages of notes it is, initially I thought it would be in 3-4 pages only. It's full of rich content, that I had to note everything down. Thank you. I am looking for a better way to prepare for System Design questions. With this speed, I am not sure how much time It will take for me.
Hi Mukesh. You are right, preparation for a system design interview is a lengthy process. And it greatly depends on the level you plan to apply and your background. Just take one step at a time. First, try to learn about concepts without going too deep into each one of them. Otherwise, you will find yourself traversing a very deep graph of various interconnected concepts. Second, go deeper with every next iteration, if time allows. Third, use your daily work as a constant source of knowledge. Ask yourself how things in your project/application work. And do not stop asking yourself until you get a pretty solid understanding of a particular feature. It is a big and a very good question you've raised. I should, probably, create a video on how to prepare, depending on how much time one's have.
I bought your course. Arguably the best investment I made for system design courses so far. Thanks for putting together contents and explaining them so lucidly. I look forward to other two modules.
This is the best distributed message queue system design I have seen so far. Many good concepts introduced and summarized , I feel it very helpful by using it as a guideline and read the other documents for more details such as the AWS SQS document. Looking forward to more content in the future.
I have been following some system design channels on youtube and this one is by far the best. Well structured, it discusses tradeoffs, solutions are clear.... In one word, AWESOME! Thank you very much.
17:08 to clarify option 2, queues are basically each a cluster in this case(each cluster contains a set of queues). Instances are the replications. Interestingly replication for inmemory hosts/instances are handled similarly to nosql nodes
Hi Reyaz, you can use inbuilt feature for subtitles provided by RUclips player. Click on the icon labelled with cc while playing the video. hope it helps until Mikhail provides the subtitles. Thanks
Really comprehensive coverage of the topic! Although, would've loved to see more discussion on Asynchronous out-cluster replication. It's tricky to design, eg. what happens when you receive a get request while the data hasn't fully replicated across hosts in a cluster? can we hit all hosts in a cluster? what happens if we receive a get request when the message deletion replication is in progress etc.
This is pure GEM!.. Amazing crystal clear explanation on Distributed computing concepts. Best tutorial till date on whole of youtube for system design prep material... Great work
Great content! Thank you for making this. One thing that seems not clear (at least to me) ~min15-min17 you show the flow of the message from FE to backend node and to receiver. It is unclear how do you separate persisted information between MS (database) and in-cluster manager (ZooKeeper). Both seems to store mapping between Queue name and Leader Host. Do you really need to store this information in two places? How are they synchronized? Why would you need to keep this info in the MS in the first place? Isn't ZooKeeper enough for queue-to-node mapping?
Both options are fine: 1. When we store mapping in the Metadata service. Zookeeper is used for leader election and leader monitoring. And if leader changes, this information is propagated to the Metadata service. 2. When we store mapping in Zookeeper. Zookeeper is highly optimized for reads. Anyway, this information is stored in one place. So that we avoid any synchronization between configuration storages and have a single source of truth.
This video is great quality. I think sequential writes should have been suggested in the video. This seems to me the best way to achieve high throughput.
Great content! I have some confusion regarding the queue identification. 1. In the API definition, we are only sending the message, so when the first-ever message comes, how is that message getting mapped to a queue number? For example in the slides it says a sendMessage(msg) comes for queue id =1, how does the sender know about the queue id? Similarly, when the receiveMessage() API is called, how does the receiver know which queue to get the message from, secondly there are several messages in the queue, so how do we know which message it wants to receive, and how are we deciding? Let's say., when the first message comes around, the backend stores the data and takes care of replication, then writes the mapping in the DB. But how is this information being propagated to the receiver, that wants the message, how do they get to know about the queue id? 2. In the table shown for in-cluster management, for qid 1, the leader is A and followers are C, B. But if the queue is distributed over nodes, then how are we just having one leader node as A? Doesn't that mean we are storing the entire queue 1 in A, and the copies in the followers?
1a. Message should contain QueueId. 1b. API should be queue.ReceiveMessage() ; Queue object knows about queue_id and sends in either every poll request or is tied to tcp/grpc/websocket connection. 1c. Messages are received from queue in kind of FIFO order. So, client sends last Message id or Sequence Number and server sends SequenceNumber+1 th message. 1d. Client knows queue name and that should be able to give them queue id. It can be either hash of "queue_name" Or they ping Frontend service to get QueueId for a QueueName. 2. A distributed queue does not mean partial data on different nodes. It means full copy of data on all nodes. One of the node can only currently write -- this node is called Primary node. This is done so that even if one machine goes down for ever, full copy of data is available in other machines. This gives high availability/durability in case of failures.
Thanks allot @Mikhail. Your videos are so fun and easy to watch. I feel it's one of the best specifically for system design and you sound like some Russian Pro coder to top it;) I request you to make a video about all the possible components (load balancers, CDN, etc) in a system design interview that will ever be used, because you keep using few different components for different problems. If we get to know all the components, then we too can arrive at a better solution. Thanks for the great content and keep creating new videos! 👍
Thank you for the kind words, Chirag! I have been thinking about the same for a while. And there are ideas how to address this. Just need to find more spare time to realize all these ideas ((
Your videos are Superb ! Most useful videos on System design. Please start making more videos like this ! More on each component details which helps in System design :) !
Thank you for all the hard work and such a great explanation of complicated topics. This is way superior to other paid content. I would love to see video on API design that covers how and what. For example, question that say design an API to upload photos from iOS, how do you go about it? What are the good characteristics of an API? What are key components you need to think about while designing an API and so on.
Just awesome ! Your approach to problem solving is very generic. Really liked it and keep posting such fantastic system design interview questions. This is the best material i have seen till date on the topic. Thanks a lot.
Thanks a lot for your videos! Very helpful! I wonder if it's possible for you to have a mock interview video (e.g. you're on the interviewee side), covering things like what tools/apps would you use for real-world SDIs for better productivity, etc.
Thank you so much for your videos. I have watched all videos in your channel. Waiting for your distributed database video. Hopefully you are still running this channel
Regarding how the front end service finds the leader backend nodes, you mention that this discovery would be done via metadata service. But in the in-cluster method, we actually have that information in the coordinator service (zookeeper). In this case, would the metadata service just be a thin wrapper for the coordinator service (in case of backend node discovery)? Thank you so much for sharing these videos Mikhail. (Also, I love that you mention several times that the interviewer is there to help us, I find it delightful to have that perspective, and definitely helps during the interview)
Hi Suharto, Thank you very much for the feedback! Regarding your question, we can use either Metadata service or Zookeeper itself for storing and retrieving information about leaders. Please take a look at my answer here: ruclips.net/video/iJLL-KPqBpM/видео.html&lc=UgxAE6YfMUj95phbLid4AaABAg.90QChp-3ylO93AokcEr3Bu
Why this Guys is not giving more videos. We should in fact invest some money from our pockets and pay him to make such kind of videos rather than spending money individually on some courses.
Hi Dharmendra. I am working on a new video right now. I took a big topic this time. Plus, was on vacation for a couple of weeks. So, a little bit behind. Hopefully, you will like the upcoming video. It covers many concepts required for a successful system design interview and system design in general.
Great content: 1. How will backend store files in local file system? - can you shed some light how will they maintain order. How will replicas sync on the order of the messages they sent. 2. How will Delete calls sync on a file a system. 3. Even using database if we store queueName-> messageId as the key, retrieving records in order might be slow and hard. If each queue is served by a single host, it can update which messages are sent to a client by writing some field in the database record(may be batch update).Retrieve more message from the table but the query might be a scan query, I am not sure which no sql can provide such kind of query quickly. Dynamodb can have queueUrl as partition and messageId as sort key and it can return sorted messge ids. But the throughput might be limited as a single host is serving all requests. How will multiple host serving the messages from the queue can handle the ordering?
Hi Amey, Many good questions. A good answer will require a video on its own. Let me share only some ideas. 1. Please check this thread: ruclips.net/video/iJLL-KPqBpM/видео.html&lc=UgxvWvctwx7ZvfFisMR4AaABAg.93RPUNm8kUx93p9DlWifqg And this one, for message ordering: ruclips.net/video/iJLL-KPqBpM/видео.html&lc=UgxxrP7-xc81hs98frV4AaABAg.8x222vilo4H8xENn5UVXaR 2. It depends on the storage mechanism we use. E.g. in Kafka, deletes are not happening immediately. Only when the whole segment (file) with messages is processed, it is deleted. Many embedded databases use the similar approach. When record is marked as deleted (a tombstone record). And the actual deletion is happening later, e.g. during a log compaction process. 3. You are correct, we should not expect high throughput for a messaging system that relies on an external database. As mentioned before, we should store messages locally, on disk. Using, for example, our own solution based on append-only log files. Or an embedded database (e.g. RocksDB). Database can be used for a small scale though. In such cases, we can maintain order using some simple technique, e.g. timestamps.
Awesome video. The only thing that was a bit confusing for me was the part about in-cluster manager (zookeeper) - It wasn't clear if zookeeper is in fact the Metadata service or an additional component (along side MS).
Hi Michael. Thanks a lot for the feedback! Here I left my view on why separation for out-cluster manager approach (multiple clusters) makes sense: ruclips.net/video/iJLL-KPqBpM/видео.html&lc=UgwD2gh8ozvKz1wMqId4AaABAg.99gLjSiA1G79BLjjputJT6 For the in-cluster manager approach, we can indeed use a single component. And the way Kafka uses Zookeeper proves this. As Zookeeper is "especially fast in "read-dominant" workloads." (from the official Zookeeper site). Although, I still prefer to separate these components for the in-cluster approach as well. There are many arguments in favor of one approach or another.
Thank you for great quality content. Excellent explanation, I can't miss single word. Why the series is stopped? Any other resources would you recommend?
In the backend storage design, Option B, one node in the pool of the backend hosts is responsible for distributing messages to other hosts in the pool. The downside with this approach as I see is that the client(sender Front end) has little idea about how many hosts the message is actually distributed to. What happens if the receive call selects a host which does not have the message? Wouldnt it make more sense to have a quorum based read and write approach at the front end service layer. Where it sends a send request to x hosts and wait for x acknowledgments and receive request is sent to y hosts and wait for y responses. As long as x+y > total hosts in the pool a consistent read is guaranteed. Of course this is assuming consistent reads are needed and strict ordering is needed which adds to latency. Also a little unclear on the role of metadata service here? Specifically what information does it store if there is another out cluster manager for hosting information about queue to cluster mapping.
Great video, thanks for doing these. Can you please explain why we need a FE component? Initially I thought it was to design a distributed message queue, the ones used by the backend services, like the one that you had drawn in your other video: System Design Interview: Step by Step Guide. Or is this a question about how to design a chat appication? And then my last question is, can we combine VIP with load balancer into one component, the API gateway? Thanks!
Really great content. I have one doubt. In the out cluster management option, let's say we split each queue into multiple partition across multiple clusters, and each partition is being handled by separate clusters with replication of data in all the nodes inside the cluster. What if an entire cluster goes down? How will we ensure durability of the message belongs to the partitions managed by that cluster.. Please help me to resolve the doubt.
Excellent descriptions and problem solving. Please share more. One thing: about TLS termination I don't think it's a common practice to be done on service instance. It's usually done on LB. For example AWS LBs can be configured to be TLS terminators. Would you be able to elaborate more? Thanks
Thanks for the great content. Can you please talk about which choice of architecture (1, 2 or 3) you would make for the Metadata Service? And why? And please explain your comment that the datastore for MS does not need to be strongly consistent?
Great video, very in depth I have a question concerning option b for the backend service architecture (Small cluster of independent hosts) The frontend calls the meta service to find out the instance responsible for the queue yet calls a random instance. If it’s going to call a random instance why call the meta service?
Hi Mikhail, Others Not sure whether you will see this or not, but wanted to ask one thing. If I try to design gmail using a similar architecture outlined above then 1. Whether the Metadata server will store time, sender, size etc? While the backend store will store the actual mail? 2. Can the MD Server( No SQL with a Cache/façade in front) organized in a consistent hash ring using the User name( through hash) as primary key? 3. If 2 is correct how do I display the most recent mails? Seems I need to sort the data stored in a node, when to do it? Where and how to store it? 4. If I sort based on time and store in a distributed cache and then I want to sort by size how can I do it, Will the Frontend Service help on this? Does No SQL allows this kind of queries? 5. How will I know Which Backend Storage store the mail? Is there a mapping exists between MD server and Backend Cluster? Many thanks in advance.
Great video. 👍 Towards the end, the summarization felt rushed while answering whether the service is fault-tolerant, scalable..While answering such questions, it might be helpful to highlight how the system would cope to say a network partition, how would the backend hosts receiving the message save/receive requests respond to those queries?
Thanks for the great video. Just a question below: If we have multiple consumers, say, application deployed in a cluster and assuming consumers poll for new messages, how do we ensure that only one instance of them gets the message? Do we need to have some distributed lock on the message so that only one consumer would get it?
Hi Chandra, In case of a pull-based consumer (like the one described in the video) we indeed need a mechanism to "lock" a message. So that it is not available for other consumers. One option is to do something similar to what AWS SQS does: docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-visibility-timeout.html We could have also implement a push-based mechanism, when queue service itself is responsible for sending a message to one of the subscribed consumers (please check a video about Notification Service, similar idea is described there but for pub/sub use case, not a queue). In this scenario queue ensures that only one consumer gets the message by sending it to a single consumer from the list (e.g. using round-robin algorithm). Please let me know if more details are needed.
15:20 why was leader-follower option A? Why not use a loadbalancer? Why not use sharding to pick a queue, or have all machines be equal nodes, and pick a random one? Summary of option A and B: A uses leader to cleanup and replication B instances are equal, but still need something to handling of each instance
What will be the most suitable database for metadata service? Also, while summarizing the design at the end, why did you not include zookeeper in the block diagram? We are gonna use zookeeper as the out-cluster manager right?
Great video! Thanks for uploading it. I have a question about the replication piece. Once an item is popped off the queue in the leaderless, how do we ensure consistency? Is there some sort of quorum that has to happen to avoid another pop request coming to another cluster?
This design really reminded me of the Google file system. The metadata service + out-cluster manager is analogous to GFS's master server. The backend storage hosts are analogous to GFS's chunk servers. How replication is handled is like GFS. Just shows how these design principles are universal.
Thank you so much.. I've an upcoming interview in couple of weeks and I'm totally confused from where to learn System Design. I came to your videos and now I'm thinking to listen to your videos multiple times so that this content fits in my brain. I've one question. Shouldn't Metadata Service and Metadata DB be connected to Backend rather than Frontend? Also, apprepreciate if you can upload few more top design interview videos like Design Whatsapp/Netflix etc. Also, I really like the idea if you can do mock interviews and upload so that we can learn from the mistakes.
Hi Abhishek. Thank you for the feedback! Much appreciated! First of all, let me start by wishing you luck at your interviews. Second, please read the following thread, it should provide more understanding about Metadata service purpose: ruclips.net/video/iJLL-KPqBpM/видео.html&lc=UgwNZ5mE3o8fFV_yY214AaABAg.8zdMxmBN3of9-4ktitHhKv Third, I have topics you mentioned in my TODO list. And yes, mock interviews sounds like a great idea. My only problem is to find time for all this ))
Hi Granzortv, We have two main options for the message storage: embedded database (en.wikipedia.org/wiki/Embedded_database) and a local file system of the backend server machine. Different message brokers use embedded databases as a message storage. For example, older versions of ActiveMQ used LevelDB. Currently, KahaDB is the primary option (activemq.apache.org/leveldb-store). RabbitMQ has its own key-value store implemented. On the other hand, streaming platforms (e.g. Kafka) mostly use file system as a storage. In the form of the append-only log files. With several optimization techniques (batching of messages, sequential writes and reads, zero-copy) high performance can be achieved. It is easier to implement FIFO support using append-only logs approach.
This was the first video I'd seen from this channel. This is some next-level system design content. Way more in-depth than other videos I've seen. Unfortunately, it doesn't look like there have been any recent uploads, which is really too bad.
Yeah! But the content is so dense! I mean it more than enough
Normally I play videos in 1.5x or 2x. Your videos have so much information that I am afraid of losing some fundamentals if I play in 2x. Outstanding quality. Please keep making such videos.
Thank you, Debasish. Really appreciate the feedback!
This is absolutely the best content on RUclips on the system design topic! No "scratching the surface" bullshit, but rather very in-depth and concrete explanation on how to navigate successfully through the system design interviews. Thank you Mikhail for your great efforts! Большое спасибо, Михаил! One thing bothers me though, there haven't been any recent updates on the channel. I'm pretty sure, all the people here will appreciate and support if Mikhail decides to continue his endeavours and uploads new videos! Anyway, thanks a lot!
Appreciate your efforts on aggregating and delivering such quality content in such a lucid manner. I don't think there is better content than this anywhere on youtube especially for system design topics. Wow ! (Y)
Thank you, Aditya. Appreciate your kind words.
@Jordan Apollo SPAM Alert
Totally agree, top quality content
I almost never comment on RUclips but this undoubtedly deserves an exception. Thank you for the superb quality content you’ve put together. I wouldn’t be surprised if this series becomes the de facto video resource for systems design and architecture interviews. Hope you keep uploading!
Thank you, Johan, for all the kind words! More videos to come.
this is the best video for systems design I've ever watched. I listened to it at 50% speed to write down every word whereas I usually watch YT vids at 1.5x -- each sentence was invaluable.
Each word in this video is a golden word. Make sure you don't skip or neglect it. Thank you so much
13:17 Strictly speaking, using a database as a backend message store is a valid option (because database = storage engine + high level type system). The problem is that FIFO message ordering semantics, that is usually expected from queues, is not easily achievable on the top of off-the-shelf databases. Because the latter are usually designed for a different query/update patterns than it's common for queues. But some databases can handle this custom case perfectly, and some queues (Kafka) are even positioning themselves as a databases.
mysql auto increment id could be an option to implement FIFO queue. Queue name could be a secondary index, and auto increment id is a primary key.
can't thank you enough for this video. All of these components are building blocks and the interviewer can dig deep as to how the requests are handled from client to server. Awesome video
I don't think any other youtube video on System Design goes this deep into explaination. Thanks for your efforts in bringing these videos to all of us.
This is the best content on system design I've ever seen. Please consider resuming the journey! We'd love to ride along!
Thank you for summarizing precisely about what can be covered in a 40 minute time limit. Knowledge is one part which is built over learning and experience. Your video really helps to focus on structuring and expressing the knowledge in a coherent manner. Thank you.
Mikhail is the best. His system design videos are systematic and top notch with respect to quality and crispness. Presenting how to finish a complete design in 35 to 40 mins Wow, this is a great feat and only way for us. Prior to watching these videos my ideas and presentation is messy and dis-organized, but these videos gave me the basic sense what is expected in System Design and how to approach it. I take down the notes while watching the videos and try to apply these principles to other interview questions. This is greatly helping with my preparation. Can't thank you enough Mikhail, you are one of my best teachers.
Glad to hear that, thunrou! Thanks for sharing!
I wish this guy was still making these videos. By far the best of the system design interview content out there (I've watched them all, lol).
These videos are best resource among all I have gone through. I am surprised, why this channel is not posting any more videos. Good Work and thank you !
5:10 load balancer availability/single point of failure, can assign multiple A DNS records for our domain (multiple IPS
) when we want multiple load balancers
8:00 usd cases for frontend service
9:15 request deduplocation to achieve exactly once or at most once semantics (the ack response could be lost when sending back to user, so user will retry and we don’t want to process duplicate requests that we already housed)
12:00 reusable components for other system designs
I've watched the whole series already, thanks for the great quality content! looking forward for more
Thank you Dragoon77! Working on more videos.
wow! This is so to the point and even the duration of the video is as good as an actual interview discussion! Touched so many "must know" topics!
I have seen a bunch of youtubers for system design interview...this one is one of the better ones...good way of using graphics while talking instead of mundane approach of heavy talking and using a whiteboard....Great job buddy...I am gonna explore all your video now
This is more just Distributed MQ. The video covers the fundamental approaches in modern data intensive distributed systems.
Hi Ivan. Thank you for the feedback!
Summary(notes):
1. Problem statement: Producer sends data and exactly one of the consumers gets the data
2. Resolving ambiguity in the problem statement by asking questions such as scale, priority, and so on...
3. Just focus on the core set of requirements - sendMessage(messageBody), receiveMessage()
4. SLA numbers for the non-functional requirements
5. Components: LB, Control Plane(Metadata-Service), Data Plane-1(Frontend), Data Plane-2(Back-end)
6. FE: Required Cross cutting concerns such as billing, throttling, the most important - routing to Backend since the Backend is stateful and so on.
7. Metadata Service: Caching Layer for routing information and metadata ( high consistency required in case of very few writes, R/W Ratio)
8. Backend Service: API Handling Layer, Storage and so on. Since Backend has to be HA and fault tolerant as it requires a consensus service like ZooKeeper or In-Cluster and Out-Cluster management strategy.
----
Extend the above design of queue creation with queue deletion, message deletion, message replication, delivery semantics( exactly once delivery not supported because it requires 2PC) and Pull vs Push messages, security and monitoring.
---
Scalability Bottlenecks, use-case exntensability and use-case supported/limitations?
Hi Mitesh. Concise and still captures the key ideas. Great summary.
I love the way you dive in every component one by one.
Thank you for the feedback, Pramod!
It is full of quality content, It took me around 2-3 hours to completely watch along with preparing notes for this video. And 9 pages of notes it is, initially I thought it would be in 3-4 pages only. It's full of rich content, that I had to note everything down. Thank you. I am looking for a better way to prepare for System Design questions. With this speed, I am not sure how much time It will take for me.
Hi Mukesh. You are right, preparation for a system design interview is a lengthy process. And it greatly depends on the level you plan to apply and your background.
Just take one step at a time. First, try to learn about concepts without going too deep into each one of them. Otherwise, you will find yourself traversing a very deep graph of various interconnected concepts. Second, go deeper with every next iteration, if time allows. Third, use your daily work as a constant source of knowledge. Ask yourself how things in your project/application work. And do not stop asking yourself until you get a pretty solid understanding of a particular feature.
It is a big and a very good question you've raised. I should, probably, create a video on how to prepare, depending on how much time one's have.
@@SystemDesignInterview Thank you so much, Mikhail. I will follow these tips. Really informative.
I bought your course. Arguably the best investment I made for system design courses so far. Thanks for putting together contents and explaining them so lucidly. I look forward to other two modules.
the course isn't available for new users :(
where is the course link?
This is the best distributed message queue system design I have seen so far. Many good concepts introduced and summarized , I feel it very helpful by using it as a guideline and read the other documents for more details such as the AWS SQS document. Looking forward to more content in the future.
Hi Jianan. Thank you a lot for the feedback!
I am expecting you write a SD book that gives us the same amount of useful information as here. outstanding job!
I have been following some system design channels on youtube and this one is by far the best. Well structured, it discusses tradeoffs, solutions are clear.... In one word, AWESOME! Thank you very much.
thank you for working on the subtitles, makes it easier to consume your good content
Sure, Rishabh! Thanks for letting me know that subtitles help. Every next video will have subtitles as well.
Thanks Mikhail. You have excellent english fluency. I am just used to different pronunciations of certain words.
17:08 to clarify option 2, queues are basically each a cluster in this case(each cluster contains a set of queues). Instances are the replications.
Interestingly replication for inmemory hosts/instances are handled similarly to nosql nodes
I can’t thank you enough, I was really struggling to grasp these topics and your explanations really helped me put it all together 🙏 excellent work!
Very thorough! Really appreciate your hard work. I can tell your channel will become huge for engineering resources.
Thank you, Hyunmin. Appreciate your feedback and words of encouragement!
Best course available on the Internet.
Great content. Thanks a lot. Just one feedback: Would have been great had there been subtitles as I find a bit difficult to get the words.
Hi Reyaz. Thank you for the feedback! Point taken, I will try to add subtitles relatively soon.
Hi Reyaz, you can use inbuilt feature for subtitles provided by RUclips player.
Click on the icon labelled with cc while playing the video.
hope it helps until Mikhail provides the subtitles.
Thanks
Just the right amount of detail. Surprised it has fewer views. Shows view count is not very reliable. Thank you for the great effort
Appreciate the feedback, Manju! Thanks.
The quality of the videos that you make are really make. Please continue making such videos.
Glad you liked it, Akshit. Thanks for sharing!
Thank you! This covers a lot of background. One thing i feel should have been covered how strict message ordering is achieved across partitions?
Really comprehensive coverage of the topic! Although, would've loved to see more discussion on Asynchronous out-cluster replication. It's tricky to design, eg. what happens when you receive a get request while the data hasn't fully replicated across hosts in a cluster? can we hit all hosts in a cluster? what happens if we receive a get request when the message deletion replication is in progress etc.
Hands down best System Design Channel on youtube. I cannot wait for more videos!
Thank you, Niko, for the feedback. Much appreciated! Working on a new video right now.
This is by far the best curated content on system design
Wish I had come here before . Keep up the good work
Hi Pratik. Thank you for the feedback. And welcome to the channel!
This is pure GEM!.. Amazing crystal clear explanation on Distributed computing concepts. Best tutorial till date on whole of youtube for system design prep material... Great work
Great content! Thank you for making this. One thing that seems not clear (at least to me) ~min15-min17 you show the flow of the message from FE to backend node and to receiver. It is unclear how do you separate persisted information between MS (database) and in-cluster manager (ZooKeeper). Both seems to store mapping between Queue name and Leader Host. Do you really need to store this information in two places? How are they synchronized? Why would you need to keep this info in the MS in the first place? Isn't ZooKeeper enough for queue-to-node mapping?
Both options are fine:
1. When we store mapping in the Metadata service. Zookeeper is used for leader election and leader monitoring. And if leader changes, this information is propagated to the Metadata service.
2. When we store mapping in Zookeeper. Zookeeper is highly optimized for reads.
Anyway, this information is stored in one place. So that we avoid any synchronization between configuration storages and have a single source of truth.
@@SystemDesignInterview Thank you for answering this question. I had the same doubt when going through the material.
This video is great quality. I think sequential writes should have been suggested in the video. This seems to me the best way to achieve high throughput.
Very helpful! Another super effective way to prepare system design interviews: Do mock interviews with FAANG engineers at Meetapro.
Great content! I have some confusion regarding the queue identification.
1. In the API definition, we are only sending the message, so when the first-ever message comes, how is that message getting mapped to a queue number? For example in the slides it says a sendMessage(msg) comes for queue id =1, how does the sender know about the queue id? Similarly, when the receiveMessage() API is called, how does the receiver know which queue to get the message from, secondly there are several messages in the queue, so how do we know which message it wants to receive, and how are we deciding?
Let's say., when the first message comes around, the backend stores the data and takes care of replication, then writes the mapping in the DB. But how is this information being propagated to the receiver, that wants the message, how do they get to know about the queue id?
2. In the table shown for in-cluster management, for qid 1, the leader is A and followers are C, B. But if the queue is distributed over nodes, then how are we just having one leader node as A? Doesn't that mean we are storing the entire queue 1 in A, and the copies in the followers?
1a. Message should contain QueueId.
1b. API should be queue.ReceiveMessage() ; Queue object knows about queue_id and sends in either every poll request or is tied to tcp/grpc/websocket connection.
1c. Messages are received from queue in kind of FIFO order. So, client sends last Message id or Sequence Number and server sends SequenceNumber+1 th message.
1d. Client knows queue name and that should be able to give them queue id. It can be either hash of "queue_name" Or they ping Frontend service to get QueueId for a QueueName.
2. A distributed queue does not mean partial data on different nodes. It means full copy of data on all nodes. One of the node can only currently write -- this node is called Primary node. This is done so that even if one machine goes down for ever, full copy of data is available in other machines. This gives high availability/durability in case of failures.
Thanks allot @Mikhail. Your videos are so fun and easy to watch. I feel it's one of the best specifically for system design and you sound like some Russian Pro coder to top it;) I request you to make a video about all the possible components (load balancers, CDN, etc) in a system design interview that will ever be used, because you keep using few different components for different problems. If we get to know all the components, then we too can arrive at a better solution. Thanks for the great content and keep creating new videos! 👍
Thank you for the kind words, Chirag! I have been thinking about the same for a while. And there are ideas how to address this. Just need to find more spare time to realize all these ideas ((
Your videos are Superb !
Most useful videos on System design.
Please start making more videos like this !
More on each component details which helps in System design :) !
Hi Mikhail, excellent video on the system design course series. Very nicely presented & explained.
One of the best channel.
Thank you, Harsh, for the kind words! And for being active on the channel (actively commenting)! Much appreciated.
Thank you for all the hard work and such a great explanation of complicated topics. This is way superior to other paid content. I would love to see video on API design that covers how and what. For example, question that say design an API to upload photos from iOS, how do you go about it?
What are the good characteristics of an API? What are key components you need to think about while designing an API and so on.
Amazing video series that goes beyond high level fluff, thank you so much!
Just awesome ! Your approach to problem solving is very generic. Really liked it and keep posting such fantastic system design interview questions. This is the best material i have seen till date on the topic.
Thanks a lot.
Thank you for the feedback, Yash!
Thanks a lot for your videos! Very helpful!
I wonder if it's possible for you to have a mock interview video (e.g. you're on the interviewee side), covering things like what tools/apps would you use for real-world SDIs for better productivity, etc.
Great work and Explanation . Thanks a lot. This is the best explanation and walk through to prepare for a System design interview.
Glad you liked it, Swapnil! Thanks for the feedback!
Please keep uploading! This is great! Thanks
Sure, we will. Thank you!
It would be helpful if you also give a brief intro to RabbitMQ, Kafka and Kinesis/SQS. You talked about SQS briefly, that was really appreciative!
Hi Yetesh. Sounds like a topic of its own. Let me add this to the TODO list.
Thank you so much for your videos. I have watched all videos in your channel. Waiting for your distributed database video. Hopefully you are still running this channel
Thanks for the video, had one suggestion on rate limiting. Token bucket is widely used and not leaky bucket.
Regarding how the front end service finds the leader backend nodes, you mention that this discovery would be done via metadata service. But in the in-cluster method, we actually have that information in the coordinator service (zookeeper). In this case, would the metadata service just be a thin wrapper for the coordinator service (in case of backend node discovery)?
Thank you so much for sharing these videos Mikhail. (Also, I love that you mention several times that the interviewer is there to help us, I find it delightful to have that perspective, and definitely helps during the interview)
Hi Suharto,
Thank you very much for the feedback!
Regarding your question, we can use either Metadata service or Zookeeper itself for storing and retrieving information about leaders. Please take a look at my answer here: ruclips.net/video/iJLL-KPqBpM/видео.html&lc=UgxAE6YfMUj95phbLid4AaABAg.90QChp-3ylO93AokcEr3Bu
This is quality content. Really appreciate your efforts.
Very good content. Enjoyed going through the video. Thank you. Hope you continue this series
Finally finished going through your videos. Thanks so much!
Just awesome...your approach to solving a system design is amazing. Great content. Thank a lot for your efforts.
Thank you, Ankit, for the feedback! Glad you liked the video!
Brilliant content! Please start uploading again!
For monitoring, it’s be helpful to monitor size of the queue. Also number of messages getting queued or dequeued for each host at the queue level.
Good points!
Why this Guys is not giving more videos. We should in fact invest some money from our pockets and pay him to make such kind of videos rather than spending money individually on some courses.
Hi Dharmendra. I am working on a new video right now. I took a big topic this time. Plus, was on vacation for a couple of weeks. So, a little bit behind. Hopefully, you will like the upcoming video. It covers many concepts required for a successful system design interview and system design in general.
One of the best system Design video I have watched, Awaiting more videos.
More to come! Thank you, Rahul. Appreciate the kind words.
Great content:
1. How will backend store files in local file system? - can you shed some light how will they maintain order. How will replicas sync on the order of the messages they sent.
2. How will Delete calls sync on a file a system.
3. Even using database if we store queueName-> messageId as the key, retrieving records in order might be slow and hard. If each queue is served by a single host, it can update which messages are sent to a client by writing some field in the database record(may be batch update).Retrieve more message from the table but the query might be a scan query, I am not sure which no sql can provide such kind of query quickly. Dynamodb can have queueUrl as partition and messageId as sort key and it can return sorted messge ids. But the throughput might be limited as a single host is serving all requests. How will multiple host serving the messages from the queue can handle the ordering?
Hi Amey,
Many good questions. A good answer will require a video on its own. Let me share only some ideas.
1. Please check this thread: ruclips.net/video/iJLL-KPqBpM/видео.html&lc=UgxvWvctwx7ZvfFisMR4AaABAg.93RPUNm8kUx93p9DlWifqg
And this one, for message ordering: ruclips.net/video/iJLL-KPqBpM/видео.html&lc=UgxxrP7-xc81hs98frV4AaABAg.8x222vilo4H8xENn5UVXaR
2. It depends on the storage mechanism we use. E.g. in Kafka, deletes are not happening immediately. Only when the whole segment (file) with messages is processed, it is deleted. Many embedded databases use the similar approach. When record is marked as deleted (a tombstone record). And the actual deletion is happening later, e.g. during a log compaction process.
3. You are correct, we should not expect high throughput for a messaging system that relies on an external database. As mentioned before, we should store messages locally, on disk. Using, for example, our own solution based on append-only log files. Or an embedded database (e.g. RocksDB).
Database can be used for a small scale though. In such cases, we can maintain order using some simple technique, e.g. timestamps.
This is excellent! Looking for more such videos.
Thank you. We are working on more videos. Feel free to subscribe to stay tuned.
Great video, but I think it should cover even more low-level details on how messages are stored in memory and retrieved using offset/invisible flag.
Awesome video. The only thing that was a bit confusing for me was the part about in-cluster manager (zookeeper) - It wasn't clear if zookeeper is in fact the Metadata service or an additional component (along side MS).
Yeah I was confused too. I posted a comment below, happy to discuss more.
Hi Michael. Thanks a lot for the feedback!
Here I left my view on why separation for out-cluster manager approach (multiple clusters) makes sense: ruclips.net/video/iJLL-KPqBpM/видео.html&lc=UgwD2gh8ozvKz1wMqId4AaABAg.99gLjSiA1G79BLjjputJT6
For the in-cluster manager approach, we can indeed use a single component. And the way Kafka uses Zookeeper proves this. As Zookeeper is "especially fast in "read-dominant" workloads." (from the official Zookeeper site).
Although, I still prefer to separate these components for the in-cluster approach as well. There are many arguments in favor of one approach or another.
Thank you for great quality content. Excellent explanation, I can't miss single word.
Why the series is stopped? Any other resources would you recommend?
Reall enjoy the video, I wish I could upvote multiple times. One thing missing is how to persist message into file system.
Hey Jordan
It’s almost 2 years we are waiting for your videos. I hope you’re fine?
best system design video I had watched.
Glad to know that!
In the backend storage design, Option B, one node in the pool of the backend hosts is responsible for distributing messages to other hosts in the pool. The downside with this approach as I see is that the client(sender Front end) has little idea about how many hosts the message is actually distributed to. What happens if the receive call selects a host which does not have the message? Wouldnt it make more sense to have a quorum based read and write approach at the front end service layer. Where it sends a send request to x hosts and wait for x acknowledgments and receive request is sent to y hosts and wait for y responses. As long as x+y > total hosts in the pool a consistent read is guaranteed. Of course this is assuming consistent reads are needed and strict ordering is needed which adds to latency. Also a little unclear on the role of metadata service here? Specifically what information does it store if there is another out cluster manager for hosting information about queue to cluster mapping.
I guess it really depends on the semantics of the queue. Ex: Is FIFO guaranteed etc
16:21 Question: can FE talk to the in-cluster manager instead of MS to figure out which leader to talk to?
in-cluster or out-cluster needs to be behind a facade which MS.
Great video, thanks for doing these. Can you please explain why we need a FE component? Initially I thought it was to design a distributed message queue, the ones used by the backend services, like the one that you had drawn in your other video: System Design Interview: Step by Step Guide. Or is this a question about how to design a chat appication? And then my last question is, can we combine VIP with load balancer into one component, the API gateway? Thanks!
I have the same confusion. Don't know why the front-end is needed.
Really great content and well paced delivery. Waitiing for more content.
Really great content. I have one doubt. In the out cluster management option, let's say we split each queue into multiple partition across multiple clusters, and each partition is being handled by separate clusters with replication of data in all the nodes inside the cluster. What if an entire cluster goes down? How will we ensure durability of the message belongs to the partitions managed by that cluster.. Please help me to resolve the doubt.
Excellent descriptions and problem solving. Please share more.
One thing: about TLS termination I don't think it's a common practice to be done on service instance. It's usually done on LB. For example AWS LBs can be configured to be TLS terminators.
Would you be able to elaborate more?
Thanks
Thanks for the great content. Can you please talk about which choice of architecture (1, 2 or 3) you would make for the Metadata Service? And why? And please explain your comment that the datastore for MS does not need to be strongly consistent?
Wowww!!! These videos really helped me to prepare for my SD interview. Is there anything similar for ML System Design interviews?
Great video, very in depth
I have a question concerning option b for the backend service architecture (Small cluster of independent hosts)
The frontend calls the meta service to find out the instance responsible for the queue yet calls a random instance. If it’s going to call a random instance why call the meta service?
This is crisp and clear. Many thanks.
Thank you for the feedback.
Hi Mikhail, Others
Not sure whether you will see this or not, but wanted to ask one thing. If I try to design gmail using a similar architecture outlined above then
1. Whether the Metadata server will store time, sender, size etc? While the backend store will store the actual mail?
2. Can the MD Server( No SQL with a Cache/façade in front) organized in a consistent hash ring using the User name( through hash) as primary key?
3. If 2 is correct how do I display the most recent mails? Seems I need to sort the data stored in a node, when to do it? Where and how to store it?
4. If I sort based on time and store in a distributed cache and then I want to sort by size how can I do it, Will the Frontend Service help on this? Does No SQL allows this kind of queries?
5. How will I know Which Backend Storage store the mail? Is there a mapping exists between MD server and Backend Cluster?
Many thanks in advance.
Another direction this could go in is if you’re designing a distributed queue for N queues for single customer vs multi tenant.
Great video. 👍
Towards the end, the summarization felt rushed while answering whether the service is fault-tolerant, scalable..While answering such questions, it might be helpful to highlight how the system would cope to say a network partition, how would the backend hosts receiving the message save/receive requests respond to those queries?
Thanks for the great video. Just a question below:
If we have multiple consumers, say, application deployed in a cluster and assuming consumers poll for new messages, how do we ensure that only one instance of them gets the message? Do we need to have some distributed lock on the message so that only one consumer would get it?
Hi Chandra,
In case of a pull-based consumer (like the one described in the video) we indeed need a mechanism to "lock" a message. So that it is not available for other consumers. One option is to do something similar to what AWS SQS does: docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-visibility-timeout.html
We could have also implement a push-based mechanism, when queue service itself is responsible for sending a message to one of the subscribed consumers (please check a video about Notification Service, similar idea is described there but for pub/sub use case, not a queue). In this scenario queue ensures that only one consumer gets the message by sending it to a single consumer from the list (e.g. using round-robin algorithm).
Please let me know if more details are needed.
Please make more videos..ur videos are gem
15:20 why was leader-follower option A? Why not use a loadbalancer? Why not use sharding to pick a queue, or have all machines be equal nodes, and pick a random one?
Summary of option A and B:
A uses leader to cleanup and replication
B instances are equal, but still need something to handling of each instance
What will be the most suitable database for metadata service? Also, while summarizing the design at the end, why did you not include zookeeper in the block diagram? We are gonna use zookeeper as the out-cluster manager right?
Great video! Thanks for uploading it. I have a question about the replication piece. Once an item is popped off the queue in the leaderless, how do we ensure consistency? Is there some sort of quorum that has to happen to avoid another pop request coming to another cluster?
This design really reminded me of the Google file system.
The metadata service + out-cluster manager is analogous to GFS's master server.
The backend storage hosts are analogous to GFS's chunk servers.
How replication is handled is like GFS.
Just shows how these design principles are universal.
Hi James. Agree with you. Conceptually, there are many similarities.
any reason that we don't have more content uploaded here? is the author busy?
Please create more videos. Video was very helpful
Glad you liked it, Rahul. Thank you for the feedback! Sure, I will upload more.
Really great content. Please keep uploading more videos!
Thank you, Narain. I surely will.
Overall great video. Speaker is very knowledgeable.
Thank you, Chicken Tikka Sauce, for all your comments. To this and other videos. Much appreciated!
Thank you so much.. I've an upcoming interview in couple of weeks and I'm totally confused from where to learn System Design. I came to your videos and now I'm thinking to listen to your videos multiple times so that this content fits in my brain. I've one question. Shouldn't Metadata Service and Metadata DB be connected to Backend rather than Frontend? Also, apprepreciate if you can upload few more top design interview videos like Design Whatsapp/Netflix etc. Also, I really like the idea if you can do mock interviews and upload so that we can learn from the mistakes.
Hi Abhishek. Thank you for the feedback! Much appreciated!
First of all, let me start by wishing you luck at your interviews.
Second, please read the following thread, it should provide more understanding about Metadata service purpose: ruclips.net/video/iJLL-KPqBpM/видео.html&lc=UgwNZ5mE3o8fFV_yY214AaABAg.8zdMxmBN3of9-4ktitHhKv
Third, I have topics you mentioned in my TODO list. And yes, mock interviews sounds like a great idea. My only problem is to find time for all this ))
Could you please further explain how to achieve "Exactly Once"? Thanks!
Thanks for the great content.
Can you describe a bit around how backend stores information? Is it some sort of DB?
Hi Granzortv,
We have two main options for the message storage: embedded database (en.wikipedia.org/wiki/Embedded_database) and a local file system of the backend server machine.
Different message brokers use embedded databases as a message storage. For example, older versions of ActiveMQ used LevelDB. Currently, KahaDB is the primary option (activemq.apache.org/leveldb-store). RabbitMQ has its own key-value store implemented.
On the other hand, streaming platforms (e.g. Kafka) mostly use file system as a storage. In the form of the append-only log files. With several optimization techniques (batching of messages, sequential writes and reads, zero-copy) high performance can be achieved.
It is easier to implement FIFO support using append-only logs approach.
This is amazing, thank you so much! Very detailed explanation and exactly what I was looking for.