How to reduce file source ingestion latency for near real-time log collection?Q&A #26029
QuestionI am using Vector 0.56.0 Current environment:
The observed end-to-end latency is around 0.5~2 seconds. I investigated the delay and found that the backoff_cap = if global_bytes_read == 0 {
cmp::min(2_048, backoff_cap.saturating_mul(2))
} else {
1
};My understanding is that this can cause a newly appended log line to wait until the next polling cycle. I have tried tuning:
but these do not appear to affect this specific delay. My goal is to achieve lower latency for interactive log viewing use cases. Are there recommended configurations or deployment patterns for reducing file source ingestion latency? Would another Vector source type or architecture be more appropriate for this use case? Vector ConfigapiVersion: v1 data: apiVersion: apps/v1 metadata: spec: selector: template: The above configuration is a simplified version of my production setup. The actual deployment sends events to an HTTP sink, but the observed delay remains the same when using console sink, which indicates that the delay happens before the sink stage. Vector LogsNo response |
Replies: 1 comment 3 replies
|
The first thing I would A/B test is the
Try this first: multiline:
mode: halt_before
start_pattern: '^\d{4}-\d{2}-\d{2}'
condition_pattern: '^\d{4}-\d{2}-\d{2}'
timeout_ms: 100Or temporarily remove The file polling delay you found is real too. In 0.56.0, reads of existing files use an adaptive sleep that doubles while idle and is hard-capped at 2,048 ms (read loop, backoff). That gives you two separate latency sources: up to 1 second from multiline buffering and up to about 2 seconds from an idle file watcher. Lowering the multiline timeout should improve the usual case, but there is no configuration knob for the file read backoff in 0.56.0. If consistently sub-100 ms delivery is a hard requirement, I would avoid the |
Your measurements match the 0.56.0 read loop.
There is no file-source scheduling setting that changes this behavior. After a successful read, the backoff resets to 1 ms. Each empty poll then doubles it until it reaches 2,048 ms.
glob_minimum_cooldown_msonly affects file discovery, andmax_read_bytesonly affects how much is read once data is available.So yes, a naturally busy file stays on the fast path and will usually have much lower polling delay. A sparse file eventually reaches the 2,048 ms sleep, so a new line can wait close to two seconds before Vector sees it. I would not add artificial heartbeat lines just to keep the reader active, since that changes the log stream and only wo…