SlideShare a Scribd company logo
Presentation Tier
                   Optimizations
                      Optimization of Web UI layer
                                      Presentation By
                                      Anup Hariharan Nair
                                      Date: 16 April 2011
                                      http://HiFiCoding.com/




Prepared using :
Why bother ?


 Google found that the page with 10 results took 0.4 seconds to
  generate. The page with 30 results took 0.9 seconds. Half a
  second delay caused a 20% drop in traffic. Half a second delay
  killed user satisfaction.

 In A/B tests, Amazon tried delaying the page in increments of 100
  milliseconds and found that even very small delays would result
  in substantial and costly drops in revenue.

 Reference :
  http://www.codinghorror.com/blog/2011/06/performance-is-a-
  feature.html
Focus of Web Optimization


 Organizations focus process optimization of
    Data Tier
    Application Tier


    Presentation Tier is usually ignored.
    Presentation Tier is responsible for more than 30% of Client/Server
     application performance


 Who is to be blamed?
    In early days, there were no articles on patterns or engineering practices to
     optimize the Presentation Tier.
    Still need specialists to
    Understand the loading pattern of HTTP-Response objects.
    Optimize the Load pattern of HTTP-Response objects.
What should be
                                                considered?
 Optimizing Presentation Tier requires an engineering approach.

 Two most important aspects of optimizing the presentation Tier
  are
    Reduce HTTP Requests
      • Reducing the total number of HTTP Requests made to the server by the
         Clients browser.
    Optimize HTTP Response Objects
      • Reduce the total HTTP Response objects sent from server to client.
      • Reduce the size of response objects.
      • Re-Engineer the load pattern for response objects.
What should be
                                           considered?
 Total size of data to be loaded on HTTP calls. (Minify Html, CSS
  and JavaScript to reduce size of response objects)

 Time it takes for the browser to read (Parse) the mark-up
  language, and client side scripts. (W3C compliant mark-up are
  rendered quickly by the Web-Browser.)

 Number and size of the multimedia contents like
  video, photo, and flash.

 HTTP server Caching of repeated object requests.

 Number of Content Delivery Networks (CDN) available from the
  point of HTTP request.
JavaScript Development
                                        Patterns
 Load JavaScript On-Demand.

 Compress Your JavaScript (minify files)

 Place JavaScript at end of Mark-up.
Load JavaScript
                                                                           On-Demand.
<script type='text/javascript' src='snip.js'></script>
                                                          Vs.
If(event ==“true”)
{
var script = document.createElement('script');
script.type = 'text/javascript';
script.src = 'snip.js'; /*Only import the Library on the occurrence of an event.*/
document.getElementsByTagName('head')[0].appendChild(script);
}



/* import with a random query parameter to avoid caching */
       function $importNoCache(src){
         var ms = new Date().getTime().toString();
         var seed = "?" + ms;
         $import(src + seed);
       }
Compress (minify)
                                               JavaScript
 Analyze your code and make sure it is well-formatted.

 Compress your JavaScript.
    Remove spaces, comments and shorten variable names where appropriate.
    We should pack the original JavaScript and deploy the packed version to
     website.


 Standard Naming Convention : “.min” in file name
 usually a prefix just before the extension.
Minify JavaScript

Before Minifying:
function todaydate()
{
     /*Variable declaration*/
     var today_date= new Date();
     var myyear=today_date.getYear();
     var mymonth=today_date.getMonth()+1        /*No semicolon, but will work */
     var mytoday=today_date.getDate();

     /*Action*/
     document.write(myyear+"/"+mymonth+"/"+mytoday)
}
--------------------------------------------------------------------------------------------------------------
After Minifying:
function todaydate(){var today_date= new Date(); var myyear=today_date.getYear();var mymonth
     =today_date.getMonth()+1; var mytoday=today_date.getDate();
     document.write(myyear+"/"+mymonth+"/"+mytoday)}
-----------------------------------------------------------------------------------------------------------------
Standard Naming Convention Sample :
     jquery-1.6.2.js (Source version or Developer version)
     jquery-1.6.2.min.js (Minified version or Deployment Version)
