Speeding Up WordPress on Synology

Out of the box, WordPress running on a Synology is very slow (search Synology.com forums or Google if you don’t believe me). This article explains how to optimize your Synology and your WordPress website for speed.

Disclaimer

The below are tweaks I’ve implemented with success. I don’t know the complete extent of their validity; they just seems to bring extremely noticeable positive performance gains to my Synology. Besides these changes not working as expected on your Synology, they are risky. Before making any changes, backup your data and your Synology configuration off the Synology incase the worst happens. By implementing any of the suggestions below, you are proceeding at your own risk without any expectation of responsibility and or support from me. I only take credit if the changes bring you positive results

I also expect you to have moderate technical skills – able to modify your Synology through the DSM console, install and configure plugins, use telnet, run executables and edit/save text files in linux, etc.

Synology Tuning

Synology produces some pretty powerful network storage devices. These are basically tiny computers optimized to store/serve data and able to run programs to stream music, videos, photos, websites, and more. By default, WordPress will run relatively slow on a Synology since it is configured to minimize disk, CPU, and memory utilization. By simply making a few changes, you can make WordPress on your Synology run faster than average website without compromising its ability to run other functions.

Enable PHP Caching

By default, the Synology is configured to enable PHP caching. Ensure “Enable PHP cache” is still checked under Control Panel | Web Services | PHP Settings.

Synology-DSM-5-PHP-Caching

 

Tuning Configurations

Tuning the following configurations will give you the largest performance gain of any of the other recommendations listed in this article. It is also the most dangerous as you can easily cause an over consumption of resources slowing down parts of all of your Synology or worse yet can break WordPress or your entire Synology. Before proceeding, ensure you have everything backed up OFF your Synology in case you need to perform a full Synology restore. Now that we have that gloom and doom over with, on with the tuning… To perform any of the changes below, you will first need to enable Telnet by checking “Enable Telnet service” under Control Panel | Terminal & SNMP | Terminal.

Synology-DSM-5-Enable-Telnet

Note: Enabling telnet allows remote command line access to your Synology. You should only enable it when needed and if your network is adequately secured.

OPCache

OPCode is caching mechanism preinstalled on Synology to cache running PHP code into memory and to recall the code from memory instead of from disk. To configure the OPCode engine to consume more resources and thus speed up WordPress:

  1. Telnet to your Synology with the root account
  2. Edit and save /etc/php/conf.d/opcache.ini with your desired changes
  3. Restart Apache by running /usr/syno/etc/rc.d/S97apache-sys.sh restart

Below are some of the change I have implemented with positive results:

PHP Configuration

PHP is the language WordPress is written in. Synology has the PHP engine preinstalled and preconfigured to consume minimal resources such as memory and CPU. To configure the PHP engine to consume more resources and thus speed up WordPress:

  1. Telnet to your Synology with the root account
  2. Edit and save /etc/php/php.ini with your desired changes
  3. Restart Apache by running /usr/syno/etc/rc.d/S97apache-sys.sh restart

Below are some of the change I have implemented with positive results:

Apache is the web server preinstalled on the Synology for all web applications (like WordPress). The Apache configuration is preconfigured to consume minimal resources such as memory and CPU. To configure Apache to consume more resources and thus speed up WordPress:

  1. Telnet to your Synology with the root account
  2. Edit and save /etc/httpd/conf/extra/httpd-mpm.conf-user with your desired changes
  3. Restart Apache by running /usr/syno/etc/rc.d/S97apache-sys.sh restart

Below are some of the change I have implemented with positive results:

MariaDB is the database server you can install to run with Wordpress. The MariaDB configuration is preconfigured to consume minimal resources such as memory and CPU. To configure MariaDB to consume more resources and thus speed up WordPress:

  1. Telnet to your Synology with the root account
  2. Edit and save /volume1/@appstore/MariaDB/etc/mysql/my.cnf with your desired changes (note: you may have to change “volume1″ to the location where you installed MariaDB).
  3. Restart MariaDB by running /usr/share/mysql/mysql.server restart

Below are some of the change I have implemented with positive results:

WordPress Tuning

WordPress by default is also not optimized for speed but thankfully there are some great plugins and changes your can make to make your site scream.

Enable Site Caching

Download, activate, and configure the W3 Total Cache plugin.

W3-Total-Cache

Basically this plugin caches all the dynamic content on your website while also shrinking down code where possible. The performance gained because of this plugin is like night and day. If you are skittish about implementing any of the suggestions within this article, this is the one NOT to skip.

There are tons of settings and tons of articles already on the web on how to optimally configure this plugin. Here are some quick tips:

  • Enable page, minify, database, object, and browser cache
  • Select “OpCode: Alternative PHP Cache (APC)” as your cache method (if not “Disk: Enhanced”, “Disk: Basic” or just “Disk”)
  • Uncheck all items within the “Debug” section
  • Enable “Late Initialization” on the “Page Cache” options page
  • Update “Pages Per Interval” to 15 on the “Page Cache” options page

Shrink Your Images

Download, activate, and use the WP Smush.it plugin.

Smush-It

Basically this plugin performs operations to shrink the size of your website’s images without a loss in quality.

To “smush” images, simply go to your WordPress “Media” section on the admin dashboard and click “Smish.it Now!” or “Remush” next to the desired image.

Or to “smush” a bunch of images at once, go to your WordPress “Media | Bulk Smush.it” section on the admin dashboard.

Deactivate unneeded plugins

Plugins may add additional code that run every time a page or image is loaded. That additional code will cause the page to display slower. Deactivate all plugins that are not needed.

Choose a fast theme

Not all themes are created equal. Experiment by activating several themes and noting the time each takes to load. Select the theme that fills your need while also loading the fastest.

Optimize the Database

Download, activate, and use the WP-Optimize plugin.

Basically this plugin performs a bunch of database optimizes and cleanup routines to speed up your database calls. Faster database calls means faster web page loading.

To optimize your database, click “WP-Optimize” in the admin dashboard, check everything, and click “Process”.

Conclusion

While the changes above bring huge performance gains, I still have 2 things that quirk me from being completely satisfied. First, I don’t really know which parts of the configuration changes are truly essential, which are not required, and if they are fine tuned to bring optimal performance. Second, I don’t see my Synology utilizing noticeable memory despite calling for more memory consumptions in the configuration files. This causes me to question the value they bring.

But with that aside, I know WordPress on my Synology now runs substantially faster having implemented the changes above. And in fact, any web application on your Synology should run faster as well (ex. the DSM console). Let me know if they work well for you too by liking or sharing this page on Facebook. Feel free as well to send me any performance enhancing tips to make WordPress on Synology run even faster.

Leave a Reply

Your email address will not be published. Required fields are marked *