技术点 kafka
2020-07-03 18:22:20 0 举报
技术点 kafka
作者其他创作
大纲/内容
message 34477849970
35515920512-35517345678
appends
broken state
group2
0
broken 1
T1-P1
{ \"jmx_port\
/offsets
customer3
1
group1
hardware
cache
message 38547920512
.
consumer group
scoket buffer
code logic continues
partition3
kafka page cache 基数树
10
/topics
read
copy data to user buffer
kafka 多个消费者组
zookeeper
kafka topic partition 的 replication
00
3
kernel context
6.ack
/consumer
kafka 消费者少于和等于partition
传统数据传输上下文切换是CPU密集型的工作,数据拷贝是I/O密集型的工作
/ids
productor2
{ \"version\
write data
8-11kb
{ \"version\
productor
38515920512-38517920512
T1-P0
4
leader
ISR for partition in set_p
consumer 2
零拷贝
patitions
向test发送消息:1,2, 3,4,5,6,7,8,9只有C1能接收到消息,C2则不能接收到消息同一个partition内的消息只能被同一个组中的一个consumer消费。当消费者数量多于partition的数量时,多余的消费者空闲只有一个partition你在同一组启动多少个consumer都没用partition的数量决定了此topic在同一组中被可被均衡的程度,例如partition=4,则可在同一组中被最多4个consumer均衡消费
topic2-partition4
broker(即/brokers/ids/[brokerId])存储“活着”的Broker信息
6
partition state(/brokers/topics/[topic]/partitions/[partitionId]/state)
4.sendRetry(a.b)
broker4
consumer 3
consumer 1
watch fire
block
jvm heap
/reassign_partitions
customer1
state
...
topic3-partition2
done
Application context
pwrite
disk
write returns
消费者数量2小于partition的数量3,此时,向test2发送消息1,2,3,4,5,6,7,8,9C1接收到1,3,4,6,7,9C2接收到2,5,8此时P1、P2对对应C1,即多个partition对应一个消费者,C1接收到消息量是C2的两倍然后,在g1组中再启动一个消费者,使得消费者数量为3等于topic1中partition的数量
向test2发送消息1,2,3,4,5,6,7,8,9那么g3组各个消费者及g4组的消费者接收到的消息是怎样地呢?欢迎思考!!答案:消息被g3组的消费者均分,g4组的消费者在接收到了所有的消息。g3组:C1接收到了:2,5,8C2接收到了:3,6,9C3接收到了:1,4,7g4组:C1接收到了:1,2,3,4,5,6,7,8,9启动多个组,则会使同一个消息被消费多次
kafka 消费者多于partition
/[group name]
2
topic1-partition3
/delete_topics
/topic2
topic3-partition4
consistent view
page cache
{ \"version\
topic3-partition3
T1-P2
topic1-partition4
5
broker
detemine set_p
/preferred_replica_election
follower
DMA copy
/controller -> int (broker id of the controller)存储当前controller的信息
topic2-partition1
file
broken path
{ \"version\
topic 1
8
productor1
kernel space
reads
group1
partition2
38517920513-38527920512
topic2-partition3
kafka 顺序写磁盘
sync
broker1
controller
kafka log entry
/2
kafka ha 结构 brokers
9
/[patitions id]
/brokers
avaliable brokers
read buffer
topic path
11
read syscall
34477849968-35515920511
broken2
application buffer
affected brokers
write new ISR and leader
重新分配 备份
broker2
partition 1
/[consumer id]
/1
kafka 幂等性 发送
kafka broken/replication failover
4.pid=1 seq = 1sendRetry(a.b)
01
message 34477849968
nic buffer
topic2-partition2
customer4
message 34477849969
consumer
35517345679-35537345678
/[topic name]
{ \"version\
首选 备份 选举
3. ack X
partition 2
7
user space
transfer to
cpu copy
topic1-partition1
sendfile
partition1
4-7 kb
ask for data
new
message 38527920513
kafka 架构设计
old
topic1-partition2
{ \"controller_epoch\
active segment list
kafka ha 结构 admin
customer2
data for kernel buffers through DMA
broken3
broker3
/controller_epoch -> int (epoch)直接以整数形式存储controller epoch,而非像其它znode一样以JSON字符串形式存储
topic3-partition1
/admin
detemine new leader and ISR for partition in set_p
kafka pagecache 使用
0x11111101
12
write data to target buffer
writes
broken4
partition 3
message 38527920514
message 35515920510
kafka topic broken/replication failover
broken1
message 35515920511
message 38527920515
38527920513-38547920512
borker
RPC: ISR leader assignment
0-3kb
/topic1
segment files
message 38547920511
0x00000010
delete
/owns
kafka page cache
0 条评论
下一页