segment.bytes Within Sane Operational Bounds
segment.bytes must be between 64 MiB and 2 GiB.
Rationale
Tiny segments (some teams set 1MB "for faster deletion") explode open-file count and cripple controller failover. Huge segments (>2GB) delay retention by hours because nothing rolls. Both are common foot-guns from copy-pasted blog configs.
Pattern
67108864 (64 MiB) <= segment.bytes <= 2147483648 (2 GiB)
Examples
segment.bytes: 268435456 (256 MB)
segment.bytes: 1073741824 (1 GB)
segment.bytes: 1048576 (1 MB)
segment.bytes: 5368709120 (5 GB)
Parameters
| Name | Default | Description |
|---|---|---|
min_bytes |
67108864 |
Minimum segment.bytes (64 MiB). |
max_bytes |
2147483648 |
Maximum segment.bytes (2 GiB). |
Governs
This policy relates to the following Kafka configuration keys:
Implementation
Drop this YAML into Conduktor Console as a ResourcePolicy, then link it from an ApplicationInstance, Application, or KafkaCluster.
Conduktor ResourcePolicy
# Conduktor self-service ResourcePolicy # Topics that don't override segment.bytes inherit broker default and pass vacuously. --- apiVersion: self-serve/v1 kind: ResourcePolicy metadata: name: segment-bytes-sane-bound spec: targetKind: Topic description: segment.bytes must be in [64 MiB, 2 GiB] rules: - condition: '!("segment.bytes" in spec.configs) || (int(string(spec.configs["segment.bytes"])) >= 67108864 && int(string(spec.configs["segment.bytes"])) <= 2147483648)' errorMessage: "segment.bytes must be between 64MiB and 2GiB — tiny segments blow up file count, huge segments delay retention"
Related policies
Try Conduktor Console
Enforce policies like this across your team — central audit history, pre-commit guardrails, ApplicationInstance bindings. 5-min Docker install.
Get Started →