Hi there, @emasab @rayokota! 👋
In the official examples for confluent-kafka-go v2 a single Consumer is created with kafka.NewConsumer, and consumer.Poll() is called in the main goroutine. My kafka topic has four partitions, so I'm trying to understand the recommended approach for higher throughput and less RAM concumption:
- Parallel polling:
- Is it OK (or even expected) to call
consumer.Poll() from four separate goroutines, one per partition?
- Multiple consumers:
- Alternatively, should I create four separate
Consumer instances (in the same consumer group)?
- If I do this, will each instance be assigned a dedicated partition, or will messages still be interleaved across them?
- Best practice:
- What is the canonical way to scale reads when a single consumer can't keep up and Kafka lag starts to grow?
Any guidance or links to relevant docs or examples would be much appreciated. Thanks in advance!