Kafka在Kubernetes上流:重新部署后的长期重新平衡 [英] Kafka Streams on Kubernetes: Long rebalancing after redeployment

查看:77
本文介绍了Kafka在Kubernetes上流:重新部署后的长期重新平衡的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们使用StatefulSet在Kubernetes上部署Scala Kafka Streams应用程序.实例具有单独的 applicationId ,因此它们每个都复制完整的输入主题以实现容错.它们本质上是只读服务,仅读取状态主题并将其写入状态存储,在该状态存储中通过REST服务客户请求.这意味着,在任何给定时间,消费者组始终仅由一个单个Kafka Streams实例组成.

We use a StatefulSet to deploy a Scala Kafka Streams application on Kubernetes. The instances have separate applicationIds, so they each replicate the complete input topic for fault-tolerance. They are essentially read-only services that only read in a state topic and write it to the state store, from where customer requests are served via REST. That means, the consumer group always consist of only a single Kafka Streams instance at any given time.

现在的问题是,触发滚动重新启动时,每个实例大约需要5分钟才能启动,其中大部分时间都花在了 REBALANCING 状态下.我已阅读此处,Kafka Streams不会发送 LeaveGroup 请求以返回容器重新启动后很快,无需重新平衡.为什么这对我们不起作用?即使 applicationId 是相同的,为什么重新平衡要花这么长时间?理想情况下,为了最大程度地减少停机时间,应用程序应立即从重新启动时离开的位置接管.

Our problem is now that, when triggering a rolling restart, each instance takes about 5 minutes to start up, where most of the time is spent waiting in the REBALANCING state. I've read here that Kafka Streams does not send a LeaveGroup request in order to come back fast after a container restart, without rebalancing. How come this does not work for us and why does the rebalancing take so long, even though the applicationId is identical? Ideally, to minimize downtime, the application should take over immediately from where it left when it was restarted.

以下是一些我们从默认值更改的配置:

Here are some configs we changed from the default values:

properties.put(StreamsConfig.consumerPrefix(ConsumerConfig.MAX_POLL_RECORDS_CONFIG), "1000")
properties.put(StreamsConfig.consumerPrefix(ConsumerConfig.SESSION_TIMEOUT_MS_CONFIG), "300000")
properties.put(StreamsConfig.consumerPrefix(ConsumerConfig.AUTO_OFFSET_RESET_CONFIG), "earliest")
// RocksDB config, see https://docs.confluent.io/current/streams/developer-guide/memory-mgmt.html
properties.put(StreamsConfig.ROCKSDB_CONFIG_SETTER_CLASS_CONFIG, classOf[BoundedMemoryRocksDBConfig])    

问题/相关配置

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