If you had to write a message queue, how architecture design ah?

Interview questions

If you had to write a message queue, how architecture design? Talk about your ideas.

Interviewer psychological analysis

In fact, talk to this question, the interviewer general to examine two:

Have you ever done a message queue for a more in-depth understanding of the principle, grasp or understand the whole message queue architecture principles. Look at your design capabilities, giving you a common system, is the message queue system, see if you can grasp the overall situation at the overall architecture design, some key points are given out. To be honest, when asked a similar question, most people are basically Mongolia, because usually never thought about a similar problem with most people is usually buried, I never want to think about some things behind. Similar problems, for example, if you make a Spring framework to design, how would you do? If you were to design a framework for Dubbo, how would you do? If you were to design a framework MyBatis how would you do?

Face questions analysis

In fact, to answer such questions, plainly, do not ask you seen the source code of that technology, at least you should probably know the basic principles of the technology, the core component, constitute the basic framework, and then refer to some of the open source technology to a system designed say something like thinking. For example, the message queue system, from our point of view about the following:

First of all the mq have to support scalability it is the rapid expansion when needed, you can increase the throughput and capacity, then how do? Design of a distributed system chant, referring to what the design kafka, broker -> topic -> partition, each partition to put a machine to save part of the data. If the resource is not enough now, simple ah, to the topic increase partition, then do data migration, increase the machine, you can not store more data, provide higher throughput up?

Second, you have to think about this mq data to disk do not fall, right? That certainly want to, do not drop the disk in order to ensure the process hung up on the lost data. That fall off the disk when how ah? Sequential write, so there is no disk random read and write addressing overhead of disk read and write sequential performance is very high, which is kafka ideas.

Second, you think about your availability mq, ah? This thing, before the specific reference to the availability of high availability protection mechanisms that explain the link of kafka. Multiple copy -> leader & follower -> broker linked to the re-elected leader to external services.

0 lost data can not support ah? Yes, we said before that reference kafka zero data loss solution. mq certainly very complex, the interviewer ask you this question, in fact, is an open question, he is to see you there from an architectural point of view the overall concept and design and thinking ability. This problem can be washed off really large number of people, because most people usually do not think about these things.

More quality articles, please pay attention to my micro-channel public number [selection] java back-end technology, to reply "1024" and "interview" can receive high-quality video learning resources

Reproduced in: https: //juejin.im/post/5cfde7cee51d455071250ae7

Guess you like

Origin blog.csdn.net/weixin_34235105/article/details/91430708