streamiz: Problems with partition rebalancing

Description

We are having problems with partition rebalancing. We use Kubernetes and we have two replicas for a service with a stream. One of the problems is message loss. We have this problem when one of the two pods is down and the second has not yet taken over. If a message is produced at that time and the pod restarts, then the message is not processed. In some cases, messages are published in duplicates but we have not identified when this happens. In other cases, both replicas get stuck and we have to restart a single pod to unblock the situation. Here is our configuration.

 Stream property:
                client.id:      product
                num.stream.threads:     1
                default.key.serdes:     Streamiz.Kafka.Net.SerDes.StringSerDes
                default.value.serdes:   Streamiz.Kafka.Net.SerDes.StringSerDes
                default.timestamp.extractor:    Streamiz.Kafka.Net.Processors.Internal.FailOnInvalidTimestamp
                commit.interval.ms:     30000
                processing.guarantee:   AT_LEAST_ONCE
                transaction.timeout:    00:00:10
                poll.ms:        100
                max.poll.records:       500
                max.poll.restoring.records:     1000
                max.task.idle.ms:       0
                buffered.records.per.partition:         2147483647
                inner.exception.handler:        System.Func`2[System.Exception,Streamiz.Kafka.Net.ExceptionHandlerResponse]
                production.exception.handler:   System.Func`2[Confluent.Kafka.DeliveryReport`2[System.Byte[],System.Byte[]],Streamiz.Kafka.Net.ExceptionHandlerResponse]
                deserialization.exception.handler:      System.Func`4[Streamiz.Kafka.Net.ProcessorContext,Confluent.Kafka.ConsumeResult`2[System.Byte[],System.Byte[]],System.Exception,Streamiz.Kafka.Net.ExceptionHandlerResponse]
                rocksdb.config.setter:  System.Action`2[System.String,Streamiz.Kafka.Net.State.RocksDb.RocksDbOptions]
                follow.metadata:        False
                state.dir:      C:\Users\****\AppData\Local\Temp\streamiz-kafka-net
                replication.factor:     1
                windowstore.changelog.additional.retention.ms:  86400000
                offset.checkpoint.manager:
                metrics.interval.ms:    30000
                metrics.recording.level:        INFO
                log.processing.summary:         00:01:00
                metrics.reporter:       System.Action`1[System.Collections.Generic.IEnumerable`1[Streamiz.Kafka.Net.Metrics.Sensor]]
                expose.librdkafka.stats:        False
                start.task.delay.ms:    5000
                parallel.processing:    False
                max.degree.of.parallelism:      8
                application.id:         product
                schema.registry.url:    10.10.10.10
                schema.registry.request.timeout.ms:     30000
                schema.registry.max.cached.schemas:     10
                avro.serializer.buffer.bytes:   2048
                protobuf.serializer.buffer.bytes:       2048
                avro.serializer.auto.register.schemas:  True
                protobuf.serializer.auto.register.schemas:      True
        Client property:
                bootstrap.servers:      10.10.10.10
                security.protocol:      plaintext
                debug:
        Consumer property:
                max.poll.interval.ms:   300000
                enable.auto.commit:     False
                enable.auto.offset.store:       False
                partition.assignment.strategy:  roundrobin
                auto.offset.reset:      earliest
                allow.auto.create.topics:       True
        Producer property:
                partitioner:    consistent_random
                enable.idempotence:     True
                message.timeout.ms:     2147483647
                message.send.max.retries:       1000000
                retry.backoff.ms:       100
        Admin client property:
                None

How to reproduce

Run the stream on two pods.

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 23 (11 by maintainers)

Commits related to this issue

Most upvoted comments

@EmanueleAlbero Will take a look next week

Hi @LGouellec,

I found a workaround. I added an if statement in this method in class KafkaLoggerAdapter:

private string GetName(IClient client)
{
    // FOR FIX
    var name = "";
    try
    {
        if (client.Handle == null || client.Handle.IsInvalid)
            return "Unknown";

        name = client.Name;
    }
    catch (NullReferenceException)
    {
        name = "Unknown";
    }

    return name;
}

I reproduced the issue where a message is not consumed and there is lag in my consumer group. The message was produced at 15:46:23.068. category1.txt category2.txt