The broker internal architecture of the Apache Kafka series

Source: Internet
Author: User
Tags socket

The main submodules of Kafka broker are described below to help you better learn and understand Kafka source code and architecture.

Several sub-modules are described as follows:

Kafka API layer Logmanager and Log replicamanager zookeeperconsumerconnector service Schedule is how several modules of the system are composed into a schema diagram:
startup process
Zkclient Initialize =>logmanager start () = Socketserver start () =>requesthandlerpool initialize =>replicamanager start () = >
Kafkacontroller start () =>topicconfigmanager start () = Kafkahealthcheck start ()
Core IO processing of broker in Requesthandlerpool

Zkclient initialization
Using the link between the initial and ZK of the third party zkclient, Zkclient is responsible for maintaining the connection,session with ZK.

Logmanager initialization
All read and write requests will instantiate their own log instance objects. At the same time, the log thread in the background will be responsible for maintaining partitions and log segment.

Socketserver initialization
NIO Socket Server
* 1 acceptor thread is responsible for receiving requests and transferring them to processor threads for processing
* N Processor Threads is responsible for the actual processing of each socket request


• M Handler Threads is responsible for the event mechanism that urges each processor request to reply to the message of the product request.

Replicamanager initialization
• Manage the partition copy of the broker

Kafkacontroller initialization
Management of the Controller State responsible for the broker

Topicconfigmanager initialization
The state management work of the topic responsible for the broker

Kafkahealthcheck initialization
Responsible for the status of the broker in ZK's maintenance work
Requesthandlerpool initialization
Core IO processing center, handled through event-driven mode

Maintain 2 queues,
One is the request queue
One is the response queue
By, Kafkaapis invokes (about view Kafkaapis) The event type handler, and handles the related event.
Requested event types Total Producekey, Fetchkey, Offsetskey, Metadatakey, Leaderandisrkey, Stopreplicakey,
Updatemetadatakey, Controlledshutdownkey, Offsetcommitkey, Offsetfetchkey
Please specify reproduced from: http://blog.csdn.net/lizhitao/article/details/38352947

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.