MQ (Message Queuing) learning

Source: Internet
Author: User

Turn from: http://book.51cto.com/art/201502/466288.htm Why do we need MQ?

And this is MQ: an efficient, embedded storage that solves the problems that most applications need to solve and becomes well scalable on the network without much cost.

The specific approach is:

It handles I/O asynchronously in a background thread. These threads use a lock-free data structure to communicate with the application thread, so the concurrent MQ application no longer requires locks, semaphores, or other wait states.

Components can come and go dynamically, and MQ will automatically reconnect. This means that you can start the component in any order. You can create a service-oriented architecture (SOA) where services can join and leave the network at any time.

It automatically queues messages as needed. To do this, it intelligently advances the message to the receiver as much as possible before queuing the message.

It has a method that handles the full queue (known as the "high Water mark"). When the queue is full, MQ automatically blocks the sender, or discards the message, depending on what kind of message delivery (the so-called "pattern") you are doing.

It allows your application to communicate with each other through arbitrary transport protocols, which can be TCP, multicast, in-process, and interprocess. You do not need to change the code to use a different transport tool.

It uses different policies that rely on the messaging pattern to securely handle slow/blocked readers.

It allows you to route messages in multiple modes, such as request-answer and publish-subscribe. These patterns refer to how you create a topology and network structure.

It allows you to create proxies to queue, forward, or to capture messages through a tune. Proxies can reduce the complexity of network interconnection.

It passes the entire message intact, using a simple frame on the line. If you write a 10KB message, then you will receive a 10KB message.

It does not impose any formatting on the message. They are 0 bytes to gigabytes of binary large objects. When you want to represent your data, you can choose some of the other products on it, such as Google's protocol buffers, XDR, and so on.

It can intelligently handle network errors. Sometimes it retries, and sometimes it tells you that an operation failed.

It can reduce your energy consumption. Spending less on CPU means using less energy on your computer, and you can make your old computer use it for longer periods of time. Gore (translator: Former U.S. Vice President, environmentalist) will also love MQ.

In fact, MQ does more than that. It has a disruptive impact on how you develop Web-enabled applications. On the surface, this is a socket-style API on which to do Zmq_msg_recv () and Zmq_msg_send (). But the message processing loop quickly becomes a central loop, and your application quickly breaks down into a set of message processing tasks. It is elegant and natural. And, it can be extended: Each task corresponds to a node, and the nodes communicate with each other by any means of transmission. Two nodes in a process (the node is a thread), two nodes in a computer (the node is a process), or two computers on a network (the node is a computer), all are handled the same way, and no application code needs to be changed.

MQ (Message Queuing) learning

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.