Skip to content

docs: add infra-layer cost optimization options - #66

Open
ai-yappa[bot] wants to merge 1 commit into
mainfrom
agent/slack-v1-T07DMLN1JE6-C0C172RQLSD-1789124600.547529
Open

ai-yappa[bot] wants to merge 1 commit into
mainfrom
agent/slack-v1-T07DMLN1JE6-C0C172RQLSD-1789124600.547529

Conversation

@ai-yappa

@ai-yappa ai-yappa Bot commented Sep 11, 2026

Copy link
Copy Markdown

What

Adds an infra-layer cost optimization section to PRODUCTION_READINESS.md, grounded in the current wrangler.toml and worker runtime code.

Why

The thread asked: "if we need to do cost optimization at infra layer, what are our options?" This documents the options against the deployment as it actually is today, and moves the P0 item ("document capacity limits, expected Cloudflare costs, and safe defaults") forward.

Contents

  • Cost driver inventory (resource → config → billing unit → current setting):
    • Sandbox Containers: instance_type = "standard-3", max_instances = 5, sleepAfter = "10m" override, keepAlive = true
    • Durable Objects (hibernatable WebSockets already in use, snapshots capped/debounced)
    • D1 (no retention), R2 backups (zstd, 30-day TTL), Observability (100% head_sampling_rate on logs + traces), Worker/assets (run_worker_first = true bills every asset fetch), CI (full sandbox image build per PR)
  • Ranked levers, including:
    1. Enforce guards already in schema — max_idle_time is persisted but never enforced; max_cost/max_steps are legacy columns only
    2. Right-size containers + lower sleepAfter + scope keep-alive to active runs
    3. Path-scope run_worker_first or serve the SPA from Pages
    4. Lower observability sampling (keep errors unconditional)
    5. D1/R2 retention and end-of-run backups
    6. Slim the sandbox image / improve workspace-cache hits
    7. LLM policy (adjacent — deepseek-v4-flash default already in place)
  • Recommended 7-step sequence (measure → enforce → right-size → assets → retention → sampling → alerts/commitments)

Notes

  • No runtime/config behavior is changed in this PR — it is an analysis document only; instance sizing and sampling changes should follow measurement.
  • docs/ is git-ignored in this repo (only force-added superpowers artifacts live there), so the content lives in the tracked PRODUCTION_READINESS.md instead of a new doc file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants