It is very important to optimize page load time as it helps with user experience (UX) and conversion. It's also imptorant for SEO with Google now officially using Core Web Vitals as a ranking factor.
Website page speed is determined by many factors. It could be caused by the hardware and software of both the user and the server, the network that carry the website data between the two, and everything else in between.
To improve a website's page load time is to improve all of the items in the chain as one would have compounding impact on the other. Having said that though, some could provide more significant improvement than the other while some are easier to implement or fix than the other.
Some of the options to host your website is either to use a shared hosting platform, managed (Wordpress) hosting, Virtual Private Server (VPS) or dedicated server. Each come with its own pros and cons and it normally comes down to cost and ease of management consideration. Shared hosting is cheap and easy to manage while dedicated server is expensive and hard to manage. Everything else could fall anywhere between these 2 options. Every company that provides these webhosting methods are also not equal as far as performance is concerned.
Related: How to host static website on AWS S3
Operating system and web server software by default is configured to work for most situations. If you need your webserver software to be more performant, you might need to do some tuning.
Software update provides bug fixes, new features, or update to existing features. PHP 7.0 update for example is significantly faster than PHP 5.6 and each minor version update of PHP 7.x improves on the speed department even further.
Wordpress is the most popular content management system for the web, but not everyone needs to use Wordpress for their website. A simple site could just be based on static HTML or by using static site generators which are extremely fast. Prerender could also be used if your website is based on large libraries such as Angular or React.
Most people would throw more server resources to improve their web application performance, though improving the code itself would normally yield better results. If you write your own Content Management System (CMS) or web application, refactoring old codes and optimising SQL queries for example could greatly improve your website's performance.
There are a few places that you can cache in the backend, and each would reduce the need for unnecessary processing and speed up your website delivery. memcached and other key-value store system could reduce the need for expensive database calls, while varnish could cache web pages so that requests doesn't even need to be processed by your webserver. There are also multitudes of options that would cache a generated web page for popular CMSs such as Wordpress.
Installed plugins for your CMS that are no longer used can just be disabled and removed. This also applies to plugins that are in use but not really useful.
It's normal for websites to be configured to redirect normal http traffic to https and for www to non-www (or vice versa). Websites migrated from older domain will have a wildcard redirect and pages that were deleted or moved will have a redirect on their own. Each redirect stacks on each other and would cost some penalty to the load time. Reducing HTTP redirect would mean trying not to have redirects at all if possible (with more careful content strategy) and to configure specific redirects before wildcard redirects.
There are a few HTML tricks that can be used to both improve actual load time of a web page and the perceived load time of the same page. Some would include the use of resource hints (prefetch, preload and preconnect), using inline CSS and JS for critical web functionality or to load non-critical CSS and JS files last. async and defer can be used to optimize downloading of JS files and its execution. Lazy loading could then be used to only load images when needed.
Users does not need to be served images larger in dimension that it is displayed on the browser as it will only waste precious bandwidth. Image quality also does not need to be higher than it need to. Image files can be compressed or optimised using tools such pngquant or mozjpeg without sacrificing quality. Newer file formats such as webp can store comparable quality images at reduced file size.
Development version of these libraries tend to have debug codes while non-minified version would still have comments and whitespaces. Both increase the size of the libraries thus increasing the download time while also requiring more processing power on the web client which could impact render time.
Each assets and libraries such images, stylesheets and scripts requires separate request to be downloaded from the server. Reducing the use of JS and CSS libraries and files are some of the easier to implement. JS and CSS files can also be combined to reduce HTTP requests without impacting functionalities. HTTP2 can also be implemented as HTTP2 can share the same connection instead of having to create a new connection for each requests.
Images can be hosted in AWS S3 or any external provider to offload processing and bandwidth burden of your hosting. These services are normally faster and has more bandwidth for hosting large files.
Only video service such as YouTube and Vimeo allow you to embed their videos to your website which not only offload your hosting's bandwidth usage but also has built-in optimisations such as automatic video quality switching.
Popular libraries normally provide public hosting of thier libraries where everyone can hotlink to. It will not only offload the burden from your webser, but these libraries are hosted by CDNs and could already be cached by your user's browser from visiting other websites.
Going overboard with the use of web fonts would cost the load and render time of your website. If you still need to use more web fonts than most people would, perform some optimisation such as by choosing the newer format such as WOFF2 which is smaller in size.
Some cheap webhosting packages would throttle the bandwidth of the users even if they claim to provide unlimited bandwidth. This allows them to offer unbelievable packages where you as a user can't fully utilize all the promised features due to the undisclosed bandwidth limitation.
If your users are mostly from the US for example, it's best to host your website in the US regardless of where you as the owner are from. This is because the closer the users are to the actual website hosting, the lower the network latency is thus improving the overall website load time.
This alleviates the network latency issue of having your users being too far away from where you host your actual website. It works best if you have a global audience as a CDN would cache your website on their global servers and your users would access your website from their closest CDN's server instead of yours.
Comment anonymously. Login not required.