kafka
rebalance
重新给消费者分配任务的过程
重平衡的是对业务侵入特别严重的,如果消费者很多的话,那么可能会导致集群一定时间内不可用。
发生时机
- 主题分区发生变化
- 消费端 新增或者减少
怎么去做重平衡
协调着强制要求 消费者重新加入组的过程。 其实就是发 joinGroup
请求,把需要的信息带来,并规定这次重平衡的leader,让leader负责把信息制定好,然后分发下去。
Adding servers to a Kafka cluster is easy, just assign them a unique broker id and start up Kafka on your new servers. However these new servers will not automatically be assigned any data partitions, so unless partitions are moved to them they won't be doing any work until new topics are created. So usually when you add machines to your cluster you will want to migrate some existing data to these machines.
The process of migrating data is manually initiated but fully automated. Under the covers what happens is that Kafka will add the new server as a follower of the partition it is migrating and allow it to fully replicate the existing data in that partition. When the new server has fully replicated the contents of this partition and joined the in-sync replica one of the existing replicas will delete their partition's data.
The partition reassignment tool can be used to move partitions across brokers. An ideal partition distribution would ensure even data load and partition sizes across all brokers. The partition reassignment tool does not have the capability to automatically study the data distribution in a Kafka cluster and move partitions around to attain an even load distribution. As such, the admin has to figure out which topics or partitions should be moved around.
参考
为什么快
- zero copy
- 得益于broker,我们写进去之后,不进入用户态 直接做copy
- page cache
- batch write
- 批量写
- 顺序写
网友评论