From 39bf9ed18aaaa785cbb5fad39f8a1ed704354cca Mon Sep 17 00:00:00 2001 From: Danny Kopping Date: Tue, 30 Dec 2025 13:44:34 +0200 Subject: [PATCH] perf: increase bridge pool cache size limit (#21399) With this low upper bound, the cache thrashes under load (i.e. cache entries are replaced too quickly), leading to audit records not persisting in time before the context is canceled (see `OnEvict` behaviour). The TTL remains 15m because we need to keep MCP connections relatively fresh, but this TTL is irrelevant if injected tools are not used. This was an oversight; the limit should never have been set so low. 5000 is likely so large that the cache will never fill up; in future we should make this configurable if customers run into issues. It's a bit difficult right now to determine how much real memory each element _actually_ uses, but even if it's a crazy number like 100KiB per instance then it'll only use 500MiB. Signed-off-by: Danny Kopping --- enterprise/aibridged/pool.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/enterprise/aibridged/pool.go b/enterprise/aibridged/pool.go index 1fe5b11fe5..8459f867ad 100644 --- a/enterprise/aibridged/pool.go +++ b/enterprise/aibridged/pool.go @@ -41,7 +41,7 @@ type PoolOptions struct { TTL time.Duration } -var DefaultPoolOptions = PoolOptions{MaxItems: 100, TTL: time.Minute * 15} +var DefaultPoolOptions = PoolOptions{MaxItems: 5000, TTL: time.Minute * 15} var _ Pooler = &CachedBridgePool{}