Zeromq is a lightweight messaging component. Although its name contains "MQ", zeromq is not "Message Queue/Message Middleware" strictly speaking ". Zeromq is a transport-layer api library that focuses more on message transmission. Compared with message queues, zeromq has the following features:
Point-to-point without intermediate node
Traditional message queues require a Message Server to store and forward messages. Zeromq gave up this mode, focused on point-to-point message transmission, and (attempted) achieved the ultimate. The Message Server is eventually converted to point-to-point message transmission from the server to other nodes. Zeromq can cache messages, but it is cached at the sending end. Zeromq has an Interface related to water level settings to control the cache volume. Of course, zeromq also supports traditional message queues (implemented through zmq_device ).
Message sending and receiving mode
In point-to-point message transmission, zeromq summarizes the communication modes, such as common subscription modes (one message is sent to multiple customers) and distribution modes (N messages are evenly distributed to X customers) and so on. The following are currently supported message mode pairs. Either party can act as the server. Flexible.
? Supports multiple underlying communication modes with a unified interface
Whether inter-thread communication, inter-process communication, or cross-host communication, zeromq uses the same set of APIS for calling. You only need to change the name of the communication protocol (for example, from "IPC: /// XXX "to" TCP ://.... It provides the following four types of transmission protocols:
- TCP: Communication Between Hosts
- Inroc: communication between threads of the same process)
- IPC: Communication Between processes on the same host
- PGM: Multicast Communication
? Asynchronous, emphasizing performance
Zeromq was designed to serve high-performance message sending, so it is designed to be concise and efficient. It sends messages in asynchronous mode and is implemented by a separate Io thread. Its performance often makes it difficult for other message queue frameworks to look back.
Learning documents:
The following two C # introductory documents are well described. We recommend them here.
- One article on codeproject is very good: zeromq via C #: introduction, which is also translated in China: Use zeromq through C.
- This blog is also very easy-to-understand and easy to understand.
- The official zeromq Guide also has a detailed Chinese version, which is also available on csdn: Click to download
Zeromq-a lightweight messaging component