Skip to the content.

Task 81 — Kestrel tuning, framework rate limiter, compression, output cache

Phase: 5 Initiative: 45 Status: done Owner: hercules-coder Started: 2026-08-16 Completed: 2026-08-16 Slug: kestrel-rate-limiter-compression

Goal

WebAPI использует дефолтные Kestrel limits, custom RateLimitMiddleware (только /api/chat, без eviction idle IPs → unbounded memory), нет response compression, нет output cache. Дубль app.MapCache() (Program.cs:636-637). Для production API под нагрузкой это bottleneck.

Acceptance criteria

Sub-tasks

Scope / Likely files

src/agent/Hercules.WebApi/Program.cs, src/agent/Hercules.WebApi/Auth/RateLimitMiddleware.cs (remove), src/agent/Hercules.WebApi/Controllers/* (add output cache attributes), src/agent/appsettings.json

Dependencies

Risks / Rollback

Kestrel MaxConcurrentConnections=1000 может reject traffic под пиком; configurable. Output cache может serve stale data; короткий TTL (5 min) + invalidate on skill update. Rollback: вернуть custom middleware (но bugs останутся).

Implementation notes (2026-08-16)

Behaviour delivered

Components

Validation