Skip to content

Instantly share code, notes, and snippets.

@ndelage
Last active February 7, 2019 06:50
Show Gist options
  • Save ndelage/6054164 to your computer and use it in GitHub Desktop.
Save ndelage/6054164 to your computer and use it in GitHub Desktop.
Web Performance

Web Preformance

Sources of slow

Database

  • n+1 queries (try :includes or join)
  • Complex joins (is there another way to find the data?)
  • Missing indexes
  • Useless indexes
  • Schema (prossibly denormalize)
  • DB Tuning - cache size limits matter
  • If you can't fit your DB in RAM, you're gonna have problems

Ruby & Rails

  • Review your logs!
  • Long pages, multitute of partial render calls (memcached)
  • Deep object trees (re-org, possibly just for one page scenario)
  • Many small DB queries (:includes or :join)
  • Service calls (background these if possible)
  • Make your selects with the DB, not Ruby! (avoid enumerable, try pluck)
  • Garbage Collection time (create multiple apps)
  • Try a different runtime, JRuby can lower mem usage
  • You should have a different App server & Assets server
  • Scale horizonatally

Client Side

  • Unbundled/unminified assets (asset pipeline or equiv)
  • Too many images (try sprites of load via JS)
  • JQuery style UI annimations (use CSS animations whenever possible)
  • Cache headers (for images, JS & CSS)
  • Simplify HTML

Links

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