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

Avoid calling lookupCoordinator() in tight loop

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 3.1.0, 3.1.1, 3.3.0, 3.1.2, 3.2.1
    • 3.3.0, 3.2.1
    • consumer
    • None

    Description

      Currently the heartbeat thread's lookupCoordinator() is called in a tight loop if brokers crash and the consumer is left running. Besides that it floods the logs on debug level, it increases CPU usage as well.

      The fix is easy, just need to put a backoff call after coordinator lookup.

      Reproduction:

      1. Start a few brokers
      2. Create a topic and produce to it
      3. Start consuming
      4. Stop all brokers
        At this point lookupCoordinator() will be called in a tight loop.

      Attachments

        1. image-2022-10-21-15-53-14-689.png
          42 kB
          MillieZhang
        2. image-2022-10-21-15-52-20-402.png
          42 kB
          MillieZhang

        Activity

          People

            viktorsomogyi Viktor Somogyi-Vass
            viktorsomogyi Viktor Somogyi-Vass
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: