Optimization for Faster Performance and Increased Scalability

This article gives insight into some basic adjustments you should make to your website, code, database and workflow, that results in improved performance and scalability.

If you’re currently not on unlimited Servebolt hosting, you may want to check out our article on how to calculate how much traffic your website can handle. Most VPSes and Cloud instances often provide very limited scalability. In E-commerce? We’ve articles on how to speed up your WooCommerce or even how to scale WooCommerce.

The Dynamics of Scalability and Performance

Scalability means the amount of traffic that your website can handle simultaneously. For example, when experiencing sudden traffic peaks. The limiting factor of your site’s scalability is usually the number of computing resources that you have available.

Performance is the speed at which your website delivers a single page view. The factor that limits the site visitor’s experience, is most often the back-end performance. This means the speed at which your web server can deliver uncached requests. Especially for low-traffic websites, the uncached speed of your website is very important – because your cache hit rate will be low.

Scalability and performance are very closely linked. If you improve your website’s performance, the scalability will usually also increase. Increasing scalability can be done in two ways, either by adding more resources – or by increasing your website’s performance.

Servebolt hosting plans differ from other hosting companies in the way that all of them provide close to unlimited scalability. You’ll experience a platform without limits on php workers, and a enough CPU and enough RAM policy.

Go through the tips in this article to work on your website’s performance. If you’re going through these few steps, your website’s performance may change from being sluggish, to becoming snappy and fast. 

Optimizing the Database

We run very updated and recent versions of MariaDB (Open Source successor of MySQL). The following steps will ensure that you make use of the latest performance improvements and optimizations.

Only use InnoDB tables (Convert any MyISAM tables to InnoDB)

MyISAM is an outdated database storage engine that underperforms in all aspects, and InnoDB is the preferred alternative. InnoDB tables provide many additional advantages as well.

If you have a mysqldump file, use the command sed to convert the table types, before you import it by running the following command:

sed -i 's/MyISAM/INNODB/g' filename.sql

If you’re running WordPress or WooCommerce and use Servebolt Optimizer, the feature to convert all tables is built into the plugin.

Optimize tables on a regular basis

In PhpMyAdmin in the table overview, select all tables and choose from the dropdown menu. This database feature recalculates table statistics that are used to optimize performance when reading and writing data. 

A small reminder! You should not run this function if your traffic is under heavy load – because it locks the tables.

Storage

Data storage is often ignored, but deserves a check every now and then. If you limit the amount of digital waste you store, your site will perform faster and consume less resources.

Check for Unnecessary Storage of Data

Are you storing data you might as well delete? We often come across websites that store several years of useless data. This can be log files, backups, outdated image archives, just zips, and other archives that are just laying around.

Make sure logs rotate and that maintenance tasks run, so that old logs and support tables are cleaned up by your web application.

Optimize Your Web Application

Whether it’s WordPress, Laravel or Magento – the following tips will help you improve the performance of your site.

.htaccess

There are many bad default .htaccess rules, or big .htaccess files out there. Therefore, the .htaccess should primarily be used for rewrites. By default our servers are properly set up to gzip content, correct expiry headers and cache lifetime. Setting these values in .htaccess may slow down your site.

Get rid of slow plugins

Test all the plugins or modules you are using for performance. If they make your page load slower, find an alternative to implement the functionality – or an alternative plugin!

If you’re serious about improving your site’s performance, you should try working with the performance first workflow.

Run cron via the server

Cron jobs are used by application to schedule work to a set interval. Cron is mostly used by plugins or custom code to clean up, delete old data, update necessary info etc. But running this from the application itself can make it slower as it will need to be triggered at some point, usually site visits. Therefore it’s better to let the server to trigger the cron jobs.

The type of command needed for each application is different, but we’ve covered most them in our help center.

Other Performance Improving Actions

Besides optimizing your database, you can also perform the following steps:

Always Use SSL (https://)

SSL provides secure end-to-end communication and better performance. Our servers make use of the latest and best in internet technology, and SSL increases the performance of your website due to protocols like HTTP/2.0 and SPDY.

Eliminate redirects and 404 requests

It’s easy to think that 30X redirects and 404 not found requests do not matter much, but they do. These requests are not cached server-side and will take time to process. This will result in slower load times for your customers and spend unnecessary resources on serving those requests.

Fix PHP bugs

This is another frequently overlooked item. Checking your server Error logs to identify if there are PHP Exceptions, PHP Errors, PHP Warnings, and PHP Notices is a good idea. There should always be a minimum of these errors. When scaling traffic, errors like this can grow to be site-breaking problems, because they have an impact on the backend performance; logging and handling of errors take up unnecessary computing resources.

Add Accelerated Domains or Cloudflare

Both Accelerated Domains and Cloudflare provide CDNs that help you scale the traffic to your website. Accelerated Domains provides the fastest performance, along with optimizing core web vitals, an amazing security engine, and a reduced carbon footprint.

With Cloudflare in front of your website, you can even further optimize and tweak the performance of your site. Check out our Servebolt Partner Cloudflare Pro or Servebolt Partner Business plans.