Why the 13.app backend uses Message Queuing

Source: Internet
Author: User

Many small partners without actual project experience are very unfamiliar with Message Queuing systems, and in the introduction of many architectures, Message Queuing is mentioned. But, why do you want to use Message Queuing? What is Message Queuing? What are the common Message Queuing products?


By reading this article, I can help you to solve the above doubts.


1. Why use Message Queuing?

Suppose a boss, got a task to finish. In dealing with this task, the task is broken down into a few small tasks, as long as the separate completion of these small tasks, the entire task is completed.


When you do a small task, you find that this small task takes a lot of time to complete, and that the small task is completed late and does not affect the complete progress of the task. So, the eldest brother to this small task to make a little brother to do, and then go on to finish other tasks.


In the above example, the boss is the back-end system, the younger brother is the Message Queuing system, when the background system found that the completion of some small tasks need to spend a lot of time, and the late completion does not affect the entire task, will put these small tasks to the Message Queuing system.


In the actual app backend, sending messages, sending text messages, and pushing and so on are all well suited for the Message Queuing system. Consider whether these tasks need to spend more time, and the late completion will not affect. By placing these tasks in the queue, you can speed up the response time of the request.


2. How does Message Queuing work?

Message Queuing systems typically contain 3 roles: Queue service side, queue producer, queue consumer.


The Message Queuing system is similar to this scenario: there is a message conveyor belt that runs continuously. At the beginning of the conveyor belt, worker a keeps putting the information in a box, placing the box on the conveyor belt, and the box being transported to the end of the conveyor belt. At the end, worker B takes the information out of the box and handles it.


In the above scenario, the nonstop conveyor is the queue service, the worker a who keeps the box at the beginning of the conveyor belt is the producer of the queue, and the worker B who keeps the box at the end of the conveyor belt is the consumer of the queue.


The service side of Message Queuing now has a large number of open source applications, such as RABBITMQ, ZeroMQ, Redis, etc.


The queue's producers and service providers are clients developed for the Message Queuing server, for example, RABBITMQ has clients developed for languages such as java,php.


For example, in the app backend, call the Java client in code and put the text message you want to send in Zeromq, where the Java client is the producer that acts as a queue.


Write a daemon, in the daemon, through the code calls the Java client to send the text message is constantly removed from the ZEROMQ, and then sent out.


3. Some of the common Message Queuing products

RabbitMQ:


is an open source message queue written using Erlang, which itself supports a lot of protocols: Amqp,xmpp, SMTP, STOMP, and so on, making it very heavyweight and more suitable for enterprise-class development. A broker framework is also implemented, which means that messages are queued in the central queue before they are sent to the client. Good support for routing (Routing), load balancing (payload balance), or data persistence.


At the same time, RABBITMQ comes with a web monitoring interface, which facilitates monitoring of queues.


Redis:


Although it is a key-value system, it also supports the data structure of the queue, which can be regarded as a lightweight Message queuing system.


In the app backend architecture, Redis is widely used and, if used as a message queue at the same time, reduces the cost of operations.


ZeroMq:


Known as the fastest Message Queuing system, especially for large-throughput demand scenarios.


ActiveMQ:


is a sub-project under Apache. Similar to ZEROMQ, it is able to implement queues with agent and peer-to-peer technology.


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

Open the total list of articles in the Link app backend series to see all the original "app backend" articles I've published.

"Author" Zeng Jiansen
"QQ" 190678908
"QQ Group" 254659220
"public number" Appbackend
"Sina Weibo" @newjueqi
"blog" Http://blog.csdn.net/newjueqi


Why the 13.app backend uses Message Queuing

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.