Monday, 25 June 2012

A small basic thing but important

We all well know that to improve the performance of a webpage one of the basic way is to reduce the size of the images and save them in right format. Sometimes we may ignore this, may be by thinking like what impact a single image will make on my website’s performance. I can give you a good example how a single image of size mere 70KB is capable of breaking your site down at peak load time (Come on… 70KB is not a big file….. people these days talk about terabytes and you are writing about 70KB……).
Case Study:
During HSC and SSC result declaration time, our HSC and SSC result declaration websites received around 1,30,69,227 hits. I will do a comparative analysis on HSC and SSC result sites:
HSC Result Website SSC Result Website
Total Number of Hits 47,83,418 87,91,250
Maximum Hits/Sec 705 1502
Maximum Concurrent Client Connections 16,275 68,500
Maximum Throughput IN 110Mbps 56Mbps
Maximum Throughput OUT 95Mbps 52Mbps
Total Bandwidth 34.08 GB 26.78 GB

From the above table we can see that SSC result website got almost double number of visitors than the HSC result website. But what is this???????? Even though SSC result website received double traffic, but still it consumed around 8GB less bandwidth than HSC result site. Also from above table we can see that at the peak load time, HSC result website consumed almost double network throughput than the SSC result website, but had only half number of hits.
So what is the reason?????
In HSC result website we used one image to display information about our UG-PG admission website, the image was of size around 70KB, whereas SSC result did not have any large image. The maximum size of the image used in SSC result website was 12KB, i.e. for our logo.
I analyzed the bandwidth consumed by the individual components of both the website and I found that, in HSC result website the UG-PG admission image consumed 18.63 GB of the total bandwidth. Which comes around 55% of the bandwidth consumed by the HSC result website. This was the reason of high throughput at the peak hour.
We have software-based virtual appliance load balancer which has throughput processing limitation (like 200Mbps, depending on the version we have). So as we were monitoring the load on the load balancer, the throughput was a point of concern at the time of HSC result. It was growing alarmingly and if some more load would have come that day, the load balancer would not have been capable of processing the requests (because of the throughput restriction). Ultimately some users might have not been able to access our website at that time.
So, avoid using large images in the websites on which heavy load is expected.
Lets calculate:Image File size: 70KB
Number of hits for this image: 3,00,000
Total Bandwidth: 20GB (This is a big number right?????)
For 1500 concurrent user requesting the image at the same time, bandwidth required: 102MB
But I must use some image in my high traffic site, what should I do?
The best solution is to use some public CDN or public image hosting site, and embed the link into the website Smile, simple enough.