liveBook · Manning

Tasks.max

As explained in Apache Kafka in Action

tasks.max is a Kafka Connect configuration property that sets the maximum number of tasks into which a connector workload may be divided.

When a Kafka Connect connector handles more data, tasks.max sets the upper limit on how many independent tasks may divide its workload. Raising the value enables parallelization only when the connector and its data can support it. section 11.6.1 section 11.3

One file, one task

A FileStreamSource connector reads /tmp/customers.txt and writes to the customers topic. Because one file cannot be scaled across multiple tasks, its configuration sets "tasks.max": "1". The connector can then be submitted to Kafka Connect with a REST POST request. section 11.2.2

Twelve tables across four tasks

If a database connector imports 12 tables with tasks.max set to 4, Kafka Connect can assign three tables to each task and distribute those tasks across available workers. Adding workers increases placement capacity, but does not create more tasks than the connector configuration and source structure allow. section 11.3

tasks.max is a ceiling, not a promise. The connector may create fewer tasks because of its own implementation or because the data offers limited parallelism, such as too few source-topic partitions. Setting the value above that limit adds no parallelization. section 11.6.1

How Apache Kafka in Action covers it

How deep it goes
Explains task ceilings, worker distribution, and connector limits, but does not detail task-creation algorithms.
Examples
Uses a single-file FileStreamSource connector and a 12-table database workload divided across four tasks.
What it assumes
Assumes basic Kafka Connect workers and connectors while demonstrating task distribution through files, database tables, and source partitions.
What you can do after
Operate/configure Kafka Connect connectors by choosing a task ceiling consistent with workload structure and available parallelism.
How it connects
Connects Kafka Connect workers, source connectors, sink connectors, Kafka partitions, and workload parallelization.

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.