Why use a message system

Decoupling  : In the beginning of the project start to predict what the future will meet the needs of the project, is extremely difficult. Message processing system is inserted in the middle of an implicit, based on the interface layer data, the processing to be implemented on both sides of the interface. This allows you to independently extend or modify the process on both sides, just make sure that they comply with the same interface constraints.

redundancy: In some cases, the process of processing the data will fail. Unless the data is persistent, otherwise it will result in the loss. Message Queue data for persistence until they have been fully processed, by this way to avoid the risk of data loss. Many message queue used by the "Insert - get - to delete" paradigm, before the message removed from the queue, you need treatment system clearly indicates that the message has been processed to ensure the preservation of your data is safe until you are finished using.

Scalability:  since your message queue decoupling process, so increasing the frequency and enqueued message processing is easy, as long as the process can be further increased. No need to change the code, no adjustment parameter. Extension is as simple as turn up the power button.

Flexibility & peak capacity  : In the case of the sharp increase in traffic, applications need to continue to play a role, but this burst of traffic is not common; if it is to be able to handle such peak as a standard to access investment resources on standby It is undoubtedly a huge waste. Message Queuing enables access to critical components withstand burst pressure, but will not overload the request burst and collapse completely.

recoverability  : when a portion of the components of the system failure, does not affect the entire system. Message queue reduces coupling between processes, so that even if a message processing process hang, queued messages can still be processed after the system recovery.

order to ensure that : In most usage scenarios, the order data processing is very important. Most originally ordered message queue, and can ensure that the data will be processed in a particular order. Kafka ensure orderly message in a Partition.

Buffer : any significant system, the element will have different needs processing time. For example, in less time than it takes to load a picture to apply filters. Message queues to help perform tasks for maximum efficiency through a buffer layer --- written to the queue will be processed as fast as possible. The buffer control and helps to optimize the speed of data flow through the system.

for data flow : In a distributed system, to get a user action with an overall impression of how long its causes, is a huge challenge. News Series by frequency of messages are processed, to facilitate assistance to identify those underperforming processes or areas where data flows are less than optimal.

asynchronous communication : In many cases, users do not want nor need to immediately process the message. It provides asynchronous message queue processing mechanism, allowing the user to put a message on the queue, but does not deal with it immediately. Think how many messages are placed into the queue to put the number, then go to process them in time of need.

---------------------

Reference & references:

https://blog.csdn.net/lizhitao/article/details/44521539

http://blog.iron.io/2012/12/top-10-uses-for-message-queue.html?spref=tw

Guess you like

Origin www.cnblogs.com/zhy-heaven/p/10993805.html