Uploaded image for project: 'Subscription Watch'
  1. Subscription Watch
  2. SWATCH-3787

Spike: Investigate best strategy to consume Kafka messages in batches in Quarkus

XMLWordPrintable

    • Icon: Task Task
    • Resolution: Done
    • Icon: Normal Normal
    • None
    • None
    • None
    • None

      This ticket is to investigate and determine the most effective strategy for consuming Kafka messages in batches within a Quarkus application. Our current Kafka consumer implementation processes messages individually, which can lead to performance bottlenecks and increased resource utilization, especially under high message throughput.

      Batch processing is crucial for improving efficiency by reducing the overhead of network and I/O operations and optimizing database interactions or external API calls for multiple messages at once.

      The investigation should cover the following aspects:

      • Quarkus SmallRye Reactive Messaging capabilities for batch consumption:
        Explore how to configure @Incoming annotated methods to receive Multi<List<T>> or Multi<Message<List<T>>> to enable batch processing directly.
        Understand the role of groupItems().intoLists().every(Duration) or of(size) for time-based or size-based batching.
        Investigate different acknowledgement strategies (throttled, latest, ignore, manual) in the context of batch processing and their implications for message delivery semantics (at-least-once, at-most-once, exactly-once).
      • Kafka Consumer Configuration Properties:
        Review relevant Kafka consumer properties such as max.poll.records, fetch.min.bytes, fetch.max.bytes, and max.partition.fetch.bytes and how they influence batch size and polling behavior.
        Understand how these properties interact with Quarkus Reactive Messaging's batching mechanisms.
      • Error Handling and Dead Letter Queues (DLQ) in batch processing:
        Determine how failures within a batch are handled.
        Investigate strategies for sending failed individual messages or entire failed batches to a DLQ.

      Acceptance Criteria

      • A detailed report outlining the findings of the investigation.
      • A proof-of-concept (POC) code snippet demonstrating the chosen batch consumption strategy in Quarkus.
      • Recommended configuration properties for Kafka consumers and Quarkus Reactive Messaging channels.

              jcarvaja@redhat.com Jose Carvajal Hilario
              jcarvaja@redhat.com Jose Carvajal Hilario
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated:
                Resolved: