Skip to content

Server Performance Guide

Hardware: 6 cores / 32GB RAM
Stack: Caddy → FastAPI (uvicorn) + MkDocs static


Caddy Config

See Caddyfile for the full configuration.

Key settings: - encode zstd gzip — compresses HTML/JS/CSS ~70%, massive bandwidth savings - Cache-Control: max-age=3600 — browsers cache static assets for 1 hour - reverse_proxy for API only — static files served directly by Caddy

FastAPI / uvicorn

Start command for 6 cores (leave 2 for Caddy):

uvicorn wiki.api:app --host 127.0.0.1 --port 8000 --workers 4 --loop uvloop

uvloop is 2-4x faster than the default asyncio loop. Install: pip install uvloop.

Memory

32GB is far more than needed. Current usage estimate: - Caddy: ~50MB - uvicorn x4 workers: ~200MB total - MkDocs search index (3.9MB loaded): ~50MB - Total: ~300MB — 31.7GB headroom

Consider using excess RAM as tmpfs for the wiki site:

mount -t tmpfs -o size=2G tmpfs /var/www/smarthub.my/wiki/site

This puts the entire static site in RAM. Page load = RAM speed.

Expected Performance

  • Static pages: <5ms response time
  • API calls: <50ms
  • Concurrent users: 1000+ without degradation