October 5, 2024
How to build a fast website?
There are only four thing you have to know when you want to build fast website. They are equally important and relatively simple.
I know this, because all my websites have a near perfect Google Lighthouse score. Forget about the endless lists of optimizations you may have seen before. These four guidelines will make your website load instantly.
1. Make your website small
When I say small I mean really small (in terms of page weight). Do not just use lightweight images, but also write as little CSS and Javascript as possible. Aim for 15kb of CSS and 3kb of Javascript. The reason for this, is that CSS and Javascript are often ‘blocking’, thus delaying the rendering of the page. The average Wordpress website is 3000kb large and serves almost 10 times that amount of CSS and 100 times that amount of Javascript. No wonder most websites are so slow!
2. Make it static
A dynamic page that has to assemble all HTML before serving it to you, will take significantly more time to render than a static page that already consists of plain HTML. The database connections and database requests delay your page load. Static pages are as fast as fully cached pages, which are basically static pages as well. Make it static, either by caching everything or by using a static site generator.
3. Get a fast host
Some servers take much longer to reply to requests than others and some servers are slow at executing database queries or executing server-side code. The specs of the server and the amount of concurrent users influence the speed of the server. There is no easy way to find out if you have the fastest host. The only way to do that is to benchmark them (or have somebody else do that for you). Get a really fast host.
4. Serve from the best location
If you have to travel to the other side of the world to serve your website, you will lose approximately 1 second. This means that you should serve your website as close to your audience as possible. CDN’s might seem like a good solution for this, but that is not always the case. Choose your servers location(s) wisely.
That is it!
These four guidelines are the answer to the question ‘How to build a fast website’. They will make the difference between a website that takes more than 3 seconds to load and a website that loads instantly.
Still struggeling to make a fast website? Contact me! I love to help.
() Joost van der Schee