vectordotdev/vector

Safeguard `reduce` transform memory use

开放

#3,027 创建于 2020年7月10日

 (2 条评论) (2 个反应) (0 位负责人)Rust (2,126 个派生)batch import
domain: performancedomain: reliabilitygood first issuehave: shouldtransform: reduce

仓库指标

星标
 (21,837 个星标)
PR 合并指标
 (PR 指标待抓取)

描述

There are two closely related potential issues with the merge transform as implemented in #2870.

First, we have no upper limit on the potential memory use of the merge states. If the identifier fields are misconfigured, we could end up storing an unbounded amount of data in memory until it expires, and the expiration window is large enough that the chance of OOM is real. Ideally, we should have a configurable solution here similar to the tag cardinality limit transform.

The second and much smaller issue is that the hashmap we use to store those merge states is never resized down. This means it will remain the largest size it has ever grown to, even if that was an outlier. I suspect that this is not much of an issue, because the vast majority of state stored in that hashmap is heap-allocated and will get reclaimed as it expires. That being said, it's still worth investigating how much memory is used by the hashmap itself and if there are any convenient points at which we could resize it down.

贡献者指南