Place your JavaScript at
                             the end of your HTML.
 Place your JavaScript at the end of your HTML file if possible.
 Notice how Google analytics and other statistics tracking software
  wants to be right before the closing </body> tag.
 This allows the majority of page content (like images, tables, text)
  to be loaded and rendered first by the Parser.
 The user sees content loading, so the page looks responsive.
 At this point, the heavy JavaScript's can begin loading near the
  end.
 Online SEO : Google/MSN/Yahoo AI crawling Bots also prefer
  this pattern.
 Search Engine Crawlers only index Mark-up.
 They do not index Client Side Scripts.
Place your JavaScript at
                                          the end of your HTML.
Sample
   <html>
   <head></head>
   <body>

   <!--Some Body Code-->
   <button type="button" onclick="displayDate()">Display Date</button>
   <!--Some Body Code-->

   <script type="text/javascript">
          function displayDate()
          {document.getElementById("demo").innerHTML=Date();}
   </script>
   <script src="myjs.js"></script>
   </body>
   </html>
Load Media On-Demand


 Yahoo.com loads images when they are in browsers viewable
  zone.

 jQuery-Images-OnDemand Library.
    http://code.google.com/p/jquery-images-ondemand/
    Library takes care of most of the operation.
    All that is needed is to append an additional CSS Class to the “img” object as
     follows :

        <img class=„class1 img-ondemand' longdesc='my_pic.jpg' src='pix.gif' />


    This is a very simple script to load images On-Demand.
    Using this you avoid to load all page images and get a faster web page. Also
     adds delayed load of Image objects.
    With HTML5, Multimedia objects can also be extracted using jQuery or
     DOM, as they can be specified by Tags instead of embedding using an
     OBJECT Tag.
CSS Sprites


 To reduce the number of requests the browser makes to the
  server, some web designers combine numerous small images or
  icons into a larger image called a sprite sheet or tile set.

 CSS is used to select the parts of the composite image to display
  at different points in the page. If a page has ten 1 kB images, they
  can be combined into one 10 kB image, downloaded with a single
  HTTP request, and then positioned with CSS.

 Reducing the number of HTTP requests can make a Web page
  load much faster. In this usage, the sprite sheet format that had
  been developed for use in game and animation engines is being
  applied to static images
Before CSS Sprite


 CSS Code :
      /* Three different images.*/
      #item1 a:hover{background: url('img_1.gif')}
      #item2 a:hover{background: url('img_2.gif') }
      #item3 a:hover{background: url('img_3.gif') }



 HTML/XHTML Code :
      <div id=“item1”> </div> <!—This will show the first image-->
      <div id=“item2”> </div> <!—This will show the second image-->
      <div id=“item3”> </div> <!—This will show the third image-->
After CSS Sprite


 CSS Code :
      /*One image. Parts of the image are referenced.*/
      #item1 a:hover{background: url('img_sprites.gif') 0 -45px;}
      #item2 a:hover{background: url('img_sprites.gif') -47px -45px;}
      #item3 a:hover{background: url('img_sprites.gif') -91px -45px;}



 HTML/XHTML Code :
      <div id=“item1”> </div> <!—This will show the first image-->
      <div id=“item2”> </div> <!—This will show the second image-->
      <div id=“item3”> </div> <!—This will show the third image-->
CSS Sprites – Merged
                                             Image
 Arranging the images in the sprite   Horizontal Merge
  horizontally as opposed to
  vertically usually results in a
  smaller file size.

 Combining similar colors in a
  sprite helps you keep the color
  count low, ideally under 256
  colors so to fit in a PNG8.

                                         Vertical Merge
HTTP Cache


 Oldest trick of the trade
HTTP Caching –
                                            ETag (Entity tags)
 Comparing versions with the modification time generally works, but could lead
  to problems.
 What if the server‟s clock was originally wrong and then got fixed?
 What if daylight savings time comes early and the server isn‟t updated?
 The caches could be inaccurate.

 ETags to the rescue. An ETag is a unique identifier given to every file. It‟s like
  a hash or fingerprint: every file gets a unique fingerprint, and if you change
  the file (even by one byte), the fingerprint changes as well.

 Instead of sending back the modification time, the server can send back the
  ETag (fingerprint):
 Etag example : ead145f
 File Contents could be an image, HTML, CSS, JavaScript..)

 The ETag can be any string which uniquely identifies the file. The next time
  the browser needs logo.png, it can have a conversation like this
HTTP Caching –
                 ETag (Entity tags)
 Etag Caching
CDN


 A content delivery network or content distribution network (CDN)
  is a system of computers containing copies of data, placed at
  various points in a network so as to maximize bandwidth for
  access to the data from clients throughout the network.

 A client accesses a copy of the data near to the client, as
  opposed to all clients accessing the same central server, so as to
  avoid bottlenecks near that server.

 Content types include web objects, downloadable objects (media
  files, software, documents), applications, real time media
  streams, and other components of internet delivery
  (DNS, routes, and database queries).
 Not Replicated Servers.
Commercial CDN


   Akamai Technologies
   Amazon CloudFront
   AT&T
   Bitgravity
   CDNetworks
   Chinacache
   Cotendo
   EdgeCast Networks
   Highwinds Network Group
   Internap
   Level 3 Communications
   Limelight Networks
   Microsoft Windows Azure CDN
   Mirror Image Internet
   NetDNA
Runtime – HTTP
                                               Compressions
 Runtime HTTP Compressions




   Configuring HTTP Compression in IIS
      http://technet.microsoft.com/en-us/library/cc771003%28WS.10%29.aspx
      Note : It is not enabled by default.
   Configuring HTTP GZIP Compression in APACHE
      http://betterexplained.com/articles/how-to-optimize-your-site-with-gzip-
         compression/
      Note : Need to install GZIP modules and configure with Apache.
Valid W3C compliant page


 http://validator.w3.org/

 Not just for cross browser rendering & validation.

 Helps browsers to quickly read the documents & render it without
  getting confused. This avoid a delay in page processing at clients
  browser.
How do I test my
                          Application Performance?
 Online Test (Online Testing)
    WebPageTest.ORG from AOL.
        • URL : http://www.webpagetest.org
    It provides :
        • Waterfall Load Pattern
        • HTTP Response Object Load Pattern and time.
        • Optimization Checklist.
 Test on Workstation (Offline Testing)
    YSlow plug-in for Firebug in Firefox, from Yahoo Developer Network.
    URL : http://developer.yahoo.com/yslow/
      • Does not provide Waterfall Load Pattern
      • Only provides Optimization Checklist.
Reference


 Yahoo Client/Server Developer reference
    http://developer.yahoo.com/performance/rules.html
 Google Client/Server Developer reference
    http://code.google.com/speed/page-speed/docs/rules_intro.html
 W3C standards compliant Web sites
    http://www.w3.org/QA/2002/07/WebAgency-Requirements

More Related Content

PPTX
DotnetConf - Cloud native and .Net5 announcements
DOC
Praveen Kumar Resume
PDF
John Willis Cc Use Cases
PPTX
Azure Container Instance
PDF
Aws serverless multi-tier_architectures
PPTX
Service Fabric and Azure Service Fabric Mesh introduction
PPTX
Monitoring Containerized Micro-Services In Azure
PPT
Cloud Use Cases And Standards
DotnetConf - Cloud native and .Net5 announcements
Praveen Kumar Resume
John Willis Cc Use Cases
Azure Container Instance
Aws serverless multi-tier_architectures
Service Fabric and Azure Service Fabric Mesh introduction
Monitoring Containerized Micro-Services In Azure
Cloud Use Cases And Standards

What's hot (20)

PDF
Deploying Cloud Use Cases
PPTX
TugaIT 2016 - Docker and the world of “containerized" environments​
PPTX
Lets talk about: Azure Kubernetes Service (AKS)
PDF
Container orchestration k8s azure kubernetes services
PPTX
Azure Container Services​
PPTX
Azure Container Services​
PDF
ContainerDays NYC 2016: "Containers in Azure: Understanding the Microsoft Con...
PDF
Comparison and mapping between various cloud services 2019
PPTX
Tooling and DevOps for the Hybrid Cloud with Azure and Azure Stack
PPTX
Azure vidyapeeth -Introduction to Azure Container Service & Registry Service
PPTX
Azure fundamentals 03
PPTX
Azure Automation and Update Management
PPTX
Microsoft Azure News - 2018 June
PPTX
Monitor Cloud Resources using Alerts & Insights
PPTX
Debugging and Interacting with Production Applications - MS Online Tech Forum
PDF
04_Azure Kubernetes Service: Basic Practices for Developers_GAB2019
PPTX
Innovation anywhere with microsoft azure arc
PPTX
Architecting and Building Hybrid Cloud Apps for Azure and Azure Stack
PPTX
TechnoramaNL Azure Key Vault, Azure Dev Ops and Azure Data Factor
PPTX
Intro to docker and kubernetes
Deploying Cloud Use Cases
TugaIT 2016 - Docker and the world of “containerized" environments​
Lets talk about: Azure Kubernetes Service (AKS)
Container orchestration k8s azure kubernetes services
Azure Container Services​
Azure Container Services​
ContainerDays NYC 2016: "Containers in Azure: Understanding the Microsoft Con...
Comparison and mapping between various cloud services 2019
Tooling and DevOps for the Hybrid Cloud with Azure and Azure Stack
Azure vidyapeeth -Introduction to Azure Container Service & Registry Service
Azure fundamentals 03
Azure Automation and Update Management
Microsoft Azure News - 2018 June
Monitor Cloud Resources using Alerts & Insights
Debugging and Interacting with Production Applications - MS Online Tech Forum
04_Azure Kubernetes Service: Basic Practices for Developers_GAB2019
Innovation anywhere with microsoft azure arc
Architecting and Building Hybrid Cloud Apps for Azure and Azure Stack
TechnoramaNL Azure Key Vault, Azure Dev Ops and Azure Data Factor
Intro to docker and kubernetes
Ad

Viewers also liked (7)

PDF
Presemtation Tier Optimizations
PDF
Age of Quantum computing
PPTX
Integrated ALM using Microsoft 2012 Solutions
PPTX
Java vs .net
PPTX
Comparison of Programming Platforms
PDF
Lightning Talk #9: How UX and Data Storytelling Can Shape Policy by Mika Aldaba
PDF
Succession “Losers”: What Happens to Executives Passed Over for the CEO Job?
Presemtation Tier Optimizations
Age of Quantum computing
Integrated ALM using Microsoft 2012 Solutions
Java vs .net
Comparison of Programming Platforms
Lightning Talk #9: How UX and Data Storytelling Can Shape Policy by Mika Aldaba
Succession “Losers”: What Happens to Executives Passed Over for the CEO Job?
Ad

Similar to Presentation Tier optimizations (20)

PDF
Website Performance at Client Level
KEY
Developing High Performance Web Apps - CodeMash 2011
PDF
Ajax Performance Tuning and Best Practices
PDF
Developing High Performance Web Apps
KEY
Optimization of modern web applications
PDF
Optimizing Your Frontend Performance
PDF
Tech Headline - JavaScript Performance
PDF
A little journey into website optimization
PDF
High Performance Websites
PDF
Even faster web sites 1st Edition Steve Souders
PDF
PrairieDevCon 2014 - Web Doesn't Mean Slow
PDF
PPT
Performance engineering
PDF
High Performance Front-End Development
KEY
A rough guide to JavaScript Performance
PDF
Front-end optimisation & jQuery Internals (Pycon)
PPTX
Html Optimization for SEO
PPTX
10 Tips to make your Website lightning-fast - SMX Stockholm 2012
PDF
Performance on the Yahoo! Homepage
PDF
Building performance into the new yahoo homepage presentation
Website Performance at Client Level
Developing High Performance Web Apps - CodeMash 2011
Ajax Performance Tuning and Best Practices
Developing High Performance Web Apps
Optimization of modern web applications
Optimizing Your Frontend Performance
Tech Headline - JavaScript Performance
A little journey into website optimization
High Performance Websites
Even faster web sites 1st Edition Steve Souders
PrairieDevCon 2014 - Web Doesn't Mean Slow
Performance engineering
High Performance Front-End Development
A rough guide to JavaScript Performance
Front-end optimisation & jQuery Internals (Pycon)
Html Optimization for SEO
10 Tips to make your Website lightning-fast - SMX Stockholm 2012
Performance on the Yahoo! Homepage
Building performance into the new yahoo homepage presentation

