More often than not, website owner’s concerns on website performance slowdown issues are brushed away as “under-powered Server configuration for a large website”. However for a shrewd programmer, there is always ample scope for application level tuning before embarking on a vertical or horizontal scaling of servers.
It’s true that “A powerful engine alone doesn’t win the race, but, knowing how to manage weight and its placement to make the car faster is what wins races”
So, with this blog, we wish to enlighten website owners and aspiring web developers on ways and means to fix performance problems in the website
Get to the Bottom of the Problem:
As always, the first step towards solving a problem is diagnosis, we must be sure about what part of the website experiences problems, i.e. The front-end, the back-end, few pages, views, specific functionality etc., to do this, there are lot of tools available to analyse and report on the parameters that drag the website down, Given below are some of the free tools that we can get hands-on easily,
FireBug or Chrome web inspector, will show the metrics in terms of the assets in the webpage viz., response time & sizes of images, CSS, java script, errors that don’t show up on the page, 3rd party tool responses etc.,
GT Metrix,, a tool analyses the website performance comprehensively, also helps in benchmarking the performances. It gives a list of recommendations on various aspects of rendering the website.
Once we have a good deal of information on the problem, we can go about taming them, however a sound assessment of each recommendation is required to see if it will suit the website needs.
Always begin with set of simpler tasks and gradually move towards the complex implementations, but make sure to keep an eye on performance after each set of implementations.
Some of the standard optimizations for a content heavy website are,
- Enable Gzip Compression – Drastically reduces transfer time from server to browser
- Leverage browser caching - Webpage files will get stored in the browser cache, faster page loads for repeat users
- Specify a cache validator – Static resources are set with expiry time to leverage browser caching
- Set longer cache life time - Caching lifetime forces cached content to continue to exist before it can be flushed, however this may not be suitable for high traffic websites
- Enable Block Caching – Boosts performance when used along with Memcache for both anonymous & logged-in users
- Minify Scripts, Style sheets - It’s important to send as few bytes of CSS and JS requests as possible. It's not just about size, though, it's also about the number of requests to get the bits (Minify & Speedy Drupal modules will help achieving this)
- Enable Views Caching - saves your server a lot of unneeded work. Comes in handy when your view is doing a lot of computation.
- Install Fast 404 - Delivers super-fast 404 error messages for both missing files and bad paths. Serves just less than 1MB of memory for each request
- Enable Syslog, Disable database log - Database logging eats away performance from your server, OS already has a great way of maintaining logs, So database logging will be redundant
- Implement Authcache - Authcache module offers page caching for both anonymous users and logged-in authenticated users. Greatly reduces server resources, spends 1-2 milliseconds to serve pages
- Implement Entity Cache - Stores the fully loaded object into cache. Whenever a particular object is requested again, whole object out of that cache can be grabbed easily, bypassing expensive SQL queries and other resource intensive tasks.
These implementations are good enough to ensure that the website is well-oiled and performs at top notch; however, these implementations might seem like a scratch on the surface if the website has really outgrown its existing server capacity or website is at the verge of full utilization, then, the obvious solution would be scaling the server stack, still the above recommendations will ensure optimum server utilization.
We had a client who had come to us for help, after getting their site built by a freelancer, During the initial discovery phase, the client lamented as ,
“It has been over two years trying to get this site up and running and at far greater cost than anticipated, we are working with a very tight budget and have to consider whether doing this project is still worthwhile, we have to decide whether this site can pay for itself and whether we can keep putting money into it when it seems like more and more problems keep coming up “
Our Support Engineers took this up as a challenge to get the website back on track for the client at a war pace, and after a month we had a completely satisfied client who rejoices as
“This is amazing! It’s moving so fast. Even the emoticon box popped up really quick, and that’s been one of the slowest features. I’m really impressed.”