To process all messages from a 4-partition topic with two applications, the optimal setup is to create two consumer groups with four consumers in each group.

Study for the Apache Kafka CCDAK Test. Use flashcards and multiple choice questions, with hints and explanations for each answer. Prepare effectively for your certification!

Multiple Choice

To process all messages from a 4-partition topic with two applications, the optimal setup is to create two consumer groups with four consumers in each group.

Explanation:
Understanding how Kafka uses consumer groups and partitions to determine parallel work is the key idea here. In Kafka, a partition is assigned to exactly one consumer within a given consumer group, so the level of parallelism you get from a group equals the number of active consumers in that group, up to the total number of partitions. With a topic that has four partitions, having four consumers in a single group lets each consumer deal with one partition at the same time, maximizing throughput. When you have two applications, giving each its own consumer group lets them process independently—the apps don’t share offsets or state. To make sure both apps can process all partitions in parallel, each app’s group should have as many consumers as there are partitions, up to four. That way, every partition can be handled concurrently within each group. If you tried other setups, you'd either waste resources (more consumers than partitions in a single group means some remain idle) or you’d limit parallelism (fewer consumers per group means only two or so partitions are processed at once, not all four). Therefore, two separate groups with four consumers in each group is the most efficient arrangement for this scenario.

Understanding how Kafka uses consumer groups and partitions to determine parallel work is the key idea here. In Kafka, a partition is assigned to exactly one consumer within a given consumer group, so the level of parallelism you get from a group equals the number of active consumers in that group, up to the total number of partitions. With a topic that has four partitions, having four consumers in a single group lets each consumer deal with one partition at the same time, maximizing throughput.

When you have two applications, giving each its own consumer group lets them process independently—the apps don’t share offsets or state. To make sure both apps can process all partitions in parallel, each app’s group should have as many consumers as there are partitions, up to four. That way, every partition can be handled concurrently within each group.

If you tried other setups, you'd either waste resources (more consumers than partitions in a single group means some remain idle) or you’d limit parallelism (fewer consumers per group means only two or so partitions are processed at once, not all four). Therefore, two separate groups with four consumers in each group is the most efficient arrangement for this scenario.

Subscribe

Get the latest from Examzify

You can unsubscribe at any time. Read our privacy policy