metadata.max.age.ms — Kafka Consumer Configuration
The period of time in milliseconds after which we force a refresh of metadata even if we haven't seen any partition leadership changes to proactively discover any new brokers or partitions..
Description
The period of time in milliseconds after which we force a refresh of metadata even if we haven't seen any partition leadership changes to proactively discover any new brokers or partitions.
Default Values by Kafka Version
| Kafka Version | Default Value |
|---|---|
| 0.9.0 | 300000 |
| 0.10.0 | 300000 |
| 0.10.1 | 300000 |
| 0.10.2 | 300000 |
| 0.11.0 | 300000 |
| 1.0 | 300000 |
| 1.1 | 300000 |
| 2.0 | 300000 |
| 2.1 | 300000 |
| 2.2 | 300000 |
| 2.3 | 300000 |
| 2.4 | 300000 |
| 2.5 | 300000 |
| 2.6 | 300000 (5 minutes) |
| 2.7 | 300000 (5 minutes) |
| 2.8 | 300000 (5 minutes) |
| 3.0 | 300000 (5 minutes) |
| 3.1 | 300000 (5 minutes) |
| 3.2 | 300000 (5 minutes) |
| 3.3 | 300000 (5 minutes) |
| 3.4 | 300000 (5 minutes) |
| 3.5 | 300000 (5 minutes) |
| 3.6 | 300000 (5 minutes) |
| 3.7 | 300000 (5 minutes) |
| 3.8 | 300000 (5 minutes) |
| 3.9 | 300000 (5 minutes) |
| 4.0 | 300000 (5 minutes) |
| 4.1 | 300000 (5 minutes) |
| 4.2 | 300000 (5 minutes) |
Tuning Recommendation
| Profile | Recommended | Why |
|---|---|---|
| producer / throughput | 300000 | The 5-minute metadata refresh interval is optimal for throughput: frequent refreshes (e.g., 30s) add metadata overhead on large clusters, while very infrequent refreshes delay routing updates after leader elections. |
| producer / latency | 30000 | Refreshing metadata every 30s instead of 5 minutes reduces the periodic background refresh interval; this shortens the window for stale-leader routing after a partition election. Note that errors like NOT_LEADER_OR_FOLLOWER already trigger an immediate refresh, so the practical impact is mainly on reducing the burst of retries before the first error-triggered refresh. |
Related Configs
Manage Kafka configs across all your clusters with Conduktor Console — view, compare, and update configurations in one place.