Skip to content

[Question] Question about Knative Consumergroup Replica Logic - xpost #8750

@lamluongbinh

Description

@lamluongbinh

Hi team,

I’d like to ask for some clarification about the replica distribution logic in Knative Eventing (Kafka Broker / Channel).

Context:

  • I’ve configured pod_capacity = 20, so the total capacity is 60. My current total replicas is 54.
  • I have 3 dispatcher pods, which are enough to handle my ConsumerGroup replicas.
  • When I set the ConsumerGroup replicas of a Trigger to 3, I’ve observed several distribution patterns:
    • 1 pod: controls all 3 replicas
    • 2 pods: one pod controls 2 replicas, another controls 1
    • 3 pods: each pod controls 1 replica.

I’d like to understand the difference between these scenarios:

  1. Parallelism and Bottlenecks

    • From our observation, each pod — even when handling multiple replicas — is seen by the Kafka broker as a single consumer in the consumer group. We suspect that all assigned partitions within that pod are processed on a single thread, potentially becoming a bottleneck.
      • Is this understanding correct?
      • Would multiple consumer replicas on a single pod reduce throughput compared to distributing them across multiple pods?
  2. Consumer Instance Behavior

    • As a user, we expect that each consumer replica corresponds to a distinct consumer instance (or at least its own processing thread).
      • Ideally, if 3 consumer replicas are placed on 1 pod, we’d expect to see 3 distinct consumers from the Kafka coordinator’s perspective — each capable of consuming in parallel.
      • Is there any way to configure Knative to allow this kind of multi-threaded consumer behavior per pod?
  3. Replica Distribution Logic

    • From reviewing the code, it appears that the consumerClient is created per placement, meaning one placement maps to one pod.
      • What is the logic behind this design choice?
      • Is there a mechanism to ensure replicas are evenly distributed across dispatcher pods?
      • Can we configure the system so that a Trigger with 3 replicas always ensures each replica runs on a different pod?
  4. Configuration Options

    • I understand that the default placement limit per pod (pod_capacity), which can be configured. I’m wondering if there’s any way to dedicate or scale resources for replicas that end up consolidated within a single pod to avoid contention.
    • For example:
      • How does performance differ between 30 topics with 1 replica each (all placed into one pod) versus 1 topic with 30 replicas (also consolidated into one pod)?
      • Does Knative handle these scenarios differently in terms of resource allocation, threading, or consumption throughput?

I first asked this question in knative-extensions/eventing-kafka-broker#4551, but since the main scheduling logic appears to live in knative/eventing/pkg/scheduler, I re-post it here .

Any clarification or guidance on these aspects — especially regarding how to achieve better parallelism or enforce replica spreading — would be greatly appreciated.

Thanks in advance for your help!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions