Just like caching the front-end static files play an important role in improving the site speed. Similarly, we need to cache the backend for enhancing server performance. Therefore, we will use the Redis Object Cache.

The Redis Object Cache helps in storing the complex MySQL queries on RAM memory. Hence, next time any similar query request, the Object cache will serve the output stored in RAM rather than hitting the fresh MySQL query. Thus, enhancing the overall speed and performance.

Install Redis Server on WordPress server:

apt-get install redis-server php7.3-redis

The output of the command may throw an error like “E: Couldn’t find any package by regex ‘php7.3-redis’” if so please run the below command in docker container were the wordpress server installed.

pecl install -o -f redis \ && rm -rf /tmp/pear \ && docker-php-ext-enable redis

Configure Redis Server :

Edit the redis config file with below values:

/etc/redis/redis.conf
add the below lines to set the maximum memory limit the Redis Server should use for processing the Object Cache.
#it depends on how much RAM you have. On a 1GB server, I use 100mb.
maxmemory 100mb

Then close the configuration file and restart the Redis server.

Setup Redis Object Cache for WordPress

  1. First of login to the wordpress admin panel and install the plugin Redis Object Cache.
  2. Then activate the Plugin and navigate to Settings > Redis
  3. Hit on Enable Object Cache command button
  4. After enable the redis object cache it will looks like below.

ENABLE REDIS ON DOCKER AND CONFIGURE ON WORDPRESS

 

 

ENABLE REDIS ON DOCKER AND CONFIGURE ON WORDPRESS

Monitoring Redis Object Cache Using Command Line

Using the following command in the SSH terminal, we can monitor Redis caching from the command line.

redis-cli monitor

The output should be looks like below.

ENABLE REDIS ON DOCKER AND CONFIGURE ON WORDPRESS

So these are the important steps to set up wordpress on docker with redis to enhance server performance.  Expert professionals at IServerSupport  provide dedicated and effective server management services  for your business requirements.

Thank you!!!!!