25 September 2012

Fastest loading of Webpage using Browser Caching

Recently I have done performance improvement in one project.
Here are the key points.

  • While serving js/css from your server. Send Cache-control and Expiry header to one year. Now When user open page for second time, it will pick these js/css from cache.

    Now the big question is - What will happen when some update is available in js/css file ? Answer - Use SVN revision number in js/css url.

    Example -

    When there is update available, it will 891. Now URL is changed and browser will pick up new version of JS file. Same applicable for CSS and other Static resources.
  • While serving Dynamic resources, Identify that which resources are session specific and something which will not change. You can serve them using session id.
Using the above technique, your web-page will load super-fast.