Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions benches/files.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ fn build_file_benchmark_environment(
timezone: Default::default(),
internal_metrics: Default::default(),
truncate: Default::default(),
batch: Default::default(),
},
);

Expand Down Expand Up @@ -125,6 +126,7 @@ fn benchmark_files_no_partitions(c: &mut Criterion) {
timezone: Default::default(),
internal_metrics: Default::default(),
truncate: Default::default(),
batch: Default::default(),
},
);

Expand Down
23 changes: 23 additions & 0 deletions changelog.d/20394_file_sink_batching.enhancement.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
The `file` sink now batches events per destination path before writing. Events sharing the
same rendered path are accumulated into a single buffer and flushed with one write syscall
per batch, rather than one syscall per event.

This significantly reduces overhead when routing to many partitions — for example, writing
one file per Kafka topic with a path template like `/data/topics/{{ _topic }}/events.log`.
Throughput on a single file improves ~10x; high-partition workloads (64 topics) improve ~13%.

Batching is controlled by the new `batch` configuration block:

```yaml
sinks:
file_out:
type: file
path: /data/topics/{{ _topic }}/events.log
batch:
max_bytes: 10485760 # 10 MiB (default)
timeout_secs: 1 # flush after 1 second of inactivity (default)
```

Issue: https://github.com/vectordotdev/vector/issues/20394

authors: mbergman
Loading
Loading