Skip to content

Instantly share code, notes, and snippets.

@alex
Created May 2, 2015 17:24
Show Gist options
  • Save alex/79f0b0507f4e5774726b to your computer and use it in GitHub Desktop.
Save alex/79f0b0507f4e5774726b to your computer and use it in GitHub Desktop.

Tips for Scaling Web Apps

  • Magic numbers
    • 100ms ideal 50th percentile latency, 1 second 98th percentile solid
    • A medium sized physical box (8 cores, 24GB of RAM) should be able to do thousands of requests per second
  • Monitoring and metrics
  • Deployment strategies
    • Roll web nodes a few at a time, drain connections
  • Static assets
    • CDN
    • Immutable asset names
  • Sessions
    • Use authenticated (+ encrypted) cookies if at all possible
    • Fallback use a simple K/V store, best-effort persistence is fine (e.g. memcached)
  • Load balancer
    • Put your web nodes behind one from the start
    • Min-conn is a good distribution strategy
    • Health check every few seconds
  • Databases
    • For most applications a relational database is fine
    • Read replicas
    • Put analytics workloads on a different replica (WAL-E)
  • Caching
    • Use memcached for 99% of workloads
    • Use it judiciously, don't depend on it
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment