Help! My Site is Super Dynamic!
One of the most troublesome issues a developer or engineer can face is keeping your hosting cost low for a highly dynamic or inherently uncacheable site. How can a popular site that’s constantly updating scale well with spikes in traffic?
Many times the initial reaction will be: you simply can’t. Most systems that allow WordPress sites to scale well involve full-page caching, which simply isn’t an option for these types of sites. You need users to see the constant changes as they happen on the site, not minutes or hours later. These sites require a high level of dynamic content that is simply hard to accomplish.
If the budget simply won’t allow for more hardware, then it’s time to start thinking about what can and can’t be cached on the site. Is the header and footer going to always be the same no matter which user is on the site? Will the front page be the same? WordPress uses an Object Cache class which by default stores items wrapped in the wp_cache() function. By default the Object Cache is non-persistent, but you can couple it with Memcached to store the Object Cache items in Memory, to be served across all users.
By default WordPress will serve repeated query results from Object Cache. But really, anything you wrap in the wp_cache() function can be served from cache, including the HTML output from your header, footer, sidebar, and more. This is commonly known as “fragment caching.” WordPress provides some great examples of how to implement this on their Object Cache codex page.