How To Speed-up your Wordpress Site

Hey all.
Are you running a Wordpress site and wonder why it’s slow? Yes, Wordpress can become quite heavy. This post will solve all of your issues.

:pensive: Signs that your Wordpress site is slow…

  • wp-admin is loading very slowly
  • Sub-pages (& posts) do not load fast
  • Cart/checkout is loading slow.

That means you’ll probably lose a lot of customers. Speeding up your website is essential, and you will have to do it, otherwise you will also lose SEO ranking.

Things to do, to speed-up your site

  • Invest in a good host, do not host your site on a shared hoster
  • Use a caching solution. I recommend Litespeed (#1) and FlyingPress (#2). I don’t recommend using WP-Rocket.
  • Use Cloudflare (APO)
  • Do not use heavy plugins* that overload your hosting (e.g. AutomateWoo) Note: I’ve been discovering that AutomateWoo generates a LOT of load to my server.

*only use the plugins YOU REALLY NEED.

How to set up a Litespeed Server for Wordpress

The easiest way to set-up Openlitespeed on a VPS/Dedicated server is to use the container…
Check out this page: 1-Click Install OLS, PHP, MySQL, WP and LSCache – OpenLiteSpeed

How to install Openlitespeed in "1 click"

Installation

  • Run the following in the command line:
wget https://raw.githubusercontent.com/litespeedtech/ols1clk/master/ols1clk.sh && bash ols1clk.sh

Copy

OR

  • Run the following in the command line:
bash <( curl -k https://raw.githubusercontent.com/litespeedtech/ols1clk/master/ols1clk.sh )
  • The above methods will install OpenLiteSpeed and lsphp module.
  • To install WordPress and (if not already present) along with MySQL database, along with LiteSpeed Cache Plugin for WordPress, run
bash <( curl -k https://raw.githubusercontent.com/litespeedtech/ols1clk/master/ols1clk.sh ) -w

Copy

  • Answer any prompts within the script and you’re done!

Make sure to install OLS on a stable server (with hardware specifications that are enough) …

If you notice the deadlock error “No request delivery notification has been received from LSAPI application, possible dead lock”, fix it by doing this:

Access the Litespeed web console and navigate to the PHP settings. Here’s a list of recommended changes:

  • Max Connections: Set this to an appropriate value, like 50, to limit the number of simultaneous connections.
  • Environment Variables: Adjust the following environment variables:
    • PHP_LSAPI_CHILDREN=50– this is important
    • PHP_LSAPI_MAX_REQUESTS=500
    • LSAPI_PGRP_MAX_IDLE=10
    • LSAPI_AVOID_FORK=1
  • Initial Request Timeout (secs): Set this to 60 to give PHP scripts ample time to process requests.
  • Connection Keep-Alive Timeout: Also, set this to 60 to allow connections to stay open for longer periods.
  • Memory Soft Limit (bytes): Set this to an appropriate value, like 4024M, to allocate sufficient memory to PHP processes.
  • Memory Hard Limit (bytes): Match this to the soft limit, so set it to 4024M as well.
  • Process Soft Limit: Set it to 2400 or an appropriate value based on your server’s resources.
  • Process Hard Limit: Similarly, set this to 2500 or a value that suits your server.

Use Cloudflare

Use Cloudflare and activate the orange cloud:

Disable WPCron and use a real cronjob

WPCron can harm your server stability, as it runs whenever a visitor opens a site.

To disable WP-Cron, you can add the following line to your wp-config.php file:

define('DISABLE_WP_CRON', true);

By adding this line, you tell WordPress not to execute WP-Cron on web requests. Instead, it relies on the external cron job you’ve configured, ensuring better control and improved performance.

Next, you’ll create a real cron job using the crontab command. Open your terminal and run:

crontab -e

This command will open your user’s crontab file for editing. Add the following line to schedule the WP-Cron script to run:

* * * * * /usr/bin/php -q /path/to/your/wordpress/wp-cron.php

Make sure to replace /path/to/your/wordpress with the actual path to your WordPress installation.

Use Perfmatters

I’ve been using Perfmatters for 2 years now. The plugin helps you to disable unneccessary features to make your site more performant. I’ve found proof that this makes my sites quite faster. And it’s compatible with any cache plugin (even Litespeed)!

My Perfmatters Settings



Flyingpress

If you don’t use Litespeed, you’ll need a caching plugin. I recommend using Flyingpress.

My Flyingpress Settings









If I use Flyingpress, I’m using the Lazyload function of Perfmatters.

Please note, there are no perfect settings, as it depends on your site (and your likings).

1 Like