Recently uploaded (20)

PDF
gpt5_lecture_notes_comprehensive_20250812015547.pdf
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PPTX
TLE Review Electricity (Electricity).pptx
PPTX
cloud_computing_Infrastucture_as_cloud_p
PDF
A comparative study of natural language inference in Swahili using monolingua...
PPTX
A Presentation on Artificial Intelligence
PPTX
Group 1 Presentation -Planning and Decision Making .pptx
PDF
Encapsulation_ Review paper, used for researhc scholars
PPTX
TechTalks-8-2019-Service-Management-ITIL-Refresh-ITIL-4-Framework-Supports-Ou...
PDF
NewMind AI Weekly Chronicles - August'25-Week II
PDF
Univ-Connecticut-ChatGPT-Presentaion.pdf
PPTX
Spectroscopy.pptx food analysis technology
PDF
Unlocking AI with Model Context Protocol (MCP)
PDF
Machine learning based COVID-19 study performance prediction
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PPTX
Programs and apps: productivity, graphics, security and other tools
PPTX
OMC Textile Division Presentation 2021.pptx
PPTX
SOPHOS-XG Firewall Administrator PPT.pptx
gpt5_lecture_notes_comprehensive_20250812015547.pdf
Reach Out and Touch Someone: Haptics and Empathic Computing
Building Integrated photovoltaic BIPV_UPV.pdf
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
TLE Review Electricity (Electricity).pptx
cloud_computing_Infrastucture_as_cloud_p
A comparative study of natural language inference in Swahili using monolingua...
A Presentation on Artificial Intelligence
Group 1 Presentation -Planning and Decision Making .pptx
Encapsulation_ Review paper, used for researhc scholars
TechTalks-8-2019-Service-Management-ITIL-Refresh-ITIL-4-Framework-Supports-Ou...
NewMind AI Weekly Chronicles - August'25-Week II
Univ-Connecticut-ChatGPT-Presentaion.pdf
Spectroscopy.pptx food analysis technology
Unlocking AI with Model Context Protocol (MCP)
Machine learning based COVID-19 study performance prediction
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
Programs and apps: productivity, graphics, security and other tools
OMC Textile Division Presentation 2021.pptx
SOPHOS-XG Firewall Administrator PPT.pptx

