Repository navigation
perf: land the MCP cost fix (never merged in #18) + lower rate limit 20->5 - #19
Merged
Merged
Conversation
The hosted MCP (web/mcp) was the real cost driver: ~20% of invocations hit the 60s wall because focused_crawl fetches up to 10 pages at a 10s per-page timeout (worst case 100s). On Hobby memory is fixed at 1 GB, so duration is the only lever. - mcp_server.focused_crawl/compare_strategies: thread a `timeout` param down to the strategy/compare calls (default 10s unchanged for local). - mcp_http: pass HOSTED_TIMEOUT=5s per page; lower caps MAX_PAGES 10->8 and MAX_COMPARE_PAGES 6->5. Worst case now ~8*5=40s, inside budget. - vercel.json: maxDuration landing 60->10, MCP 60->45. - tests: assert the hosted handlers forward the tighter timeout. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Cuts the volume a single client can push at the hosted /mcp endpoint, which is the main remaining cost driver. Best-effort (in-memory, per warm instance), so it throttles a hammering IP without being a hard cap. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
The landing /crawl demo fetches up to 20 pages and needs ~60s; 10s would kill it mid-crawl. Landing cost is negligible (~0.0038 GB-Hrs), so lowering it saves nothing while breaking a feature. Only the MCP is capped (45s). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
El PR #18 solo mergeó el cambio de PostHog (
analytics.py). El commit grande que de verdad corta el gasto (acotar el crawl del MCP) se pusheó a la rama después del merge y quedó huérfano — nunca entró amainni se desplegó. Este PR lo recupera (cherry-pick) y además baja el rate limit.Qué incluye
1. El fix de costo que faltaba (lo que mueve la gráfica):
mcp_http:HOSTED_TIMEOUT = 5spor página; topesMAX_PAGES 10→8,MAX_COMPARE_PAGES 6→5. Peor caso ~8×5 = 40s, dentro del presupuesto.mcp_server.focused_crawl/compare_strategies: se threadeatimeout(default 10s intacto para local).vercel.json:maxDurationlanding 60→10, MCP 60→45.2. Nuevo — bajar el rate limit:
RATE_LIMIT 20 → 5req/min por IP. Corta el volumen que una sola IP puede meter al/mcp. Best-effort (en memoria, por instancia caliente), así que frena una IP martillando sin ser tope duro.Contexto
En Hobby la memoria está fija en 1 GB, así que las únicas palancas de costo son duración (fix 1) y volumen (fix 2). El MCP era el 99% del gasto con ~20% de timeouts de 60s.
Tras merge + redeploy
🤖 Generated with Claude Code