A Kafka Streams task is the smallest processing unit in an application. It processes an assigned partition and executes the relevant topology. Because partitions are processed independently, the number of tasks depends on the number of partitions being processed. section 12.6
Partition-based parallelism
Filtering a topic with 12 partitions creates 12 tasks, one per partition. One instance can process all 12; six instances typically process two each. With nine tasks, two instances configured with two and three threads can divide the work across both instances and their threads. section 12.6
Kafka Streams distributes tasks across instances using the Kafka Rebalance Protocol and can distribute them across threads within an instance through num.threads. When an instance fails, other instances receive its tasks and continue the work. This makes task placement central to scaling, failover, and operational capacity planning. section 12.6
Figure 12.13 Kafka Streams applications are divided into tasks that are distributed across different threads on different instances. If an instance fails, another instance takes over the tasks.
Use the task-distribution figure to trace how tasks move across instances and threads, including takeover after an instance failure. section 12.6


