Performance & Speed Playbook

Performance & Speed Playbook

Goal

  • Sub-second TTFB
  • High cache-hit ratio
  • Stable p95 latency under load

Dynamic webpages caching

  • Cache dynamic HTML for key templates like Home, PDP, and PLP
  • Use query-string-aware cache keys per URL and query
  • Cache safely - avoid caching personalized or session-dependent responses

Edge delivery and optimization

  • Edge cache static assets aggressively to reduce origin dependency and absorb traffic spikes
  • Optimize images on the fly - resize and compress, and convert to modern formats when supported
  • Use a global CDN footprint to reduce latency and improve resilience
  • Use Anycast authoritative DNS for fast resolution and DDoS-resilient nameservers
  • Keep origin hosting optimized for the web server and database, with CDN offload to minimize origin load

Database performance

Structure

  • Choose clustered primary keys carefully
  • Avoid wide clustered keys
  • Keep a normalized core model
  • Use pre-aggregated or materialized tables for heavy read patterns

Indexes

  • Maintain optimized indexes
  • Run periodic index maintenance
  • Use computed and persisted columns where helpful
  • Use full-text catalogs for search where relevant

Queries

  • Use parameterized SQL to avoid ad-hoc plan bloat
  • Batch writes
  • Paginate reads
  • Avoid RBAR (row-by-agonizing-row)

Block unwanted traffic

  • Block traffic by country or region at the edge to reduce bot and scanner traffic before it reaches the site
  • Block suspicious IP addresses and ranges at the web server
  • Block known bad bots via User-Agent pattern rules at the web server level