In the previous part of our article, we explained why the backend counts as much as the frontend to make your site's pages load quickly. But in practice, how do you do it? What should you think about? Should you take care of it internally or outsource these operations? Here are some tips recommended by our web performance experts.
Compress your files
Help speed up transfers from the server to the user by compressing your files with Brotli or GZIP format (Fasterize does this automatically). Unfortunately, due to a lack of resources or expertise, many websites don’t use this technique, in spite of the fact that it can really accelerate page loading.
Don’t put all your eggs in one basket: go virtual and fine-tune your network
Did you think that deploying all of your services (cache system, web server, application, database, etc.) on a single machine would help you save resources? You would be mistaken. If one of the services begins to monopolise all resources, the other services will suffer.
As such, it’s better to distribute tasks to avoid a situation where your services steal material resources from each other. To do this, you isolate your server’s resources by dedicating a virtual machine (VM) or a container to a service and limiting the resources that can be used by each VM or container.
One of the advantages of this technique is that it will be easier for you to optimize a machine that provides just one service, but does so well.
Whether you use a container or a VM, it also allows you to do auto-scaling. That can be tedious to set up (particularly because you have to provide for it in the application), but it can provide you with substantial savings. Thanks to this technique, hosts can add and remove servers according to the actual load instead of always maximising the size of infrastructure to match peak loads. As such, you only pay for what you use.
However, this requires that you use cloud infrastructure or install your own.
Testing under real conditions
When performing load tests—which we strongly recommend to prepare for big events like sales or Black Friday—make sure to reproduce the real path followed by a user instead of repeatedly bombarding the server with the same request from the same user.
Here’s something you should know: if you use a CDN, note that timeouts are generally set at 60 seconds. In other words, if during a peak load the Content Delivery Network takes more than 60 seconds to query your website’s origin server, it will return an error message and your customers may leave, thinking that the website it not working.
Unless you can cache all of your data in the Content Delivery Network, you need your origin server to respond quickly under all circumstances; otherwise, as we’ve just seen, the Content Delivery Network may cut off connections.
Optimize your security layer
Security is essential, but a web application firewall (WAF, on the server side) that’s poorly configured or poorly optimized can slow down response times. So, to avoid the trap of an optimized website that’s slowed down by its security, properly implement this essential layer and don’t stray into this territory without the necessary knowledge (note that our solution includes a WAF).
Stay up to date
Use up-to-date languages and frameworks. The longer you wait to make updates, the more technical work you accumulate. By using older versions, you also risk hurting your performance and leaving in place unfixed security flaws.
Limit the back and forth between clients and servers
Avoid systematically sending all data to the browser. For example, on a product page of an e-commerce website, only send information that’s useful at a given time. In concrete terms, the browser doesn’t need to load all colours of all products, just those that are needed for the item being viewed. That way, the data that the server has to transmit are limited to the essential.
Keep it simple
Use a web server that fits your needs. The market offers a wide variety: some are easy to implement but have poor performance; others are more complex but have much shorter response times. This brings us back to the point about budget discussed at the beginning of this section: watch out for cheaper options that can be costly in other ways.
Also, be careful with the configuration of your server: avoid setting lots of conditions. The simpler your configuration, the faster it will execute code, thus offering better web performance.
Additionally, avoid overloading your web server with unnecessary modules/plug-ins: only keep the ones you really need.
In conclusion, you have available to you many options for effectively managing your backend in order to improve your website’s speed. One final piece of advice: instead of managing all of your infrastructure manually, automate and delegate when it makes sense to do so!
While some large organisations can keep infrastructure in house because they have the necessary means and expertise in their teams, in most cases, it’s better to use a provider and get help from experts—or even let robots do the work for you.
And ... What happens when you automate your web performance optimizations?
You make your users happy, increase your conversion rates, and support your SEO: