2021年2月11日星期四

Kafka streams key-value state store (RocksDB) has a delayed persistence hence an immediate look up fails intermittently

In our Spring cloud stream Kafka stream application, we are storing certain incoming messages in KeyValueStore state store

Materialized.<Key, Value, KeyValueStore<Bytes, byte[]>>as(STATE_STORE_NAME)                      .withKeySerde(createSpecificAvroSerde(true))                      .withValueSerde(createSpecificAvroSerde(false))                      .withCachingDisabled()  

and immediately in a different topology (same consumer) trying to lookup the key in the state store using the InteractiveQueryService

interactiveQueryService.getQueryableStore(STATE_STORE_NAME, QueryableStoreTypes.keyValueStore());  

Also disabled the in memory caching using following configurations

spring.cloud.stream.kafka.streams.binder.configuration.cache.max.bytes.buffering=0  spring.cloud.stream.kafka.streams.binder.configuration.consumer.cache.max.bytes.buffering=0   

But still, the key look up fails intermittently. The state store in question is only local (one instance) state store and the input topic has only one partition and hence expectation is to find the key even if it is only a single local state store look up.

Are there any other configuration/memory settings we need to use to flush the messages immediately to the disk state store? Would there be any buffering/caching still happening before the messages are available in the read only queryable state store? I believe the interactive query service only able to read the state store in RocksDB SST files.

https://stackoverflow.com/questions/66095134/kafka-streams-key-value-state-store-rocksdb-has-a-delayed-persistence-hence-an February 08, 2021 at 10:15AM

没有评论:

发表评论