Redis is open-source software that is used as a database cache. At times when MySQL becomes a bottleneck for your WordPress installation due to heavy queries, Redis can help reduce that load by using in-memory data structure storage. In this article, we will see how to configure Redis Object Caching for WordPress on CyberPanel using the Redis plugin.
CyberPanel is one of the emerging and popular choices among web hosting control panels and with its current new feature timeline, CyberPanel developers are introducing more and more features into it. With a team that is very quick with updates and bug fixes, CyberPanel is becoming one of the first choices for a free hosting panel.
Currently, CyberPanel stable version is v2.0.3, and the CyberPanel team is about to launch the next version very soon. The v2.0.3 version includes very exciting features and one of those features which CyberPanel has introduced is the Redis Application installation with PHP extension.
Table Of Content:
- How to install Or upgrade the CyberPanel :
- Install Redis and Redis PHP extension on CyberPanel.
- Install Redis Plugin on WordPress.
- Redis setup with Redis WordPress plugins.
How to install Or upgrade CyberPanel:
If you are looking for how to install CyberPanel? Then you are in the right place and if you are looking for how to get the latest version of CyberPanel then this article will tell you how you can upgrade CyberPanel to the latest version.
How to install CyberPanel:
Honestly, CyberPanel installation is very easy. It takes 5-20 minutes to install depending on your server specs, and one command to run.
sh <(curl https://cyberpanel.net/install.sh || wget -O - https://cyberpanel.net/install.sh)
But I recommend you to also read CyberPanel Official tutorial for this.
How to Upgrade CyberPanel:
You can also update CyberPanel using only one command and as the installation, it also takes 5 minutes and a single command.
sh <(curl https://raw.githubusercontent.com/usmannasir/cyberpanel/stable/preUpgrade.sh || wget -O - https://raw.githubusercontent.com/usmannasir/cyberpanel/stable/preUpgrade.sh)
You can read the official guide for this also.
Install Redis and Redis PHP extension on CyberPanel
First of all, I am going with a short introduction to Redis. I know most of you know what Redis is and what are the uses of Redis. But some may be new to Redis so let me explain what it is.
Redis is an in-memory data structure store. Redis is used for caching, Session management, Subscriber base messages. Basically, Redis makes the process quicker. Let me be clear with an example of Twitter. Twitter is using Redis for subscribing, Liking, and all of that. You notice that when we have a new feed on twitter the whole page is not refreshed and you can see the message-like.
That is Redis. That did not allow the refresh of the whole page but adds the new content. Redis is an effective component to improve the speed of the site. If you want to know more about Redis goto there official site by clicking here.
Do you know? You can install Redis using CyberPanel in one click. CyberPanel developers added this new feature to install the Redis directly from the CyberPanel.
In the previous version of CyberPanel, if you wanted to install Redis and configure, you were required to install it using commands and then you have to install Redis extension from PHP extensions from CyberPanel. But this hustle is about to end in v2.0.3. Now CyberPanel makes it easy for its users.
I am going to explain what you have to do now in v2.0.3.
To Install Redis first you must have a CyberPanel version v2.0.3. If you have this version then go to https://<your_ip>:8090/ and log in by providing credentials.
Once you login to your system now go to the ‘Manage Services->Applications‘. Let me make it more clear. Visit this link to install Redis https://<Your_IP>/manageservices/manageApplications.
Once you reach this page. No matter through the Option Stated above or using the link. You can see the option to install Redis Daemon.
Now to Click install button present in front of the Redis on your screen.
Now the real process starts. Once you click the window you can see a popup window appear which shows you the installation process and at the end of the process, you can see the version and all about the Redis information.
Once Installation is completed the page refreshes automatically and you can see that Redis is now installed, How cool is this?
For the removal of Redis, there is also one click in CyberPanel v2.0.3. You can see the status of Redis that it is installed and you can uninstall it by just clicking the remove button on the same page.
This one-click installation is an amazing feature in CyberPanel. Now you are done with the Redis installation its time to install the Redis PHP extension. For this follow the next step.
Install Redis Extension in CyberPanel:
Its time to install the Redis extension on CyberPanel. As you all know this one is not a new feature in CyberPanel. For the installation of Redis Extension go to the PPH->Install Extensions. You know we have an alternate path to access this point also and that is the link https://<Your_IP>/managephp/installExtensions
When you are on this page. Here you have to select a PHP version to install the extension for. Mostly the version that you are using for your site on which you want to setup Redis.
Select the required version and install the Redis extension for this version. For me, I selected PHP 7.4 for installation. Because I use this for my site. After selection, you search Redis in the search box and you get the required result. And you can see the install button.
Once you clicked the install button you can see the installation process.
After Installation go back and check the status of the extension.
All done from the CyberPanel. Now its time to setup on your WordPress site.
Install Redis Plugin on WordPress:
Now its time to install Redis on WordPress. The installation of every plugin is almost the same.
- Go to the admin dashboard in wp-admin
- Go to plugin
- Add new
- Search Redis in the bar and you can see the Redis plugin
- Click on install and then activate
Benchmark of WordPress site with and without Redis setup:
After activating this plugin now we are going to perform a benchmark for Redis which shows the difference after and before Redis results.
For both type of benchmark we select a constant value of data
h2load -n10000 -c100 -m10 https://ourdomain.com/
We are goin to use this command that mean we have three parameters here:
-nThe number of total requests. we are going with 10000
-cThe number of concurrent clients. we are going with 100
-mThe max concurrent streams to issue per client. we are going with 10
Results Before enabling Redis:
According to the command motioned above we have the following results for our benchmark without enabling Redis.
[[email protected] ~]# h2load -n10000 -c100 -m10 https://shoaibkhankhattak.tk/ starting benchmark… spawning thread #0: 100 total client(s). 10000 total requests TLS Protocol: TLSv1.2 Cipher: ECDHE-RSA-AES128-GCM-SHA256 Server Temp Key: ECDH P-256 256 bits Application protocol: h2 progress: 10% done progress: 20% done progress: 30% done progress: 40% done progress: 50% done progress: 60% done progress: 70% done progress: 80% done progress: 90% done progress: 100% done finished in 208.14s, 48.04 req/s, 1.19MB/s requests: 10000 total, 10000 started, 10000 done, 10000 succeeded, 0 failed, 0 errored, 0 timeout status codes: 10000 2xx, 0 3xx, 0 4xx, 0 5xx traffic: 248.57MB (260644306) total, 145.97KB (149469) headers (space savings 95.87%), 247.74MB (259770000) data min max mean sd +/- sd time for request: 104.87ms 67.20s 14.39s 11.88s 90.34% time for connect: 102.45ms 162.19ms 144.00ms 22.98ms 76.00% time to 1st byte: 158.23ms 67.16s 24.80s 24.80s 76.00% req/s : 0.48 1.75 0.96 0.57 60.00%
Benchmark results After enabling Redis:
First of all you have to enable Redis for that Go to Admin Dashboard then Settings->Redis->Enable Object cache
Now we will look for the bencmark results:
starting benchmark… spawning thread #0: 100 total client(s). 10000 total requests TLS Protocol: TLSv1.2 Cipher: ECDHE-RSA-AES128-GCM-SHA256 Server Temp Key: ECDH P-256 256 bits Application protocol: h2 progress: 10% done progress: 20% done progress: 30% done progress: 40% done progress: 50% done progress: 60% done progress: 70% done progress: 80% done progress: 90% done progress: 100% done finished in 180.50s, 55.40 req/s, 1.38MB/s requests: 10000 total, 10000 started, 10000 done, 9991 succeeded, 9 failed, 0 errored, 0 timeout status codes: 9991 2xx, 0 3xx, 0 4xx, 9 5xx traffic: 249.24MB (261343519) total, 149.02KB (152593) headers (space savings 95.78%), 248.40MB (260466602) data min max mean sd +/- sd time for request: 20.74ms 180.35s 11.68s 11.02s 91.20% time for connect: 90.91ms 251.48ms 148.32ms 36.94ms 73.00% time to 1st byte: 172.45ms 54.38s 13.31s 15.11s 81.00% req/s : 0.55 1.25 0.95 0.29 56.00%