Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What does the network IO QuorumCnxManager mean when electing Leader in zk?

2025-04-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/02 Report--

This article introduces the relevant knowledge of "what is the meaning of network IO QuorumCnxManager when electing Leader in zk". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!

During the startup process of each service, a QuorumCnxManager is launched, which is responsible for the network communication during the underlying Leader election process between the servers.

When the service of a server in the cluster is interrupted, zk will re-elect leader

Inner class

The Message definition message structure contains sid and content ByteBuffer

ByteBuffer buffer;long sid

InitialMessage

QuorumConnectionReqThread send connection request class

QuorumConnectionReceiverThread

Snooping on Listener port

The SendWorker sending thread takes the message from the sending queue and sends it to the corresponding sid machine.

Once the message queue for the current service sid is found to be empty, take one of the most recent messages and send it again.

In order to ensure that the server service is normal, zk can ensure that duplicate messages are handled correctly.

The thread that RecvWorker receives the message continuously reads data from the network io and puts it into the receiving queue.

UML-like graph

Attribute

RECV_CAPACITY

Maximum thread queue capacity

SEND_CAPACITY

Transmission capacity

PACKETMAXSIZE

The maximum package is 10240512.

ObserverCounter

Number of observers

QuorumPeer

Number of clusters

MySid

Ip address

ConnectionExecutor

Connection thread pool service executor

AuthServer

Verified server

AuthLearner

Learner

ConnectionThreadCnt

Number of connections processed

RecvQueue

Receiving queue

Method

Initialize the connection

Public void initiateConnection (final Socket sock, final Long sid) {try {startConnection (sock, sid);} catch (IOException e) {LOG.error ("Exception while connecting, id: {}, addr: {}, closing learner connection", new Object [] {sid, sock.getRemoteSocketAddress ()}, e); closeSocket (sock); return;}} receive connection public void receiveConnection (final Socket sock) {DataInputStream din = null Try {din = new DataInputStream (new BufferedInputStream (sock.getInputStream ()); handleConnection (sock, din);} catch (IOException e) {LOG.error ("Exception handling connection, addr: {}, closing server connection", sock.getRemoteSocketAddress ()); closeSocket (sock);}} "what is the meaning of network IO QuorumCnxManager when electing Leader in zk"? thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report