22. Database slowness
Many backend performance issues are caused by too many, or
slow queries.
Mysql has a pretty terrible query planner.
Sub-queries and derived table joins will eventually catch fire.
Slow query logs, mtop, or monitoring like new relic are your best
friend.
23. Database slowness
Slow query logs - Percona makes great tools for MySQL.
Disable query caching.
Run EXPLAIN on slow queries.
Add indexes/tweak queries, and repeat.
27. Caching
Can be expensive to rollout, if you need new infrastructure
Cache expiration is really really hard.
28. What to Cache
Results that don’t change often
Use monitoring/analytics to find the busiest pages.
Start using caching there.
Expand once you’ve learned more.
29. Where to cache
Hopefully in Memcache/Redis
Failing that in Apc/Wincache
Files - Sometimes not faster.
41. XHProf
PECL extension produced by Facebook.
Captures runtime metrics at a function level.
Possible to use in a sub-sample of production unlike xdebug.