Speed Up Your Website’s Page Loading using Redis

by | Dec 19, 2022 | Technical Help, Web Hosting, WordPress

I intend to focus this article on yet another way of speeding up your website’s page loading time. My focus here will be hooking up Redis to speed page loading in complex websites. Over the years I’ve noticed that website pages have become more complex to meet the demands of information and aesthetics.

If you’re in a hurry and already have Redis working under admin on the server, to just add it, I suggest you just head down to Steps Two through Step Five below.

WordPress running on Debian

WordPress has been my favorite platform to develop websites since about 2010. My involvement in web development is mostly with the servers. WordPress seems to run best in a Linux environment. Debian has become my favorite Linux based operating system for a variety of reasons:

    • You can install it on a 32bit or 64bit machine
    • Debian is free to download and install
    • It is one of the most secure operating systems
    • You can upgrade Debian to its next version

Debian has been around since about 1993, making it one of the oldest Linux based operating systems. WordPress and Debian are kept up to date with regular updates. This helps keep them both secure.

The Cost of Security vs Page Speed

Hacker phishingI’ve noticed that all this security in WordPress and Debian comes at a cost. Coding was extremely compact and functionality centered before security concerns. I’ve watched operating systems (including Debian) get more and more complex to keep them secure. I have seem WordPress become more complex to keep it secure as well. Modern operating systems require those administrating them to continue to learn more and more about how to keep them secure. One of the beauties of WordPress is that despite all its security enhancements, you, the end user should still find it easy to learn and use.

So back to the cost of all this security. More complex websites are taking longer to resolve. Hosting providers, like us at CharlesWorks, are always seeking ways to speed up page rendering. Page rendering simply refers to getting the website’s material from the server’s hard drive to the site visitor’s browser.

Using Redis to Speed Page Rendering

Redis logo for article on adding Redis to a WordPress site running on DirectAdmin in a Debian Linux systemI wrote this for those of you running a complex website that has many pages. You may have noticed your pages taking longer to render. Note that if you have a relatively simple website – that seems to serve its pages just fine – then you might not noticeably benefit from this. Quickening the page rendering speed is where Redis comes in. Redis is a separate server that operates on the website server where your site resides. Redis will speed up your page rendering. That will reduce your loading time. It also reduces the load on the server by reducing disk accesses for database lookups. It’s great in every aspect.

Content Management Systems like WordPress store the site’s materials in the database. Sites with more pages and more material stored in their databases slow down. This is because the web server must make numerous reads and writes from hard drives to get and save database materials. Redis, in a nutshell, is able to move pieces of the database into the server’s memory and serve it directly from there. Coupled with caching, Redis can significantly speed up the serving of a website page.

Step One:
Turning on Redis for the DirectAdmin Reseller

Once this step is done, you can always skip to the next step. This step had eluded me for a while. On new DirectAdmin installations, this step is already done. However, on boxes that have been running a while, Redis needs to be enabled for whatever resellers will be authorized to use it.

Before Redis can be used on the web server running DirectAdmin at all, Redis needs to be enabled for the particular reseller. This is true even if only one reseller called “admin” exists on the server. It is actually quite simple:

    • Log into the administrative control panel.
    • Navigate to Account Manager > Show All Users.
    • Click on the “admin” user.
    • Click on the admin user’s Modify tab.
    • Scroll down and check the Redis checkbox.
    • Click on the Save button underneath the choices.

That’s it. Redis is now enabled for the admin reseller and can be added to other sites on the server as indicated in the steps below.

Step Two:
Turning on Redis on Your Web Server (DirectAdmin Reseller/Admin)

Now let’s speed up each page in your website with the help of Redis. If you have access to your server you will have to ensure Redis is installed and operational on it. We can install it for you if your website is hosted on a CharlesWorks web server for a nominal charge. If you are not a CharlesWorks web hosting client, you should contact your hosting company and have them install it on your website’s server.

At CharlesWorks part of our installation process is to enable Redis for your website’s control panel. We go into our administrative website control panel and activate it as part of the Redis setup.

