Cache warming a website with Optimus Prime

Not all cache plugins or apps preload pages or provide a warm cache of all content, normally the first time a page is visited it is not cached but subsequent pages are. More plugins are providing pre-loading or warm cache solutions but some still don’t or web hosts don’t allow it – there are a couple of solutions, Warm Cache is one and Optimus Prime is another which is discussed below.

This guide is more cPanel focused, there is another cache warmer one for RunCloud.

Optimus prime is an binary executable app you install on your webserver so good if you have command line access, but also totally usable with cPanel ftp and a cron job. The program works by trawling the sites sitemap so the cache app starts to cache all the pages.

Download and extract it via Command Line

wget -c https://cdn.pmylund.com/files/tools/ocp2/linux/ocp-2.7-amd64.tar.gz -O - | tar -xz

Alias it

echo "alias ocp='~/ocp/ocp'" >> .bashrc
source .bashrc

Manual Download

You can also just choose to manually download it directly, (the Linux (64-bit) one will suit most webservers, extract it and move the inner ocp app to your web server, doing it this way you will have to re-apply execute permissions…

chmod +x ocp

Using it

ocp http://mysite.com/sitemap_index.xml

Or if you have it without alias use it from the directory you are in.

./ocp http://mysite.com/sitemap_index.xml

To see a list of available commands

./ocp

Adding as Cron Job

The example below is a cPanel cron job setting the command to run every 3 hours

Example Cron Capnel Optimus Prime

 

If you have large sites on a web server you may want to stop the ocp command from overlapping, this is possible using another script  from the same author one.sh , download here.

Change directory to your ocp directory and download it:

wget https://cdn.pmylund.com/files/tools/one/one.sh

Make it executable:

chmod +x ocp/one.sh

You can run it like so

one.sh ocp http://mysite.com/sitemap_index.xml

Optimus Prime home

WP Johnny Guide

Gridpane Docs

4 Comments

  1. Tomas on March 19, 2022 at 8:25 pm

    Swift cache, WP Rocket and others have too preload, what´s the difference?

  2. Vitor on August 31, 2020 at 2:32 am

    Hi, congratulations on the great content you’ve been creating. I would like to know if Optimus Prime working well with the Nginx + Redis Cache System with the Runclud app on WordPress?

    • Neil Gowran on August 31, 2020 at 2:47 am

      No need to use it on RunCloud as it has its own pre-loading process via the RunCache plugin, when the cache is purged it pre-loads the pages again.

      • Neil Gowran on March 13, 2021 at 6:13 am

        Actually it will be an enhanced addition to the preload, I will do a RunCloud tutorial

Leave all Comment