Dynamic merge for low-volume streams
Author: hengfeiyangCreated Sep 29, 2026Updated Sep 30, 2026
Problem
Every stream is partitioned by hour, so a stream has at least one object per hour however little data it holds. Low-volume streams end up with a very large number of very small objects. See #14846 for numbers.
Plan
Merge the files of a closed day in the compactor, by data volume. We call it dynamic merge.
- Write path unchanged. Ingester and WAL keep writing hourly partitions.
- Hourly merge unchanged. The current day is always hourly and indexed as today.
- After a day is closed, the compactor checks the day once. If the day holds many more files than its size needs, it merges them into
YYYY/MM/DD/00. - The time span of a merged file follows the data volume. A tiny stream gets one file per day, a medium stream gets a few files per day, a large stream is left as it is. One day is the upper bound; files never cross a day.
- Not only metrics. Logs, metrics and traces.
- Control. An environment variable lists the stream types that are enabled. A stream setting can override it per stream, on or off.
- Query. Streams with the feature enabled use a daily upper bound when selecting files.
Why not daily partitions on the write path
Ingester, querier and compactor would all have to agree on the partition level of a stream at the same moment, and changing the level of a live stream breaks that. Deciding after the day is closed avoids it, and needs no prediction of volume: the compactor reads the real size of the day.
Related
- #14846 original proposal
- #14907, #14908 earlier approach
- #14967 downsampling fix, a prerequisite
Source: openobserve/openobserve