15 Scalability and Performance Best Practices
These are from Laura Thomson of OmniTi:
- Profile early, profile often. Pick a profiling tool and learn it in and out.
- Dev-ops cooperation is essential. The most critical difference in organizations that handles crises well.
- Test on production data. Code behavior (especially performance) is often data driven.
- Track and trend. Understanding your historical performance characteristics is essential for spotting emerging problems.
- Assumptions will burn you. Systems are complex and often break in unexpected ways.
- Decouple. Isolate performance failures.
- Cache. Caching is the core of most optimizations.
- Federate. Data federation is taking a single data set and spreading it across multiple database/application servers.
- Replicate. Replication is making synchronized copies of data available in more than one place.
- 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
- Use a compiler cache. A compiler cache sits inside the engine and caches the parsed optrees.
- Be mindful of using external data sources. External data (RDBMS, App Server, 3rd Party data feeds) are the number one cause of application bottlenecks.
- Avoid recursive or heavy looping code. Deeply recursive code is expensive in PHP.
- Don’t Outsmart Yourself . Don’t try to work around perceived inefficiencies in PHP (at least not in userspace code!)
- Build with caching in mind. Caching is the most important tool in your tool box.