Message receive channel for the cluster

Source: Internet
Author: User

Corresponding to the message sending channel, the message sent requires a receiving end to receive the message, which is channelreceiver. The receiving side is responsible for receiving messages sent by other nodes from the message send channel, in fact each node has a channelsender and channelreceiver, Channelsender sends a message to the channelreceiver of the other node . The essence is that each node exposes one port as the server listener client, and each node acts as a server for the client to connect to the other nodes, so channelsender is a collection of clients. The Channelreceiver acts as a service side.

During the cluster message replication process, each nodeChannelreceiveris responsible for receiving messages from other nodes, assuming aNcluster of nodes, in general the case of eachChannelreceivercorrespondingn-1Connection, because the communication connections between the clusters are long connections, long connections help to improve communication efficiency, such as4nodes of a cluster,Node1of theChannelreceiverthe number of client connections is3, respectively isNode2,Node3,Node4three nodes initiated as a clientSocketconnection. The data generated by these three nodes is synchronized through this channel to aNode1node, in the same way,Node2of theChannelreceiverhaveNode1,Node3,Node4Client connection, the data generated by these three nodes is also synchronized to theNode2node. Node3,Node4also has three client connections. To improve processing efficiency, use theNIOprocess the model.

In addition, the re-receive operation in order to optimize performance to take a number of measures, such as the introduction of task pool, that is, the receiving task is defined in advance to put in memory, receive can be directly used without the instantiation, for example, a number of messages to be processed, i.e. using nio The pattern reads the message into the buffer and processes the entire buffer directly, it may contain several messages, and the network IO needs to be optimized in more places and means,tribes Have done a lot of optimization work.






Students who like Java can make a friend:


Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

Message receive channel for the cluster

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.