Optimizing page load times is very important to the success of your website / web app. But why? And how can you improve them?
Why are Page Load Times Important?
User retention & overall UX
I couldn't find any studies on how page load times affect user retention, but it's common sense that users will be more likely to use your software if it loads fast.
If your app or eCommerce store takes 10 seconds to load, users will probably leave before it even loads.
According to Cloudflare , even a small increase in page load time, from 2.4s to 3.3s, can cause a significant drop in conversion rates - from 1.9% down to 1.5%.
It might seem like it's not much, but it can have a significant impact on your business.
Imagine you have a website with 1k daily traffic selling a product for $100. At a 1.5% conversion rate, you'd be having revenues of $550k per year. If you could increase that conversion rate to 1.9%, you'd be having revenues of $690k per year.
That's an extra $140k per year, just by improving your page load times by 0.9s (from 3.3s to 2.4s).
How to Improve Page Load Times
In my experience, the most common core issues that affect page load times are:
- Too many/complex SQL operations - the number of SQL queries and their complexity
- Latency - the time it takes for a request to reach your server / CDN / database and back
Too much payload
This is the most common as it affects static sites and dynamic sites / web apps alike.
It's also the easiest to fix.
Optimize your images (tinypng.com). Use the right image format for the job. Use the right image size for the job.
Caching files in the user's browser can also help.
Too many/complex SQL operations
This only applies for dynamic sites / web apps that use a database.
If you're making too many SQL queries, try to reduce them by using joins, subqueries, and other SQL features.
If your SQL queries are too complex, try to simplify them. If you can't, try to cache the results.
Caching doesn't necessarily mean using a caching server like Redis or Memcached. It can be as simple as using background jobs to pre-compute the results and store them in the database. Or even just storing the results in a file and loading them from there.
The further away your server is from your users, the longer it will take for them to load your website as the request has to travel a longer distance.
A CDN can help with static assets and it's easy to set up, but it won't help with dynamic content.
For that, you can deploy your app in multiple regions. Or, if you're using a caching solution like Redis, deploy that in multiple regions. This way, you can cache the results in the user's region and reduce latency.
The solutions for latency are a bit more complex, but they can be worth it if you have a lot of very international traffic.
It's important to keep in mind that improving (or even just maintaining as you add more features) your website's / app's load time is a continuous process that requires regular monitoring and optimization.
Ultimately though, studies (and common sense) have shown that faster page load times lead to better user engagement, higher conversion rates, and improved search engine rankings.