A Simple Flat File CMS Without a Database to Reduce Server Load
This article discusses reducing server load when running a Content Management System (CMS) to drive a website. The most popular CMSs, such as WordPress, Drupal, Joomla and DNN use a database (DB) to hold website content. One way of improving web server performance is to remove the database element. Why a flat file CMS vs database? Using a no DB CMS can reduce the memory footprint and code execution times for a page request. This can improve the performance of a web server under heavy load. A no DB CMS, also known as a flat file CMS, is particularly useful for limited resource web servers such as shared hosting plans or Virtual Private Servers (VPS).
Popular CMS Advantages and Disadvantages
The popular CMS packages provide several advantages:
- Easy to install.
- Powerful features.
- Website content is easily added and changed.
- Limited technical skills required.
- Free with most website hosting plans.
- Supports multiple users.
But, as with most things, there are disadvantages as well:
- Under the friendly interface they are more complex and use more server resources than simple HTML only (static) web pages.
- They require frequent updates and maintenance due to new version releases.
- They may require plugins to add specialist functionality.
- They provide a lot of code to cover functionality that may never be used or required.
- Their popularity makes them a target for hackers.
- They are overkill for minimalist style websites maintained by technically competent personnel.
Website performance is one of the factors that determine search engine rankings. If a website becomes popular the hosting hardware has to do more work to serve up the page requests. If the number of requests exceeds the capability of the hardware the response rate increases and users think that the website is slow (and may decide to go elsewhere). Web server hardware performance is dependant upon several factors:
- CPU usage.
- CPU speed.
- The amount (volume) of data being processed and sent or received.
- Data transmission rate for both the network and hardware input and output (IO) rate.
- Amount of memory being used (physical and virtual).
There are limits to all of these, the more work the web server does the closer to the limits it gets. When the hardware reaches a limit any further requests have to be queued. If the queue gets too long the user does not get a response and thinks the website has crashed. For websites on cheaper shared hosting plans the limits can be quite small. Here’s an example of a website hitting an IO limit:
One way of getting better performance out of a web server is to reduce the amount of work it has to do to process requests. A CMS that uses a DB has several layers of code, reducing the amount of code that has to be loaded and executed can improve the rate of request processing. One way to do this is to use a no DB CMS, getting rid of the database code layer:
For a simpler flat file, no DB alternative to WordPress, Drupal, Joomla et al. searches will throw up a whole host of choices, some free and some requiring payment. Be careful though many of these simpler CMSs still use some form of database. You need to look for a CMS that uses the server’s file system as the storage mechanism. Usually each webpage on the website will be stored in its own text file and/or folder, hence the term flat file CMS. These CMSs can still be feature rich by using a template language, such as PHP. An example of such a feature full no DB CMS is Phile CMS.
Another alternative to the popular CMSs is a site generator package. These also have the advantage of allowing work on the website without having to be connected to the web server (which also helps with server load). Site generators store content on your local machine (in databases or flat files). The website content is updated on the PC and the site generator is run to produce the web files. These are then synced, via FTP or HTTP, to the web server. Site generators pre-date CMSs and come from the early static page days of the Internet in the late 1990s. A list of site generators can be found at https://staticsitegenerators.net/. A site made up of static web pages is very fast and very resource efficient.
There is a way to use a CMS without being connected to the web server. Use a no DB CMS running on a local web server (e.g. using WebMatrix on Windows), then synch it with the web server once the local updates have been made, combining the power of a CMS with the local working of a site generator.