message.max.bytes — Kafka Broker Configuration
The largest record batch size allowed by Kafka (after compression if compression is enabled). If this is increased and there are consumers older than 0.
Description
The largest record batch size allowed by Kafka (after compression if compression is enabled). If this is increased and there are consumers older than 0.10.2, the consumers' fetch size must also be increased so that they can fetch record batches this large. In the latest message format version, records are always grouped into batches for efficiency. In previous message format versions, uncompressed records are not grouped into batches and this limit only applies to a single record in that case.This can be set per topic with the topic level max.message.bytes config.
Default Values by Kafka Version
| Kafka Version | Default Value |
|---|---|
| 0.8.0 | 1000000 |
| 0.8.1 | 1000000 |
| 0.8.2 | 1000000 |
| 0.9.0 | 1000012 |
| 0.10.0 | 1000012 |
| 0.10.1 | 1000012 |
| 0.10.2 | 1000012 |
| 0.11.0 | 1000012 |
| 1.0 | 1000012 |
| 1.1 | 1000012 |
| 2.0 | 1000012 |
| 2.1 | 1000012 |
| 2.2 | 1000012 |
| 2.3 | 1000012 |
| 2.4 | 1000012 |
| 2.5 | 1048588 |
| 2.6 | 1048588 |
| 2.7 | 1048588 |
| 2.8 | 1048588 |
| 3.0 | 1048588 |
| 3.1 | 1048588 |
| 3.2 | 1048588 |
| 3.3 | 1048588 |
| 3.4 | 1048588 |
| 3.5 | 1048588 |
| 3.6 | 1048588 |
| 3.7 | 1048588 |
| 3.8 | 1048588 |
| 3.9 | 1048588 |
| 4.0 | 1048588 |
| 4.1 | 1048588 |
| 4.2 | 1048588 |
Tuning Recommendation
| Profile | Recommended | Why |
|---|---|---|
| broker / throughput | 5242880 | Raising the max message size to 5MB allows producers to send large batches in a single request, reducing request overhead per MB of data. Combined with producer-side lz4 compression, effective payload per request can reach 20-40MB. |
| broker / durability | 1048588 | Keep the default ~1MB limit for durability workloads. Large messages increase the amount of unacknowledged data in flight and widen the potential loss window if a crash occurs between produce and fsync. Enforce small, well-structured records. |
Related Configs
replica.fetch.max.bytes · socket.request.max.bytes · compression.type