Jafka source code analysis - Network Architecture

In kafka in. Each broker is a server. In accordance with generally understood, server is a the SocketServer , which constantly receives and processes the user's request. In Java network connecting two way mode is one kind of non-jam jam mode.

Jafka non-network communication mode clogging. In Java 's non-blocking mode, establish socket server ships, for example, the following processes:

1. Start ServerSocketChannel and bind to a specific port.

2. ServerSocketChannel operations and to register their interest Selector , the operation of interest here is Accept

3. continuously polls Selector whether there is interest in the event, assuming it accept remote connections and processes

Substantially all of the above basic flow network programming, jafka no exception. In jafka , the class Acceptor specifically responsible for implementing server. This is relatively simple, not here to make a specific description.

To note that, Acceptor after receiving the request of the client to which will Processor -based processing. Users will be configured in the configuration file Processor number, Acceptor meeting to round robin manner client connected to the Processor for processing.

Guess you like

Origin www.cnblogs.com/ldxsuanfa/p/10962146.html