How to speed up your website with opcode caching and Redis

How to speed up your website with opcode caching and Redis

Two caching functions in the Control Panel can make your website noticeably faster: opcode caching stores the compiled PHP code, and Redis stores the results of complex database queries in memory.

Step 1: Check opcode caching

In the Control Panel, open your website, click Advanced in the top menu and choose Optimization. Make sure that the switch Opcode caching is turned on.

Optimization page with the Opcode caching switch

Info

Good to know: Opcode caching is switched on by default and is suitable for almost every PHP website. You normally do not need to change anything here.

Step 2: Switch on Redis

  1. Click Advanced → Developer tools and then Redis on the left.
  2. Turn on the switch. Redis is started within the PHP container of your website.
  3. Under Connection details you will find the address for your application: 127.0.0.1:6379.
Redis section with the switch, connection details and Edit redis.conf
Info

Password and configuration: By default Redis has no password, because it is only accessible within your website's PHP container. You can set a password and other options with Edit redis.conf. After changes to the configuration, restart the PHP container with Restart in the PHP section.

Step 3: Use Redis in your application

Redis only has an effect if your application supports it. In WordPress, for example, install a Redis caching plugin (such as Redis Object Cache), activate it and enter the connection details 127.0.0.1 and port 6379 if requested.

Idea

Tip: Measure the loading time of your website before and after activating Redis. Redis brings the greatest benefit for websites with many database queries, e.g. online shops.