With so many options before them, today’s web site visitors don’t have much patience. A web page that doesn’t load quickly enough for their satisfaction, in fact, is often enough to turn visitors away for good. Luckily, most of these issues are fairly easy to address if one takes a systematic, step-by-step approach to things.
Benchmark to Establish a Baseline and Keep Measuring With Every Change
When looking to improve a given site’s performance, the first thing to do is to figure out just how fast it’s responding to begin with. There are a variety of tools for doing this, with the single most important thing about them being that all must be run from a machine other than the server itself in order to return worthwhile results.
The Apache Software Foundation’s “Apache Bench” utility, for example, is a command line program that can be used to stress and time web servers by those who have access to other computers to run it from. In fact, some have created scripts which allow users to run multiple instances of this small utility on a number of remote computers and which automatically combine the results.
Where to Look for Improvement
The number one cause of server slowness is unnecessary disk access. Platter-based hard drives–and even SSDs with no moving parts–are hundreds or thousands of times slower than system memory, so accessing them in the course of serving up a page invariably results in slowdown. Adding memory to a server which shows a lot of disk access under load, then, can often lead to major improvements, as this will allow the operating system to cache frequently-used static pages in system memory. The utility “iotop” can be used to watch disk access in real time while a server is working to display pages.
It’s also important to make sure that you establish a baseline in terms of performance before you go meddling around too much with various aspects of your site. For example, you should really take the time to do a webpage speed test before you make too many changes. This way, you’ll know if you’re having a problem with specific page elements, and you can track down the cause.
In the case of more dynamic websites, CPU issues can be just as problematic. Many modern sites have to do a fair amount of computation on every request in order to deliver the kind of responsive, satisfying experiences that users expect. If CPU usage is a bottleneck, it is generally easy to identify through utilities like “top” which show how much of that resource is being consumed during a storm of requests. In some cases, rewriting server-side code to make it more efficient will do the trick, while in others CPU upgrades may be needed, whether that means moving to a beefier dedicated server or a more generous VPS.
Comments are closed, but trackbacks and pingbacks are open.