Skip to content

feat: shrink an idle adaptive TSI series-id-set cache - #27698

Open
davidby-influx wants to merge 1 commit into
master-1.xfrom
DSB/cache_timeout
Open

davidby-influx wants to merge 1 commit into
master-1.xfrom
DSB/cache_timeout

Conversation

@davidby-influx

Copy link
Copy Markdown
Contributor

An adaptively sized series-id-set cache only shrinks while it is being read, so a shard that stops being queried keeps the memory it grew into forever.

The new option series-id-set-cache-idle-timeout (default 2h, 0 disables) fixes that. Once a shard's cache has served no reads for the timeout, it gives memory back in steps until it is back at series-id-set-cache-size. Any read stops the shrinking, and the cache grows again on demand. Shed entries are reported in a new idle_eviction statistic.

Closes https://github.com/influxdata/feature-requests/issues/699

An adaptively sized series-id-set cache only shrinks while it is being read,
so a shard that stops being queried keeps the memory it grew into forever.

The new option series-id-set-cache-idle-timeout (default 2h, 0 disables)
fixes that. Once a shard's cache has served no reads for the timeout, it
gives memory back in steps until it is back at series-id-set-cache-size.
Any read stops the shrinking, and the cache grows again on demand. Shed
entries are reported in a new idle_eviction statistic.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The changed exported constructor signature breaks existing downstream callers at compile time.

1 open finding
What changed in this PR

Adds idle shrinking to adaptive TSI series-ID-set caches so inactive shards release borrowed capacity.

Changes:

  • Adds configurable idle timeout with validation and defaults.
  • Implements idle sweeping, eviction statistics, and lifecycle handling.
  • Adds policy, concurrency, integration, and configuration tests.
File Description
tsdb/​index/​tsi1/​index.go Wires timeout and sweeper lifecycle into TSI indexes.
tsdb/​index/​tsi1/​index_test.go Tests index-level shrinking and lifecycle behavior.
tsdb/​index/​tsi1/​export_test.go Exposes cache state to external tests.
tsdb/​index/​tsi1/​cache.go Implements idle shrinking and statistics.
tsdb/​index/​tsi1/​cache_test.go Extensively tests policy and concurrency behavior.
tsdb/​config.go Defines and validates the timeout setting.
tsdb/​config_test.go Tests timeout validation and TOML handling.
etc/​config.sample.toml Documents the new configuration option.

🧠 Review effort: Balanced


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread tsdb/index/tsi1/cache.go
@davidby-influx
davidby-influx marked this pull request as ready for review October 13, 2026 19:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants