// you’re reading...

Cloud Hosting

Advanced methods of speeding up web sites

There are a raft of ways to speed up web sites. There are popular ways, like caching the compiled code with apc or similar. People try swapping out their web server, for faster ones.

Then you can cache whole web pages, or sql queries, or even more complex partial parts of pages.

Then you can move pieces of your site to CDNs.

You can hand optimize css and js, and web images. Or use something automated like pagespeed. These speed ups are more aimed towards a better user experience of page load performance, as opposed to server scaling.

You can cluster databases, and web server, and use auto scaling.

When you try even harder, you can try things like lazy loading. This helps the user experience of performance, not just the scaling of performance.

There are other strategies that can work equally well, or better, pre-loading is the opposite , but sometimes outperforms lazy loading.

Lazy loading is the idea of loading most of the page first, let the page display, and then come back and complete more of the details.

Lazy loading is a programing level issue, and generally you need threading or a delay mechanism or ajax or an onload event or something. So after the initial page displays, you can make more requests.

There is also lazy partial loading, and pre loading partial.

There is even things like lazy opportunisitic loading – I did this for a company, years ago, and they didnt believe it was possible. They had an oracle report that took on average 20 seconds. And I coded the site, such that it averaged under 1 second from when the user clicked – without actually changing the report code or the database. We just GUESSED what report the user wanted, before they asked – and cache the result, if we were correct, then bingo – report is zero seconds. The database got really busy running reports that werent always used, but the client didnt care about that.

Recently I had a client, that had such performance issues, they couldnt afford the scale out servers. The content could not be cached, because it was a fast moving auction site. I tweeked their code a small amount, based on a short cut behind the business rules I made, and I got a speed increase that accelerated more as more people used the site – the result was a flat CPU usage, regardless of the number of users – and they went back to 1 CPU.

There is loads of ‘patterns’ to speed up performance, the trick is to use the right one for the right project.

Most projects run into 1 of a few issues:

– no ability to fix performance/scaling issues

– analysis paralysis – so much time goes into the performance, and nothing comes out. This is particularly bad when its done before the original project is delivered.

– performing the optimization you know about, like replacing the web server, and it ends up giving 1%-2% improvement for 2 months effort.

– no metrics to understand the scalability of the site, and therefore any changes you make you cant make reasonable decisions

– attempts to scaleout based on poor information. The most common, is separating out the database to a new server, and the database might only be equating to 5% of the scaling issue

– poor tooling and information on understand your site

Your steps should be :
1. deploy tools

2. gather metrics

3. understand your scalability goals

4. understand your budget and timescale for hosting and coding changes

5. assess a wide number of changes, and their likely impact