Skip to content
RustPress

Documentation Run

Performance

How RustPress stays fast: a full-page cache that stays correct, a CDN with Cloudflare purging, Redis, Valkey or Memcached, compression, plugin scope, OPcache and background jobs.

Updated

This page explains what RustPress does to serve pages quickly, and the settings and hooks you can use to tune it. Most of it lives under Settings › Speed.

Full-page cache

Pages for logged-out visitors are cached in memory and served in well under a millisecond. The cache empties itself the moment content, comments, users or public settings change, and entries expire after 10 minutes. Logged-in users, commenters and protected posts always get a fresh page. Responses carry an X-Cache header.

  • rp option set rp_page_cache_ttl 300 changes the lifetime; rp option set rp_page_cache 0 turns the cache off.
  • Clear cache in the admin toolbar, Settings › Speed or rp cache flush clears every cache: pages on all servers, plugins’ cached data, templates and Cloudflare.
  • Plugins opt a page out with rp_page_cacheable, vary it with rp_page_cache_key, change its lifetime with rp_page_cache_ttl, and purge a CDN on rp_cache_purged.

A CDN in front (Cloudflare)

The page cache makes the server answer in under a millisecond, but a visitor far from the server still waits for the trip there and back, often 100 to 300 ms. Let a CDN keep pages near visitors: Settings › Speed › Let the CDN keep pages for, plus a Cloudflare zone ID and API token so every change purges Cloudflare’s cache, and the Cache Rule shown there to paste into Cloudflare. Public pages then carry Cache-Control: public, max-age=0, s-maxage=…; pages for logged-in people and commenters carry private, no-store.

Redis, Valkey and Memcached

One server needs nothing: the cache lives in memory. With several servers behind a load balancer, or for a cache that survives restarts, point them all at one cache server, in Settings › Speed › Cache server (test, then save; RustPress restarts on it without dropping requests) or in rp-config.toml:

cache_url = "redis://:password@10.0.0.5:6379/0"   # or valkey://, rediss:// (TLS), memcached://10.0.0.6:11211
  • Cached pages are shared by every server, and a change on one invalidates them on all within a second.
  • Plugins get a persistent object cache: wp_cache_*, transients and wp.cache.
  • Keys are prefixed per site, so several sites can share one cache server.
  • If the cache server goes down, pages render without it (logged once, retried every 30 seconds).
  • Memcached has no passwords here: keep it on a private network, or use Redis or Valkey with requirepass.
rp cache status
rp cache flush

Compiled templates, compression and minification

  • Theme templates are compiled once and reused.
  • Responses are compressed with gzip or brotli.
  • HTML and theme CSS are minified safely; rp option set rp_minify 0 turns that off. JavaScript is left as it is.
  • Theme and plugin files get content-hashed names and are cached by browsers for a year.
  • Posts, users and terms are cached for the length of a request.

Measuring

Logged in as an administrator, each page carries a Server-Timing header (database queries, database time, total) that browsers show under DevTools › Network › Timing. RP_LOG_QUERIES=1 prints every query.

Plugins that stay out of the way

A plugin is only called for the hooks, shortcodes and routes it registered, and only where its scope says it is needed. Owners can change this under Plugins › Where it runs. PHP plugins run in a long-lived PHP process with OPcache, so compiled code stays in memory and edited files are picked up within 2 seconds; turn the JIT or other php.ini values on with php_options. Python plugins that use the SDK’s run() are kept running too. Details are in Plugins.

Work moved off the request

  • Email goes out from a background queue, with retries.
  • Scheduled events and plugins’ background jobs run in workers inside the server, with retries and a breaker for failing services. See Background jobs.

Images and SEO

Uploaded images get sizes (thumbnail, medium, large and so on) and are served with srcset, so browsers download the size they need; rp media regenerate rebuilds them. Descriptions, link previews, JSON-LD, the sitemap, robots.txt, /llms.txt and Markdown versions of pages are built in, with no SEO plugin to slow pages down (Settings › SEO).

For headless sites, signed webhooks let your front end rebuild only what changed. See Headless and REST API.