Professional Documents
Culture Documents
Practices
Laura Thomson
OmniTI
laura@omniti.com
1
Standing in for George
2
Scalability vs. Performance
3
Why are Scalability and
Performance Important?
No hope of growth otherwise.
Scalability means you can handle
service commitments of the future.
Performance means you can handle the
service commitments of today.
Both act symbiotically to mean cost-
efficient growth.
4
Why PHP?
7
No Fast = True
8
General Best Practices
9
Scalability Best Practices
1. Decouple.
2. Cache.
3. Federate.
4. Replicate.
5. Avoid straining hard-to-scale
resources.
10
Performance Best Practices
11
1. Profiling
12
2. Dev-Ops Cooperation
13
3. Test on Production(-ish) Data
14
4. Track and Trend
15
Access log timings
16
5. When you assume…
18
Example:
Static versus dynamic content
Apache + PHP is fast for dynamic
content
Waste of resources to serve static
content from here: images, CSS,
JavaScript
Move static content to a separate faster
solution for static content e.g. lighttpd
on a separate box -> on a
geographically distributed CDN
19
Example: Session data
20
7. Cache
21
Caching examples
23
9. Replicate
27
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
Be aware of these limitations and be extra
careful with these resources.
Try and poke holes in the assumptions about
why the data is hard to manage.
28
11. Compiler Cache
30
Managing external data and
services
Cache it (beware of AUPs for APIs)
Load it dynamically
(iframes/XMLHttpRequest)
Batch writes
31
Query tuning
33
Schema design (MySQL)
34
Queries
35
13. Be Lazy
36
14. Don’t Outsmart Yourself
37
15. Caching
39