Upload
topher1kenobe
View
230
Download
2
Embed Size (px)
DESCRIPTION
Discusses various methods of server side caching for WordPress.
Citation preview
Site CachingFrom Nothing To Everything
Site Caching, From Nothing To EverythingTopher DeRosia
@topher1kenobe
Hi, my name is TopherI’m a WordPress developer from
Grand Rapids MI
@topher1kenobe
Site caching, from nothing to everythingTopher DeRosia, http://XWP.co
@topher1kenobe
http://XWP.co
Cache
Site Caching, From Nothing To EverythingTopher DeRosia
@topher1kenobe
Synonyms:hoard, stockpile, reserve,store, stash
Bonus Homonym: Cash
Why Cache?
Site Caching, From Nothing To EverythingTopher DeRosia
@topher1kenobe
End User Speed
Server Health
SEO
What are we fixing?
Site Caching, From Nothing To EverythingTopher DeRosia
@topher1kenobe
Slow database queriesAnalyze with Query Monitor:https://wordpress.org/plugins/query-monitor/
Large, uncompressed files
Inefficient software
What does caching do?
Site Caching, From Nothing To EverythingTopher DeRosia
@topher1kenobe
It saves a plain html version of a WordPress generated page.
It then serves that plain html version instead of letting WordPress do all that work again.
This is MUCH faster.
Step 1, cache all the things!
Site Caching, From Nothing To EverythingTopher DeRosia
@topher1kenobe
WP Super Cachehttps://wordpress.org/plugins/wp-super-cache/
W3 Total Cachehttps://wordpress.org/plugins/w3-total-cache/
Batcachehttps://wordpress.org/plugins/batcache/
WP Rockethttp://wp-rocket.me/
Gee, zipping is cool!
Site Caching, From Nothing To EverythingTopher DeRosia
@topher1kenobe
Gzip is a compression program. Good caching plugins allow you to gzip your cached page.
On topher1kenobe.com:
Watch out for SEO plugins!
Site Caching, From Nothing To EverythingTopher DeRosia
@topher1kenobe
They’re greedy, and flush the cache too often.
On high traffic sites it can be more than once per second.
Step 2, Efficient web servers
Site Caching, From Nothing To EverythingTopher DeRosia
@topher1kenobe
Apache: powerful, awesome, SLOW
Nginx: fewer features, similar to Apache for dynamic content, FAST serving static content
Step 2a, reverse proxy
Site Caching, From Nothing To EverythingTopher DeRosia
@topher1kenobe
Use Apache to serve dynamic pages, Nginx or Varnish to serve static pages
Step 3, Speedy PHP Parser
Site Caching, From Nothing To EverythingTopher DeRosia
@topher1kenobe
mod_php: Apache module. Fast enough.
php-fcgi: quite fast, very common
php-fpm: VERY fast, awesome.
hhvm: blindingly fast, can be buggy
Step 4, memcache
Site Caching, From Nothing To EverythingTopher DeRosia
@topher1kenobe
Generic data storage in RAM. Super fast.
IMPORTANT: permanently borrows system RAM. Don’t take too much.
Step 5, OpCode Cache
Site Caching, From Nothing To EverythingTopher DeRosia
@topher1kenobe
Stores compiled PHP in RAM, causing the app itself to be faster.
APC (Alternative PHP Cache)XCacheZend OpCache
Use what your sysadmin is comfortable with
https://en.wikipedia.org/wiki/List_of_PHP_accelerators
Step 6, Fragment caching
Site Caching, From Nothing To EverythingTopher DeRosia
@topher1kenobe
Full page caching usually isn’t much help for people who are logged in.
1. You2. Subscribers3. Community members (BuddyPress, bbPress)4. Content managers
Transients
Site Caching, From Nothing To EverythingTopher DeRosia
@topher1kenobe
Fragments of data you can store in a cache with PHP.
http://codex.wordpress.org/Transients_API
Results of complex queriesResults of remote data calls
Finding Slow Spots
Site Caching, From Nothing To EverythingTopher DeRosia
@topher1kenobe
Several different plugins can help find slow spots:
Query Monitorhttps://wordpress.org/plugins/query-monitor/
Debug Bar ( many addons )https://wordpress.org/plugins/debug-bar/
THANKS FOR
LISTENING
Site Caching, From Nothing To EverythingTopher DeRosia
@topher1kenobe
http://topher1kenobe.comFollow me @topher1kenobe