15 Scalability and Performance Best Practices

These are from Laura Thomson of OmniTi:

  1. Profile early, profile often. Pick a profiling tool and learn it in and out.
  2. Dev-ops cooperation is essential. The most critical difference in organizations that handles crises well.
  3. Test on production data. Code behavior (especially performance) is often data driven.
  4. Track and trend. Understanding your historical performance characteristics is essential for spotting emerging problems.
  5. Assumptions will burn you. Systems are complex and often break in unexpected ways.
  6. Decouple. Isolate performance failures.
  7. Cache. Caching is the core of most optimizations.
  8. Federate. Data federation is taking a single data set and spreading it across multiple database/application servers.
  9. Replicate. Replication is making synchronized copies of data available in more than one place.
  10. Avoid straining hard-to-scale resources. Some resources are inherently hard to scale: Uncacheable’ data, Data with a very high read+write rate,  Non-federatable data, Data in a black-box
  11. Use a compiler cache. A compiler cache sits inside the engine and caches the parsed optrees.
  12. Be mindful of using external data sources. External data (RDBMS, App Server, 3rd Party data feeds) are the number one cause of application bottlenecks.
  13. Avoid recursive or heavy looping code. Deeply recursive code is expensive in PHP.
  14. Don’t Outsmart Yourself . Don’t try to work around perceived inefficiencies in PHP (at least not in userspace code!)
  15. Build with caching in mind. Caching is the most important tool in your tool box.