Skip to content

feat: raise default sizes for non-evictable shared dicts#13688

Merged
nic-6443 merged 2 commits into
apache:masterfrom
nic-6443:feat/raise-shared-dict-defaults
Jul 10, 2026
Merged

feat: raise default sizes for non-evictable shared dicts#13688
nic-6443 merged 2 commits into
apache:masterfrom
nic-6443:feat/raise-shared-dict-defaults

Conversation

@nic-6443

@nic-6443 nic-6443 commented Jul 10, 2026

Copy link
Copy Markdown
Member

Description

The prometheus-metrics, service-discovery (kubernetes / consul / nacos), and tracing_buffer shared dicts reject writes and drop data when full — unlike caches such as plugin-limit-count or balancer-ewma, they have no self-healing eviction. Their current defaults overflow on medium and large deployments, producing symptoms that are hard to diagnose: silently missing Prometheus series, upstream nodes that never resolve, or lost trace spans.

This raises the defaults so a typical deployment works without hand-tuning lua_shared_dict / shared_size:

Dict Old New Stores Scales with
prometheus-metrics 15m (meta) / 10m (http) 128m metric series route × label × bucket cardinality
kubernetes / consul shared_size 1m 64m discovered endpoints services × nodes
nacos / nacos-stream 10m 64m discovered endpoints services × nodes
tracing_buffer 10m 32m span backlog awaiting report in-flight span volume

Backward compatible. An explicit size in config.yaml (or a discovery config's shared_size) always overrides the default, so deployments that already tune these are unaffected.

Trade-off. These are larger reserved zones. On Linux the memory is committed lazily as a dict actually fills, so a small/idle deployment does not pay the full cost up front, and deployments that don't use a subsystem (discovery / tracing) can lower or omit the value. Feedback on the exact defaults is welcome — the intent is to pick values that cover the majority of deployments rather than the smallest possible footprint.

Checklist

  • Docs updated (kubernetes discovery shared_size default, en + zh)
  • Tests updated (CLI render + kubernetes discovery default assertions)
  • Verified locally that the rendered nginx.conf reflects the new defaults

The prometheus-metrics, service-discovery, and tracing shared dicts
reject writes and drop data when full, with no self-healing eviction.
Their previous defaults overflow on medium and large deployments,
causing silently missing metrics, unresolved upstream nodes, or lost
trace spans that are hard to diagnose.

Raise the defaults so a typical deployment works without manual tuning:

- prometheus-metrics: 15m/10m -> 256m
- kubernetes / consul discovery shared_size: 1m -> 64m
- nacos / nacos-stream discovery: 10m -> 64m
- tracing_buffer: 10m -> 32m

An explicit size in config.yaml (or a discovery config's shared_size)
always overrides the default, so deployments that already tune these
are unaffected.

Signed-off-by: Nic <qianyong@api7.ai>
@dosubot dosubot Bot added enhancement New feature or request size:M This PR changes 30-99 lines, ignoring generated files. labels Jul 10, 2026
moonming
moonming previously approved these changes Jul 10, 2026
AlinsRan
AlinsRan previously approved these changes Jul 10, 2026
128m covers typical Prometheus series counts while keeping reserved shared
memory and the metrics endpoint response size reasonable; raise it for
high-cardinality deployments.

Signed-off-by: Nic <qianyong@api7.ai>
@nic-6443 nic-6443 dismissed stale reviews from shreemaan-abhishek, AlinsRan, and moonming via d242314 July 10, 2026 08:50
@nic-6443 nic-6443 requested review from AlinsRan and moonming July 10, 2026 10:10
@nic-6443 nic-6443 merged commit 2790b2f into apache:master Jul 10, 2026
26 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request size:M This PR changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants