DEV Community

Cover image for Improve WordPress Performance With Object Cache
Christian Ahrweiler
Christian Ahrweiler

Posted on

Improve WordPress Performance With Object Cache

WordPress does a lot of repeated work.

Every time someone opens a page, WordPress has to load settings, posts, menus, plugin data, user data, temporary data, and many other small pieces of information.

A lot of this information is used again and again.

Without an object cache, WordPress may have to ask the database for the same data repeatedly. That costs time and makes the server work harder than necessary.

This is where object caching helps.

An object cache keeps frequently used WordPress data in memory, so WordPress can reuse it faster the next time. Instead of going back to the database again, it can load the data from memory.

The result: less database work, less server load, faster response.

Increase WordPress Performance with Object CacheObject cache needs storage

An object cache needs a place where it can keep the cached data.
There are different options for this. Some setups use Redis, Memcached, or even files. But for a typical single-server WordPress setup, the fastest option is often APCu.

APCu stores cached data directly in the server's local PHP memory. That makes it very fast, because WordPress can access the cached data without a network connection, without a file lookup, and without another database request.

My takeaway

Improving WordPress performance is about making WordPress do less repeated work.

For this, I use atec-Cache-APCu.

It adds APCu-based object caching to WordPress and keeps frequently used data in fast local memory.

With more than 3,000 active installations, it is already used by many WordPress sites that want a simple local-memory object cache.

Note: atec-Cache-APCu also checks whether your server supports APCu. If APCu is available, you can enable APCu object caching directly. If not, APCu needs to be enabled on the server first.

Top comments (0)