In the server administrator’s DirectAdmin panel, the ability to access Redis by a particular website needs to be enabled. This is accomplished by by going to the website’s controls and in the Modify tab activate it as shown here:
Section of the DirectAdmin control panel website settings showing Redis checked for availability
Remember to Save the settings at the bottom of the page.

Step Three:
Turning on Redis in your DirectAdmin User Website Control Panel

You must activate Redis as indicated in the last step to be able to turn it on in your website’s DirectAdmin User control panel. Once you have done that, Redis will be able to be connected to from the website. In the website’s DirectAdmin control panel, navigate to Advanced Features:
Part of DirectAdmin control panel's Navigation Bar showing Advanced Features and Redis
Now click on Redis and you should see the Redis panel:
The Redis selection showing Redis Enabled along with displaying the Linux socket path
Once you click on the Enabled switch to enable it, the Path to redis socket file will be displayed. You will need this path information for the modification to your wp-config.php file that you will make in step 1 below.

Step Four:
Turning on Redis in your WordPress Website

Redis now needs to be accessible from your WordPress website. There are two steps to allowing to your WordPress site to access Redis:

    1. Modify your wp-config.php file. You need to edit your WordPress site’s configuration file. It needs to have two lines of code added to it. You can accomplish this using the DirectAdmin control panel’s File Manager. Or if you have access to the server directly you can edit the file using nano or vim. You should the two lines of code similar to below. You will have to substitute your site’s Linux username for “username” in the second line for it to work. Place these lines at the beginning of new lines added right after the first blank line after the <?php line:
      define( 'WP_REDIS_SCHEME', 'unix' );
      define( 'WP_REDIS_PATH', '/home/username/.redis/redis.sock' );

      When done, the top of your wp-config.php should look something like the following graphic. There might be other lines in there based on additional plugins. Don’t worry if you don’t see line numbers – these in my picture were added by DirectAdmin’s File Manager’s text editor:
      Sample WordPress wp-config.php file top showing placement of Redis coding

    2. Add the Redis Object Cache plugin to your site. Now you need the install and activate the Redis Object Cache plugin by Till Kruss. The Redis Object Cache plugin is defined by its creator as “a persistent object cache backend powered by Redis.” This essentially allows your website to communicate with the Redis server on your website’s server.
      Redis Object Cache WordPress plugin

Step Five:
Adding Caching to Speed Page Rendering With Redis

The next thing I needed was a caching plugin that worked well in tandem with Redis to reach good page speed. I experimented quite a bit with our CharlesWorks site to find what I thought was the best combination. The caching plugin I believe worked the best with the Redis plugin is WP Super Cache by Automattic. It makes sense that it would integrate well with WordPress since Automattic essentially is WordPress.
WP Super Cache WordPress plugin

The WP Super Cache is simple to use and as easy to install as any plugin. The only drawback is it nags you to install Jet-Pack which wants you to create a WordPress account that you most likely do not need. We just ignore the nag, since your site is better off having as few plugins as possible.

CLICK HERE to find your domain name!   CLICK HERE to transfer your domain name!

Archives

Tags

