Using DNS on a Synology DiskStation to speed up WordPress
Synology produce an array of packages that you can use to extend the use of your DiskStation beyond the humdrum file server. Amongst them is WordPress, one of the most popular content management systems.
There’s an official Synology WordPress Package but you can also install the generic WordPress.org which will allow you to keep much more up to date with the latest security patches and run multiple sites.
With a reasonably powerful DiskStation and fibre based residential broadband service (FTTC works for me) you can deliver some surprisingly fast sites.
But there’s a snag with WordPress
You’ll soon find yourself adding more complex themes, lots of plugins and perhaps a page builder to really let your design skills rip. But the more layers you add, the longer it takes for your NAS to render the content.
From the end user’s perspective things aren’t so bad, although some extra speed is always welcome, but what can become a real nuisance is waiting to edit content in the back end, where you don’t need to load just the content, but all the tools too.
LAN or WAN?
The problem is that when you load the editing pages using your site’s domain name e.g. pfbarrett.uk, your PC has to poll the Internet’s DNS Servers to find the IP address where the content can be found, even though it’s right next to you on your LAN.
You can mitigate this by using the LAN IP instead of the domain name, but then you start to hit problems with LAN IPs not having SSL certificates, causing your browser to keep flagging up security issues. However, there is a way to make calls to your domain name perform as fast as your LAN IP by installing the Synology DNS package on your DiskStation and running a private DNS service., by dealing with the traffic routing locally. The difference between a public and private DNS Server routing is shown in the following diagram
Those images are modified versions of ones that appear in the Synology help system.
Performance on the back end is what I’m interested in and, as you can see, there are significant improvements in both. They are not stellar but when you’re loading pages frequently, every second counts.
Note: You will find that load times for the pages in the front end will be no quicker on the private DNS server than on a public server, due to the different ways that the front- and back-end content are rendered. But that’s irrelevant in this case. Your end users will be using the public servers and, when you want to load the front end, you are unlikely to notice any difference.
Measuring load speeds
Those charts showed the speeds on my DiskStation with my content and plugins. Your mileage will differ so it would be a good idea to run some page-load speed tests. Forget stop watches or counting “1 Mississippi, 2 Mississippi…” Use browser extensions that will accurately measure load speeds for you. I used a Firefox extension:
Installing & Configuring DNS Server
If you have a Synology Router as well as a DiskStation you can choose between installing it on the router or the DS. It’s better to install it on the DS – it has a more powerful CPU and more RAM than the router. Let the router route, especially if you are already running Threat Prevention and Safe Access packages on there.
Installing DNS Server
DNS Server is a regular Synology package, available in Package Center and installed and run just like any other package.
Configuring DNS Server
This process is very straightforward and, with a couple of minor exceptions, can be done using default options. Follow the diagram:
That’s all there is to it. You now have a private DNS Server that will serve the requests locally. it will be faster and has the added bonus that you can use the domain name for everything – you never have to worry about the security certificate issues associated with using the LAN IP address.
A private DNS server can only do so much to speed things up. There are other improvements you can make and I have described these in separate articles:
- Make sure you are running php7 not php5.6
- Install an SSD volume and run your websites and underlying databases from there
By deploying all three of these methods I have been able to reduce Elementor-editor-page-load times from 16 to just under 8 seconds. Meanwhile, in the front-end, visitors page load times have dropped from 6 to 3 seconds. The latter is a significant contributor to a site’s public success because at 6 seconds, it was close to the point at which viewers might abandon the page. The biggest contributor to the front-end speed improvement was the SSD installation.
Nathan Poulos from the Synology Admins & Users Facebook group. Why not join?