increase wordpress site speed using redis cache
Hi Techrunnr readers, this document deals with how to increase wordpress site speed using redis cache.
Redis, RE-dis is an open-source in-memory data structure project implementing a distributed, in-memory key-value database with optional durability. Redis supports different kinds of abstract data structures, such as strings, lists, maps, sets, sorted sets, hyperloglogs, bitmaps, and spatial indexes.
How Does Redis cache work?
Redis cache will store all the request which is going to database and later the requests are served from Redis cache not directly from the server.
For example, if a user visits and searches for some keyword in the blog, the first time all the queries will reach the database server and provides the result to the user. These all query information will get stored in Redis cache and memory. And later on, if a request comes for the same query, the results are server from the Redis cache not from the database.
Using this way the Redis caches minimizes the querying with database and improves the speed.
Redis can increase the performance of site load time from 655ms to 376ms.
If you go any wrong with the caching system, you can flush the Redis cache contents using flushall command in redis-cli.
Here we are going to setup Redis cache in running WordPress server in order to increase the speed of the site.
* WordPress running site.
1. Installation of Redis
Add the following lines in Redis configuration
Download the redis cache script
Add the following lines in wp-config.php
3. Restart Apache2 and Redis-server
4. Test Redis cache
Execute the following command to see redis is working or not
If you are not getting the expected output, just browse your website.
Now you can do see the website performance has been increased as compared before.
It’s always better to do a benchmark before and after Redisis-server installation.
© 2018, Techrunnr. All rights reserved.