24 hour (1) Accessibility (2) Accounting (1) Advertising (13) AdWare (1) Alex Johnson (2) Alignment (1) Android (2) Anti-Virus (1) Antivirus (1) Antrim Computer Repair and Service (3) APC Back-UPS (1) Appearance (2) Apple Mail (4) Apple Mobile Mail (2) Attachments (1) Audit (1) Authorized (1) Autoresponder (5) Availability (1) Backups (1) Badges (3) Bank Account (1) Bank Statement (1) Battery Backup (2) Better Business Bureau (3) Bob Hill (1) Bookkeeper (1) Branding (7) Budget (2) Business (25) Business Management (1) Catalog (1) Charles Oropallo (1) CharlesWorks (41) Cherryl Jensen (1) Chrome (1) Cloud (1) Code (2) Communicating (1) Competition (1) Computer (2) Computer Cache (1) Computer Hardware (1) Computer Security (2) Constant Contact (1) Consultation (1) Contact Information (2) Content (1) Content Management (31) Content Management System (1) Copiers (1) Copy Machine (1) Coronavirus (2) Courteous (1) COVID-19 (3) Credibility (9) Credit Card (1) Credit Card Processing (1) CSS (8) Customer Service (2) Database (1) Debian (1) Design (42) Design Expertise (1) Desktop (1) Dialup (1) DirectAdmin (3) Directions (1) DIVI (6) DNS (2) Do-it-Yourself (1) Documentation (1) Domains (18) Domain Transfers (5) E-Commerce (1) ecommerce (1) Elementor (1) Email (63) Email Lists (4) Email Management (2) Email marketing (3) Etiquette (3) Eudora 6 (1) Exchange (1) Expanding (1) Facebook (1) Financial (1) Finish (1) Firefox (1) Fonts (1) Forms (2) Forms Protection (1) Fraud (2) Galaxy S4 (1) General Info (1) Gmail (1) GoDaddy (1) Google (1) Google Adwords Certified Partner (1) Google Chrome (2) Groups (1) Happy Holidays (1) Hardware Help (1) Hill Specialty Networks (1) Hosting (1) Images (1) IMAP (1) include (1) Infected (1) Information (31) insert pages (1) install (1) Internet Browsing Errors (1) Internet Consultant (1) Internet Explorer (1) Joomla! (1) Keywords (2) Laptop (1) Legibility (1) Linux (8) Logging on (1) Macintosh (1) Mail 6.0 (1) Mail 2011 (2) Make-Over (1) Malicious (1) Malware (1) Marketing (7) Matt Burke (3) MDaemon (3) MelbourneIT (2) menu (1) Merchant (1) meta (1) Microsoft (1) Microsoft Edge (1) Microsoft Hosted Exchange (5) Microsoft Live (2) Mobile Email Setup (1) Monadnock Region (1) Mozilla Firefox (2) MySQL (1) Nathan Wesley (1) Netscape (1) Netscape Messenger (1) Office Copiers (1) OfficeLive (1) Online (1) Outlook (9) Outlook 2010 (2) Outlook Express (1) PayPal (1) Pay Per Click (2) PC (1) Personal (1) Peter Harris (1) Peter Harris Creative (1) Phishing (2) PHP (3) pixel (1) plugins (1) Pop Email (1) Popularity (1) Portfolio (1) Power Grid Failure (1) PPC (1) Prevent Fraud (1) Privacy (1) Private (1) Product (6) Professional (5) Projects (2) Protect (1) Protection (1) Quality (2) QuickBooks (1) Reconciliation (1) Reduce Risk (1) Register (1) Reliability (2) Renew (1) Reseller (2) Resolution (1) Restrict User Access (1) Results (1) Review (2) Risk (1) Robin Snow (1) Roundcube (1) Safe (1) Samsung (2) Scam (13) Scammer (13) Search (1) Search and Replace (1) Search Engine Optimization (SEO) (18) Security (20) Security Risk (1) Selling (1) Servers (2) Service (11) Shopping Cart (1) Site (1) SmarterMail (9) Social Engineering (1) Social Networking (1) Software (1) Solutions for Today (1) Spam (1) Spam Filtering (15) Spammer (1) Spyware (2) SquirrelMail (1) SSL (8) Statistics (2) Stats (2) Stone Pond Technology (1) Storage (1) Support (1) Tablet (1) Target Market (1) Technical Help (1) Testimonials (9) The CW Corner (1) Thom Little (1) Thom Little Associates (1) Thunderbird (3) Thunderbird 10 (2) TLD (1) Topic (1) Top Level Domains (3) Transaction (2) Transfer Data (1) Transfer Funds (1) Typography (1) Update (2) Uploading (1) UPS System (2) Up to Date (1) Virus (2) Viruses (1) Vista (1) Web (1) Web-Over (1) Web Development (94) Web Hoster (1) Web Hosting (2) Web Hosting Company (1) Web Mail (1) Webmail (8) Webmaster (10) Web Presence (24) Website (106) Website Development (1) websites (2) Web Stats (1) Web terms (1) Web Writing (1) Windows 7 (2) Windows Mail (6) Windows XP (1) WooCommerce (4) WordPress (85) WordPress Updates (1) Working Remote (2) Writing (1) YouTube (1)

Protected by Security by CleanTalk and CleanTalk Anti-Spam