← Back to PRs

#13127: perf(gateway): reduce idle CPU by increasing config and manifest cache TTL

by VintLin open 2026-02-10 04:38 View on GitHub →
size: XS
# 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