2. Background
Im working at MThai.com
The 3rd highest traf鍖c website in Thailand
Entertainment, News, Lifestyle portal
More than 500k visitors per day (millions page view)
Most of the website are implemented in wordpress
犖о険犖犖犖伍犖犖朽 7 犢犖÷県犖迦権犖 2010
3. Why wordpress?
Quickly developed
Easy for content team (Compare to other CMS)
Highly customizable
Good enough for most content-based website
犖о険犖犖犖伍犖犖朽 7 犢犖÷県犖迦権犖 2010
4. Problem with wordpress
Extensive use of database
Some page may take up to 50-100 queries
Slow page rendering (a lot of actions, 鍖lters)
犖о険犖犖犖伍犖犖朽 7 犢犖÷県犖迦権犖 2010
5. Solution 1
Just throw hardware at it
Buy a bigger, faster box
Scale vertically
犖о険犖犖犖伍犖犖朽 7 犢犖÷県犖迦権犖 2010
6. Solution 2
Buy more boxes
Horizontal scale
DNS load balancing (cheap) or hardware load balancing
(pretty expensive)
犖о険犖犖犖伍犖犖朽 7 犢犖÷県犖迦権犖 2010
7. Solution 3
Caching
Disk or memory
Queries or rendered pages
犖о険犖犖犖伍犖犖朽 7 犢犖÷県犖迦権犖 2010
9. wp-super-cache
Plugin : wp-super-cache
Cache the whole pages on local disk
No additional software required
High I/O usage for frequently updated site
犖о険犖犖犖伍犖犖朽 7 犢犖÷県犖迦権犖 2010
10. memcached backend
Cache queries, not page
Require memcached
Some queries are not cached (wordpress behavior)
犖о険犖犖犖伍犖犖朽 7 犢犖÷県犖迦権犖 2010
11. batcache
Similar approach to wp-super-cache
superman/batman - supercache/batcache
Store cached page in memcached
Reduce disk I/O load
Not much documented
犖о険犖犖犖伍犖犖朽 7 犢犖÷県犖迦権犖 2010
12. W3 Total cache
Able to cache pages or queries or both
Store cached data on disk or in memcached
Highly con鍖gurable
No problem so far
犖о険犖犖犖伍犖犖朽 7 犢犖÷県犖迦権犖 2010
13. Some tricky part
default-鍖lters.php
add_action('wp_head', 'start_post_rel_link', 10, 0);
Cause uncached query for every single post/page
Ugly table scan, using 鍖lesort query
Can kill your database if your site has high traf鍖c
犖о険犖犖犖伍犖犖朽 7 犢犖÷県犖迦権犖 2010
14. One line to solve it
Put it in your themes functions.php
remove_action('wp_head', 'start_post_rel_link', 10, 0);
犖о険犖犖犖伍犖犖朽 7 犢犖÷県犖迦権犖 2010
15. Multiple wordpress installations
memcached backend
Cache key collision -> change the global $blog_id
wp-super-cache
Con鍖gure different cache location
W3 total cache
Cache key collision on same domain -> hack
犖о険犖犖犖伍犖犖朽 7 犢犖÷県犖迦権犖 2010
16. Reduce # of HTTP requests
Combine CSS
Combine JavaScript
Use image sprite
Cache static 鍖les on users side
Consult Googles PageSpeed / Yahoos YSlow document
犖о険犖犖犖伍犖犖朽 7 犢犖÷県犖迦権犖 2010
17. Key idea
Dont let requests touch the database
Keep disk activity low
Scale horizontally
犖о険犖犖犖伍犖犖朽 7 犢犖÷県犖迦権犖 2010
18. Thank you!
If you want to contact me:
pittaya@gmail.com
twitter.com/pittaya
facebook.com/pittaya
www.pittaya.com
See you at BarCamp Bangkok !
犖о険犖犖犖伍犖犖朽 7 犢犖÷県犖迦権犖 2010