So you have a website and you want it to be faster. Perhaps you should of started off thinking that but in the real world that is often not how it happens.
Sorting out front end issues is often often messy or perhaps you have problems on the server side, some are hard to resolve. Sometimes you can be fighting against the framework package the website was built with. Other times you can quite quickly improve some things with a few tweaks to the server software.
Time spent waiting for the response is server side most after that is client side. Often the majority of the time is after your server has chucked out the html.
Reduce the size of the things to downloaded
– Reduce the size of files, compress those files over transmission.
– Use appropriate image formats.
Reduce the number of things to download
– Combine page assets to reduce number of page requests
– Setup a caching policy to remove the need to keep downloading the same assets.
– Put the whole page in cache, using a forward proxy or caching layer.
– Serve assets that don’t need cookies without them e.g. images
Do less
– Split up big monolithic pages into several e.g. paging
– Strip out parts of the page or site that are slow.
Do it asynchronously
– Does it need to happen immediately at page load or could it happen once the page has loaded.
– If you loaded the footer after a second or two would a user notice.
Backend
– Update your server software versions, databases, server side language and server itself.
– Look at protocols would httpd/2 be faster?
– If your using Apache would Nginx be faster for your circumstances.
Reduce the amount of time it takes to download assets.
– Use a content delivery network so files are nearer to the client.
– Split assets across multiple domains, so they can be downloaded in parallel depending on how your browser is setup.
Use faster DNS
– Once the DNS is requested its cached, you can say how long for but the initial first look requires your browser matching up the domain name to an address.
Do it out of sync
– Try prefetching the next page the user might go to or your other domain
– If they requested a report email it to them rather than make them wait whilst it is prepared.
– Only initially load images in the visible area of the screen and only load the rest as they become visible.
Simplify
– Use only those JavaScript libraries that are appropriate, do you need them all.
– Reduce HTML mark up complexity, do you need all those divs, or could they be made less, leaving yor browser less nodes to parse when building the page and reducing the page weight. Also can make your style sheet simpler if markup is more common across pages.
Assess JavaScript events
– If you sending a request on scroll do you need to do it continually or just at the end, is the server response timely or is it causing jaggedness.
Assess third party resources.
– Could you set a timeout on fetching third party resources, advertising, social widgets if they are not essential.
Check 404s
– check if there are any 404s triggered by requests they may not be as obvious as missing pictures, requests for odd favicons and robots.txt have a look in your logs.
Check server setup
– keep alive?
– etags, cache headers, created (telling the browser it already has the latest version so skip fetching same thing again)
– caches in database layers, or compilation in your server side code.