#13127: perf(gateway): reduce idle CPU by increasing config and manifest cache TTL
size: XS
Cluster:
Timeouts and Memory Management Fixes
# Problem
The Gateway periodically checks for configuration and plugin manifest changes.
The default cache TTL of 200ms caused excessive disk I/O (up to 5 stat calls/sec)
even when the system was completely idle, leading to unnecessary CPU overhead.
# Changes
- Increased 'DEFAULT_CONFIG_CACHE_MS' to 5000ms in 'src/config/io.ts'.
- Increased 'DEFAULT_MANIFEST_CACHE_MS' to 5000ms in 'src/plugins/manifest-registry.ts'.
# Validation
- Verified TTL increase via code audit.
- Ensured no regressions in configuration loading logic via 'pnpm tsgo'.
Fixes #11621
<!-- greptile_comment -->
<h2>Greptile Overview</h2>
<h3>Greptile Summary</h3>
This PR reduces idle gateway CPU/disk churn by increasing two short-lived caches from 200ms to 5000ms:
- `src/config/io.ts` raises `DEFAULT_CONFIG_CACHE_MS`, which gates how often `loadConfig()` re-reads/parses the config file when caching is enabled via `OPENCLAW_CONFIG_CACHE_MS`.
- `src/plugins/manifest-registry.ts` raises `DEFAULT_MANIFEST_CACHE_MS`, which controls the TTL of the in-memory `registryCache` used by `loadPluginManifestRegistry()`.
These changes fit into the existing design where both caches can still be disabled via env flags (`OPENCLAW_DISABLE_CONFIG_CACHE`, `OPENCLAW_DISABLE_PLUGIN_MANIFEST_CACHE`) or set to `0` to force fresh reads.
<h3>Confidence Score: 5/5</h3>
- This PR is safe to merge with minimal risk.
- The change is a straightforward constant-only TTL increase in two isolated caches; the cache behavior, disable flags, and env overrides remain unchanged, and there are no API/signature changes or side effects beyond reduced polling frequency.
- No files require special attention
<!-- greptile_other_comments_section -->
<!-- /greptile_comment -->
Most Similar PRs
#5823: fix(config): exit cleanly on invalid config instead of high CPU loop
by gavinbmoore · 2026-02-01
73.3%
#10280: fix(infra): add max size limit to Tailscale whois cache to prevent ...
by programming-pupil · 2026-02-06
73.3%
#10636: fix: setTimeout integer overflow causing server crash
by devmangel · 2026-02-06
73.3%
#10997: fix: enable cache-ttl pruning on first load after restart
by anotb · 2026-02-07
73.0%
#8745: fix(gateway): respect gateway.port config and --port CLI flag
by revenuestack · 2026-02-04
72.8%
#15611: fix(gateway): invalidate hook transform cache on config reload
by AI-Reviewer-QS · 2026-02-13
71.4%
#7382: fix: remove config.schema from agent gateway tool
by kakuteki · 2026-02-02
71.3%
#12425: feat(core): Native Token Optimization Defaults (Pruning, Compaction...
by oneles · 2026-02-09
71.3%
#10034: Don't crash gateway on transient unhandled fetch failures
by gigq · 2026-02-06
71.2%
#8713: feat: gateway memory monitor, install linger, docs and failover
by quratus · 2026-02-04
71.0%