Presentation Tier optimizations

  • 1. Presentation Tier Optimizations Optimization of Web UI layer Presentation By Anup Hariharan Nair Date: 16 April 2011 http://HiFiCoding.com/ Prepared using :
  • 2. Why bother ?  Google found that the page with 10 results took 0.4 seconds to generate. The page with 30 results took 0.9 seconds. Half a second delay caused a 20% drop in traffic. Half a second delay killed user satisfaction.  In A/B tests, Amazon tried delaying the page in increments of 100 milliseconds and found that even very small delays would result in substantial and costly drops in revenue.  Reference : http://www.codinghorror.com/blog/2011/06/performance-is-a- feature.html
  • 3. Focus of Web Optimization  Organizations focus process optimization of  Data Tier  Application Tier  Presentation Tier is usually ignored.  Presentation Tier is responsible for more than 30% of Client/Server application performance  Who is to be blamed?  In early days, there were no articles on patterns or engineering practices to optimize the Presentation Tier.  Still need specialists to  Understand the loading pattern of HTTP-Response objects.  Optimize the Load pattern of HTTP-Response objects.
  • 4. What should be considered?  Optimizing Presentation Tier requires an engineering approach.  Two most important aspects of optimizing the presentation Tier are  Reduce HTTP Requests • Reducing the total number of HTTP Requests made to the server by the Clients browser.  Optimize HTTP Response Objects • Reduce the total HTTP Response objects sent from server to client. • Reduce the size of response objects. • Re-Engineer the load pattern for response objects.
  • 5. What should be considered?  Total size of data to be loaded on HTTP calls. (Minify Html, CSS and JavaScript to reduce size of response objects)  Time it takes for the browser to read (Parse) the mark-up language, and client side scripts. (W3C compliant mark-up are rendered quickly by the Web-Browser.)  Number and size of the multimedia contents like video, photo, and flash.  HTTP server Caching of repeated object requests.  Number of Content Delivery Networks (CDN) available from the point of HTTP request.
  • 6. JavaScript Development Patterns  Load JavaScript On-Demand.  Compress Your JavaScript (minify files)  Place JavaScript at end of Mark-up.
  • 7. Load JavaScript On-Demand. <script type='text/javascript' src='snip.js'></script> Vs. If(event ==“true”) { var script = document.createElement('script'); script.type = 'text/javascript'; script.src = 'snip.js'; /*Only import the Library on the occurrence of an event.*/ document.getElementsByTagName('head')[0].appendChild(script); } /* import with a random query parameter to avoid caching */ function $importNoCache(src){ var ms = new Date().getTime().toString(); var seed = "?" + ms; $import(src + seed); }
  • 8. Compress (minify) JavaScript  Analyze your code and make sure it is well-formatted.  Compress your JavaScript.  Remove spaces, comments and shorten variable names where appropriate.  We should pack the original JavaScript and deploy the packed version to website.  Standard Naming Convention : “.min” in file name  usually a prefix just before the extension.
  • 9. Minify JavaScript Before Minifying: function todaydate() { /*Variable declaration*/ var today_date= new Date(); var myyear=today_date.getYear(); var mymonth=today_date.getMonth()+1 /*No semicolon, but will work */ var mytoday=today_date.getDate(); /*Action*/ document.write(myyear+"/"+mymonth+"/"+mytoday) } -------------------------------------------------------------------------------------------------------------- After Minifying: function todaydate(){var today_date= new Date(); var myyear=today_date.getYear();var mymonth =today_date.getMonth()+1; var mytoday=today_date.getDate(); document.write(myyear+"/"+mymonth+"/"+mytoday)} ----------------------------------------------------------------------------------------------------------------- Standard Naming Convention Sample : jquery-1.6.2.js (Source version or Developer version) jquery-1.6.2.min.js (Minified version or Deployment Version)
  • 10. Place your JavaScript at the end of your HTML.  Place your JavaScript at the end of your HTML file if possible.  Notice how Google analytics and other statistics tracking software wants to be right before the closing </body> tag.  This allows the majority of page content (like images, tables, text) to be loaded and rendered first by the Parser.  The user sees content loading, so the page looks responsive.  At this point, the heavy JavaScript's can begin loading near the end.  Online SEO : Google/MSN/Yahoo AI crawling Bots also prefer this pattern.  Search Engine Crawlers only index Mark-up.  They do not index Client Side Scripts.
  • 11. Place your JavaScript at the end of your HTML. Sample <html> <head></head> <body> <!--Some Body Code--> <button type="button" onclick="displayDate()">Display Date</button> <!--Some Body Code--> <script type="text/javascript"> function displayDate() {document.getElementById("demo").innerHTML=Date();} </script> <script src="myjs.js"></script> </body> </html>
  • 12. Load Media On-Demand  Yahoo.com loads images when they are in browsers viewable zone.  jQuery-Images-OnDemand Library.  http://code.google.com/p/jquery-images-ondemand/  Library takes care of most of the operation.  All that is needed is to append an additional CSS Class to the “img” object as follows : <img class=„class1 img-ondemand' longdesc='my_pic.jpg' src='pix.gif' />  This is a very simple script to load images On-Demand.  Using this you avoid to load all page images and get a faster web page. Also adds delayed load of Image objects.  With HTML5, Multimedia objects can also be extracted using jQuery or DOM, as they can be specified by Tags instead of embedding using an OBJECT Tag.
  • 13. CSS Sprites  To reduce the number of requests the browser makes to the server, some web designers combine numerous small images or icons into a larger image called a sprite sheet or tile set.  CSS is used to select the parts of the composite image to display at different points in the page. If a page has ten 1 kB images, they can be combined into one 10 kB image, downloaded with a single HTTP request, and then positioned with CSS.  Reducing the number of HTTP requests can make a Web page load much faster. In this usage, the sprite sheet format that had been developed for use in game and animation engines is being applied to static images
  • 14. Before CSS Sprite  CSS Code : /* Three different images.*/ #item1 a:hover{background: url('img_1.gif')} #item2 a:hover{background: url('img_2.gif') } #item3 a:hover{background: url('img_3.gif') }  HTML/XHTML Code : <div id=“item1”> </div> <!—This will show the first image--> <div id=“item2”> </div> <!—This will show the second image--> <div id=“item3”> </div> <!—This will show the third image-->
  • 15. After CSS Sprite  CSS Code : /*One image. Parts of the image are referenced.*/ #item1 a:hover{background: url('img_sprites.gif') 0 -45px;} #item2 a:hover{background: url('img_sprites.gif') -47px -45px;} #item3 a:hover{background: url('img_sprites.gif') -91px -45px;}  HTML/XHTML Code : <div id=“item1”> </div> <!—This will show the first image--> <div id=“item2”> </div> <!—This will show the second image--> <div id=“item3”> </div> <!—This will show the third image-->
  • 16. CSS Sprites – Merged Image  Arranging the images in the sprite Horizontal Merge horizontally as opposed to vertically usually results in a smaller file size.  Combining similar colors in a sprite helps you keep the color count low, ideally under 256 colors so to fit in a PNG8. Vertical Merge
  • 17. HTTP Cache  Oldest trick of the trade
  • 18. HTTP Caching – ETag (Entity tags)  Comparing versions with the modification time generally works, but could lead to problems.  What if the server‟s clock was originally wrong and then got fixed?  What if daylight savings time comes early and the server isn‟t updated?  The caches could be inaccurate.  ETags to the rescue. An ETag is a unique identifier given to every file. It‟s like a hash or fingerprint: every file gets a unique fingerprint, and if you change the file (even by one byte), the fingerprint changes as well.  Instead of sending back the modification time, the server can send back the ETag (fingerprint):  Etag example : ead145f  File Contents could be an image, HTML, CSS, JavaScript..)  The ETag can be any string which uniquely identifies the file. The next time the browser needs logo.png, it can have a conversation like this
  • 19. HTTP Caching – ETag (Entity tags)  Etag Caching
  • 20. CDN  A content delivery network or content distribution network (CDN) is a system of computers containing copies of data, placed at various points in a network so as to maximize bandwidth for access to the data from clients throughout the network.  A client accesses a copy of the data near to the client, as opposed to all clients accessing the same central server, so as to avoid bottlenecks near that server.  Content types include web objects, downloadable objects (media files, software, documents), applications, real time media streams, and other components of internet delivery (DNS, routes, and database queries).  Not Replicated Servers.
  • 21. Commercial CDN  Akamai Technologies  Amazon CloudFront  AT&T  Bitgravity  CDNetworks  Chinacache  Cotendo  EdgeCast Networks  Highwinds Network Group  Internap  Level 3 Communications  Limelight Networks  Microsoft Windows Azure CDN  Mirror Image Internet  NetDNA
  • 22. Runtime – HTTP Compressions  Runtime HTTP Compressions  Configuring HTTP Compression in IIS  http://technet.microsoft.com/en-us/library/cc771003%28WS.10%29.aspx  Note : It is not enabled by default.  Configuring HTTP GZIP Compression in APACHE  http://betterexplained.com/articles/how-to-optimize-your-site-with-gzip- compression/  Note : Need to install GZIP modules and configure with Apache.
  • 23. Valid W3C compliant page  http://validator.w3.org/  Not just for cross browser rendering & validation.  Helps browsers to quickly read the documents & render it without getting confused. This avoid a delay in page processing at clients browser.
  • 24. How do I test my Application Performance?  Online Test (Online Testing)  WebPageTest.ORG from AOL. • URL : http://www.webpagetest.org  It provides : • Waterfall Load Pattern • HTTP Response Object Load Pattern and time. • Optimization Checklist.  Test on Workstation (Offline Testing)  YSlow plug-in for Firebug in Firefox, from Yahoo Developer Network.  URL : http://developer.yahoo.com/yslow/ • Does not provide Waterfall Load Pattern • Only provides Optimization Checklist.
  • 25. Reference  Yahoo Client/Server Developer reference  http://developer.yahoo.com/performance/rules.html  Google Client/Server Developer reference  http://code.google.com/speed/page-speed/docs/rules_intro.html  W3C standards compliant Web sites  http://www.w3.org/QA/2002/07/WebAgency-Requirements