Having a dedicated server is not an easy thing to maintain. You have all control over the server, and it is in the hands of yours to make them optimised. CryptLife is hosted at DigitalOcean, and we worked hard to reduce server load by optimising WordPress recently, and it worked like a charm. We have already posted valuable tips to make your blog load faster as lightning, but today we ran an experiment on our server to reduce load and make pages load faster to users.

Prefer Nginx over Apache

The first choice for the server if you are running on a low-cost server is, Nginx. Nginx is a lightweight web server that can handle multiple requests at a faster rate. Apache is powerful, but when it comes to simultaneous requests, the performance of the server decreases by an extreme amount. Most of the companies prefer Nginx over Apache if the site is going to receive loads of traffic.

Low Memory? Utilise Swap Memory

It is always recommended to utilise a physical memory than a virtual memory but however, if you are going to purchase a low memory server, make sure that you configure your server with a decent amount of swap memory.

If you are on CentOS, make use of the following commands to add swap memory to your server.

Creating swap memory:

dd if=/dev/zero of=/newswap bs=1024 count=128000

count=128000 denotes memory in bytes to allocate as swap memory.

Configuring the file as swap:

mkswap /newswap

Use the swap file for real-time:

swapon /newswap

Simple, right? Making a swap file on your server and setting it up on the real-time helps you to utilise secondary storage as RAM when physical memory is full.

Enable Caching

The main idea to reduce server load is by enabling caching for your website. If you are running a site that works on a server side applications such as PHP or ASP.NET, then you probably should make a way so that you do not utilise the CPU for processing HTML content.

Enabling caching will let users to quickly get the HTML page that was already handled by the CPU on the server. Delivering HTML pages will utilise a very low CPU usage than delivered by ASP or PHP.

We ran an experiment to reduce the site load by following the above tweaks and surprisingly, we reduced both memory usage and CPU load at a very extreme amount.

The below screenshot was taken after we optimised the server. Before optimisation, the server load went above 100%. The site went down several times when traffic went above a certain level. After optimisation, the site was loading faster, and the CPU load went very quiet. The server was able to handle a lot of traffic than it was before optimisation.

Reduce Server Load

This is the analytics from htop. The memory and CPU load went down after optimising the server and a reboot.

Before optimisation:

Memory and CPU load beofre optimisation

After optimisation:


Meet the Minimum Requirements

Choose the right configuration for you server. If you are running CMS like WordPress, you at elast require 1 GB of RAM to handle a decent abount of traffic to your blog or website. You can still optimise your server to below the minimum requirement but it is not a recommended idea for long-term project.

WordPress Plugins For Optimising your Site

These plugins will help optimising your WordPress blog/website loading time.

  • W3 Total Cache
  • WP Minify Fix
  • Autoptimize
  • Above The Fold Optimization
  • Cache Enabler
  • EWWW Image Optimizer

If you have any queries, please comment below.