Tuesday, August 12, 2014

Widgets

Web page performance - Myth and solution...

At different points in my journey in software industry, I got engaged in discussions/exercises, which are aimed towards improving the performance of the product (For now, let’s constrain it to only to web based products). I have learnt a lot from all such engagements, but at the same time, I feel that there is a lot of gap, the way people see performance and aspire to improve it. Let’s dig a little deep and understand the objective and how to achieve it.

Define the performance GOAL
Performance improvement is something, which at no point of time you can say with 100% confidence that you have achieved it completely. It can be an endless exercise and you do it endlessly only when you have INFINITE people and time to do it. But the reality is different. So, it boils down to the fact that you should come up with a smart GOAL for performance to ensure smart ROI.  

How to define GOAL
Defining the goal for your web page performance can be a tedious exercise. Most of the time, I have encountered people having random goals (page load time less than 2 secs.) without doing enough homework. IMO, before stating the goal, one should first analyse following parameters - 
  • Consumer: It sounds reasonable and obvious to first figure out the consumer for whom you are improving the performance. For majority of the cases, I find two main categories here.
    • The real end user
    •  Search engine crawlers
In case you are not worried much about SEO then you can consider yourself in the luckier lot who do not need to think about the later.
  • Platform: Performance numbers vary significantly based on the platform e.g. if your web page is only for mobile then the perf. score target can be significantly different from a web page which is only serving on desktop browser. 
  • Page budget: There have been numerous discussions on the obesity of internet. This obesity comes with a cost to performance. Hence we must define the page budget upfront and performance goal should be in accordance with the page budget. The idea behind the page budget is to define amount of content (text, video, image etc…), dynamism, 3rd party assets you want to load on the page. Due to the nature of business, if you provide a very high budget to your page, then you should compromise your performance goals accordingly.
  • Performance metric: Now it boils down to which metric is the best to track the performance of the page? There are so many metrics related to page performance. Traditionally page load time has been the de facto metrics, which I have found everyone emphasizing on while talking about page load performance. I am not sure about the reason but the reason can be as basic as “it is easy to understand” compared to other more technical metrics. IMO, correct metric definition is very important part of the overall optimisation strategy
    • Speed Index: For end user what matters most is how quickly he/she can start consume the content on the page. How does it matter if one ajax call on the page is taking 10 secs in the background but most of the content is loaded for consumption for the end user fairly quickly. Although the page load time for such pages will not be very healthy but user is not restricted from consuming the content of the page unless page load event is not fired for the page. So, it reasonably intuitive that if you device a metric which gives score around how quickly the content is rendering for a given page and optimizing that will yield better end user satisfaction.  I find Speed Index from Webpagetest.org to be an apt metric for the same.
    •  TTFB for search engines: People have been experimenting with various page performance metrics to understand its impact on SEO. Moz guys did a thorough analysis around it to understand the relation between a given performance metric and SEO rank. And the results are not counter-intuitive. As per the result the time-to-first-byte (TTFB) has a correlation with the search rankings.

Lower TTFB leading to higher search rank position.

No correlation between page load time and search rank position.

For more detailed report access Moz report here
  • Competitive analysis:  At the beginning when you are building the product first time, it becomes really complex to come up with target numbers for performance metrics. In such cases, you can get a lot of clue from competitive landscape. This analysis can help you both in terms of setting up the goal for performance metrics and page budget.


Defining the right goal is almost half the battle won. All of above can help you in terms of coming up with the right performance GOAL for your pages. Now it all boils down to how to achieve the goal and maintain/improve on a regular basis.  There are many technology write-ups about tweaking performance at DB level, server end and UI level. But IMO, the most important piece is to inject right hooks in development process so that everyone remains sensitive about performance.  Below items which can provide you some clue on these lines:

Performance in product design  
A large part of performance goal can be achieved by right design of product. I am firm believer that the sensitivity about performance should start from the product inception stage. Brad frost has described it beautifully over here. The requirement document should clearly mention about performance goals for pages considering the above-mentioned parameters.

Performance measurement tools integration with Continuous integration system
During regular development cycle, it is very important to raise alarms at the very early stage in case there is degradation in performance score for a given page. It is almost impossible to achieve this in a manual way hence one should integrate tools, which provide the relevant scores with each build and raise an alarm in case of degradation. You can use tools like Google PageSpeed Insight score for such purpose.

Knowledge sharing
I have seen many instances where in people act on performance improvements only when there is an alarm raised for it. I attribute it to lack of awareness, which can be reduced significantly by creating a knowledge-sharing environment. 

I could have covered the nitty-gritty details of perf. Optimization in a given technology but I believe that more important part is to have a smart approach. Rest I will leave it to you decide whether you want to jump on the problem in a reactive way or …

8 comments:

  1. Nice article. Are you associated with any company or, do you provide any consultancy around performance improvements ?

    ReplyDelete
  2. Yes. I am associated with a company called PropTiger.com. In case you are looking for some advice, I can provide you. You can reach me here: ravibhu[AT]gmail.com

    ReplyDelete
  3. Well written! The fact that one needs to set sensible and realistic goals is very important indeed.

    ReplyDelete
  4. Very nice summary Ravi. spot on!

    ReplyDelete
  5. Nice article Ravi. I can see the experience talking :)
    -Jatin.

    ReplyDelete
  6. I really like how you observed different elements and classified them, nice post, thanks.

    ReplyDelete