Agent-Hellboy / Agent-Hellboy/mcp-runtime

fix(mcp-gateway): add jitter to policy reload ticker to prevent thundering herd

Open
#304 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
6
Forks
1
Avg merge
11h 33m
Merged PRs (30d)
13

Description

## Problem
All gateway replicas start a `time.NewTicker(5 * time.Second)` at process start. With many MCPServer pods they all hit the Kubernetes ConfigMap API at the same wall-clock tick, creating a thundering herd every 5 seconds.

## Fix
Add up to 2s of random jitter to the ticker interval in `policy_cache.go`:

```go
jitter := time.Duration(rand.N(2000)) * time.Millisecond
ticker := time.NewTicker(5*time.Second + jitter)
```

## Files
- `services/mcp-gateway/policy_cache.go`

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.