I have a couple of Wordpress sites running on a Sympl VM.
One of the sites has a page that makes a large number of MySQL queries when it loads, maxing out the CPU. I’d like to try to improve this using memcached.
Two questions:
Is memcached compatible with Sympl?
Is installing it just a case of “apt-get install memcached” or are there other steps involved with setting it up?
Is installing it just a case of “apt-get install memcached” or are there other steps involved with setting it up?
It’s usually just a case of installing it - it’ll only be accessible from localhost by default, then you just need to configure WordPress.
As an alternative, you might want to think about APCu as it’s a bit simpler:
if you’re running Sympl 12 then echo '7.4' > /srv/example.com/config/php to set the PHP version to the current ‘most compatible’ version for WordPress, then echo 'apcu' > /srv/example.com/config/php-modules to add it as wanted for the site and finally run sudo sympl-php-configure and it’ll set it up and manage it for you. If you want to separate the sites so they can’t see each other, then put a unique string in /srv/example.com/config/php-pool on each site.
if you’re running Sympl 10 or 11, then just apt install php-apcu - there’s not an easy way to isolate them in this setup, but with only a couple of sites you should be fine.
It’s not installed by default (only a few common modules are) so you should just be able to add it to php-modules and choose a PHP version and let Sympl do the rest.
One other thing - I have a file named 7.4 in /srv/example.com/config/php/ but your instructions suggest that php should be a file, not a directory. It looks like my site is running PHP 8.2.17 so something isn’t getting picked up. Should I delete the php directory and replace with a file containing 7.4?
You’d need to look at either the command-line PHP, but with the right version - so if you’re running PHP 7.4, then you want php7.4 -i | grep -i apcu (adding a -i to the grep to make it case-insensitive).
Yes, it should be the text 7.4 in the the file /srv/example.com/config/php rather than anything in a directory. If you fix that and run sudo sympl-php-configure, it should swap things over and install missing items.
(Note there’s a very cool new feature about to hit testing, which will automatically use the relevant version of PHP based on what directory you’re in, and what you have set in config/php!)
Great, thankyou - that looks like it is running fine. One of our least efficient pages is down from a 15s page load time to around 3. Thanks for the help!