---
name: "uvicorn-asgi-server-worker-tuning"
description: "Deploy high-concurrency FastAPI/Starlette applications with Uvicorn and Gunicorn processes."
metadata:
  author: "Encode"
  version: "1.0.0"
  runtime_compatibility:
    - "codex"
    - "claude-code"
    - "cursor"
    - "windsurf"
triggers:
  - "tune uvicorn workers"
  - "gunicorn uvicornworker production"
  - "uvloop performance uvicorn"
permissions:
  fs_read: true
  fs_write: "workspace"
  shell_exec: false
  net_access: false
---

# Uvicorn ASGI Server Tuning & Gunicorn Worker Management

Configures Uvicorn production deployments: tuning worker counts (gunicorn -k uvicorn.workers.UvicornWorker), loop backends (uvloop), HTTP parser (httptools), SSL termination, and graceful shutdown timeouts.

## When to Invoke
Invoke this skill whenever you need to:
- tune uvicorn workers
- gunicorn uvicornworker production
- uvloop performance uvicorn

## Execution SOP & Rules
1. Install performance extras: pip install uvicorn[standard] uvloop httptools.
2. Run with Gunicorn: gunicorn -w 4 -k uvicorn.workers.UvicornWorker -b 0.0.0.0:8000 app.main:app.
3. Set graceful shutdown: --graceful-timeout 30 --timeout 60.
4. Verify uvloop event loop is active in startup logs: 'Using asyncio event loop: uvloop'.

## Verification Checklist
- Run local linting, syntax validation, and type-checks before reporting completion.
- Ensure all created or modified files adhere to workspace boundaries and avoid uncommitted secrets.
- Verify tests or build commands exit cleanly with return code 0.
