liveBook · Manning

Task

As explained in Apache Kafka in Action

A Kafka Streams task is the smallest processing unit, responsible for processing one or more assigned partitions and executing a topology.

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.
A screenshot of a computer game

AI-generated content may be incorrect.

Use the task-distribution figure to trace how tasks move across instances and threads, including takeover after an instance failure. section 12.6

How Apache Kafka in Action covers it

How deep it goes
Explains task creation, assignment, threading, rebalancing, and failure takeover, but does not descend into task implementation internals.
Examples
Demonstrates twelve filtering tasks, six-instance distribution, nine-task thread allocation, and failure-driven reassignment.
What it assumes
Assumes Kafka partitions and introduces task parallelism through KStreams, KTables, instances, threads, and rebalancing.
What you can do after
Apply task-based partitioning to reason about Kafka Streams scaling, thread configuration, instance capacity, and failure recovery.
How it connects
Connects tasks with Kafka partitions, KStreams, KTables, Kafka Rebalance Protocol, consumer groups, and Kafka Connect.

Also explained in

Compare how 3 books explain task →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Apache Kafka in Action. The section links point to the parts of the book it draws on.