Uploaded image for project: 'Kafka'
  1. Kafka
  2. KAFKA-15178

Poor performance of ConsumerCoordinator with many TopicPartitions

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Minor
    • Resolution: Unresolved
    • 3.5.0
    • None
    • consumer

    Description

      Doing some profiling of my Kafka Streams application, I noticed that the pollPhase suffers from a minor performance issue.

      See the pink tree on the left of the flame graph below.

      ConsumerCoordinator.poll calls rejoinNeededOrPending, which checks the current metadataSnapshot against the assignmentSnapshot. This comparison is a deep-equality check, and if there's a large number of topic-partitions being consumed by the application, then this comparison can perform poorly.

      I suspect this can be trivially addressed with a boolean flag that indicates when the metadataSnapshot has been updated (or is "dirty"), and actually needs to be checked, since most of the time it should be identical to assignmentSnapshot.

      I plan to raise a PR with this optimization to address this issue.

      Attachments

        1. pollPhase.png
          218 kB
          Nicholas Telford

        Issue Links

          Activity

            People

              nicktelford Nicholas Telford
              nicktelford Nicholas Telford
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated: