<?xml version='1.0' encoding='UTF-8'?><rss xmlns:atom="http://www.w3.org/2005/Atom" xmlns:openSearch="http://a9.com/-/spec/opensearchrss/1.0/" xmlns:blogger="http://schemas.google.com/blogger/2008" xmlns:georss="http://www.georss.org/georss" xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr="http://purl.org/syndication/thread/1.0" version="2.0"><channel><atom:id>tag:blogger.com,1999:blog-2455101440367165155</atom:id><lastBuildDate>Mon, 16 Sep 2024 02:18:06 +0000</lastBuildDate><title>Performance Research On Web Applications</title><description>how to improve performance of Web application</description><link>http://web-performance-research.blogspot.com/</link><managingEditor>noreply@blogger.com (Sekhar Veernapu)</managingEditor><generator>Blogger</generator><openSearch:totalResults>14</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><item><guid isPermaLink="false">tag:blogger.com,1999:blog-2455101440367165155.post-123031361132847819</guid><pubDate>Wed, 16 Jul 2008 04:30:00 +0000</pubDate><atom:updated>2008-07-15T21:39:46.053-07:00</atom:updated><title>Increase site performance by selectively displaying preloaded content</title><description>&quot;A key aspect of Web application performance is site response time. See how you can boost it by preloading page data and displaying content only when appropriate&quot;&lt;br /&gt;&lt;br /&gt;Developing a Web application involves many design considerations and decisions. The most important is often response time—a performance consideration. One approach to improving site response time is to preload content and then display it only when the user needs to see it. You can do this by taking advantage of Dynamic HTML (DHTML) and JavaScript.&lt;br /&gt;&lt;br /&gt;Each element within an HTML page is accessible via JavaScript. The DHTML style property contains the visibility property, which lets you control whether the element&#39;s contents are displayed on the page. To do this, you set the property to either visible or hidden. The following syntax may be used to access the property via JavaScript:&lt;br /&gt;document.element_name.style.visibility = &quot;visible&quot;;&lt;br /&gt;&lt;br /&gt;or&lt;br /&gt;document.element_name.style.visibility = &quot;hidden&quot;;&lt;br /&gt;&lt;br /&gt;The actual element is easily located by using its ID attribute and the getElementById JavaScript method:&lt;br /&gt;document.getElementById(&quot;element name&quot;).style.visibility = &quot;hidden&quot;;&lt;br /&gt;&lt;br /&gt;Remember, HTML elements are assigned ID attributes to distinguish them within the page. This allows DHTML and JavaScript to locate and work with individual elements. The following HTML sample assigns individual names to HTML header elements and uses JavaScript to show and hide the second header:&lt;br /&gt;&lt;code&gt;&amp;lt;html&amp;gt;&lt;br /&gt;&amp;lt;head&amp;gt;&lt;br /&gt;&amp;lt;title&amp;gt;div test&amp;lt;/title&amp;gt;&lt;br /&gt;&amp;lt;/head&amp;gt;&lt;br /&gt;&amp;lt;body&amp;gt;&lt;br /&gt;&amp;lt;h1&lt;br /&gt;id=&amp;quot;header1&amp;quot;&lt;br /&gt;onMouseOver=&#39;document.getElementById(&amp;quot;header2&amp;quot;).style.visibility=&amp;quot;hidden&amp;quot;;&#39;&lt;br /&gt;onMouseOut=&#39;document.getElementById(&amp;quot;header2&amp;quot;).style.visibility = &amp;quot;visible&amp;quot;;&#39;&amp;gt;&lt;br /&gt;Now you see it!&lt;br /&gt;&amp;lt;/h1&amp;gt;&lt;br /&gt;&amp;lt;h2 id=&amp;quot;header2&amp;quot;&amp;gt;&lt;br /&gt;Now you don&#39;t!&lt;br /&gt;&amp;lt;/h2&amp;gt;&lt;br /&gt;&amp;lt;/body&amp;gt;&lt;br /&gt;&amp;lt;/html&amp;gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;The code uses the onMouseOver and onMouseOut events of the first header element to show and hide the second header element. Notice that the name assigned to the second header via the ID attribute is used to control its visibility in the JavaScript.&lt;br /&gt;&lt;br /&gt;This approach to displaying and hiding content is beneficial when only portions of a document are displayed at a time. It may be applicable for menus, expanding/collapsing page regions, and so forth. You can use this technique with any HTML element, but the DIV element stands out as a prime candidate when working with chunks of a page.&lt;br /&gt;&lt;br /&gt;What is DIV?&lt;br /&gt;The DIV element is used to give structure and context to block-level content within an HTML document. Everything between the start and ending DIV tags constitute the block, and the characteristics of the contained elements are controlled either by the DIV tag attributes or by applying style sheet formatting to the block. The DIV tag is supported by both Internet Explorer and Netscape browsers.&lt;br /&gt;DIV vs. SPAN&lt;br /&gt;Many developers confuse the DIV element with the SPAN element. Although they have the same characteristics, SPAN is used to define inline content as opposed to block-level content. You would use a DIV tag for a paragraph, but a SPAN tag would be useful for applying special characteristics to one or more words within the paragraph.&lt;br /&gt;The DIV tag allows you to divide a Web page to handle formatting and presentation. You can combine it with the visibility technique to divide page content and show it as you choose. The following code sample uses the DIV tag to divide the page into sections; hyperlinks show and hide the sections:&lt;br /&gt;&lt;code&gt;&amp;lt;html&amp;gt;&amp;lt;head&amp;gt;&lt;br /&gt;&amp;lt;title&amp;gt;div test&amp;lt;/title&amp;gt;&lt;br /&gt;&amp;lt;script language=&amp;quot;JavaScript&amp;quot;&amp;gt;&lt;br /&gt;function setAllVisible() {&lt;br /&gt;document.getElementById(&amp;quot;section1&amp;quot;).style.visibility=&amp;quot;hidden&amp;quot;;&lt;br /&gt;document.getElementById(&amp;quot;section2&amp;quot;).style.visibility=&amp;quot;hidden&amp;quot;;&lt;br /&gt;document.getElementById(&amp;quot;section3&amp;quot;).style.visibility=&amp;quot;hidden&amp;quot;;&lt;br /&gt;document.getElementById(&amp;quot;section4&amp;quot;).style.visibility=&amp;quot;hidden&amp;quot;;&lt;br /&gt;}&lt;br /&gt;&amp;lt;/script&amp;gt;&amp;lt;/head&amp;gt;&lt;br /&gt;&amp;lt;body onLoad=&#39;setAllVisible();&#39;&amp;gt;&lt;br /&gt;&amp;lt;h1&amp;gt;Builder.com Sample&amp;lt;/h1&amp;gt;&lt;br /&gt;&amp;lt;ul&amp;gt;&lt;br /&gt;&amp;lt;li&amp;gt;&amp;lt;a href=&amp;quot;#&amp;quot;&lt;br /&gt;onClick=&#39;&lt;br /&gt;document.getElementById(&amp;quot;section1&amp;quot;).style.visibility=&amp;quot;visible&amp;quot;;&lt;br /&gt;document.getElementById(&amp;quot;section2&amp;quot;).style.visibility=&amp;quot;hidden&amp;quot;;&lt;br /&gt;document.getElementById(&amp;quot;section3&amp;quot;).style.visibility=&amp;quot;hidden&amp;quot;;&lt;br /&gt;document.getElementById(&amp;quot;section4&amp;quot;).style.visibility=&amp;quot;hidden&amp;quot;;&#39;&amp;gt;Section 1&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;&amp;lt;li&amp;gt;&amp;lt;a href=&amp;quot;#&amp;quot;&lt;br /&gt;onClick=&#39;&lt;br /&gt;document.getElementById(&amp;quot;section1&amp;quot;).style.visibility=&amp;quot;hidden&amp;quot;;&lt;br /&gt;document.getElementById(&amp;quot;section2&amp;quot;).style.visibility=&amp;quot;visible&amp;quot;;&lt;br /&gt;document.getElementById(&amp;quot;section3&amp;quot;).style.visibility=&amp;quot;hidden&amp;quot;;&lt;br /&gt;document.getElementById(&amp;quot;section4&amp;quot;).style.visibility=&amp;quot;hidden&amp;quot;;&#39;&amp;gt;Section 2&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;&amp;lt;li&amp;gt;&amp;lt;a href=&amp;quot;#&amp;quot;&lt;br /&gt;onClick=&#39;&lt;br /&gt;document.getElementById(&amp;quot;section1&amp;quot;).style.visibility=&amp;quot;hidden&amp;quot;;&lt;br /&gt;document.getElementById(&amp;quot;section2&amp;quot;).style.visibility=&amp;quot;hidden&amp;quot;;&lt;br /&gt;document.getElementById(&amp;quot;section3&amp;quot;).style.visibility=&amp;quot;visible&amp;quot;;&lt;br /&gt;document.getElementById(&amp;quot;section4&amp;quot;).style.visibility=&amp;quot;hidden&amp;quot;;&#39;&amp;gt;Section 3&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;&amp;lt;li&amp;gt;&amp;lt;a href=&amp;quot;#&amp;quot;&lt;br /&gt;onClick=&#39;&lt;br /&gt;document.getElementById(&amp;quot;section1&amp;quot;).style.visibility=&amp;quot;hidden&amp;quot;;&lt;br /&gt;document.getElementById(&amp;quot;section2&amp;quot;).style.visibility=&amp;quot;hidden&amp;quot;;&lt;br /&gt;document.getElementById(&amp;quot;section3&amp;quot;).style.visibility=&amp;quot;hidden&amp;quot;;&lt;br /&gt;document.getElementById(&amp;quot;section4&amp;quot;).style.visibility=&amp;quot;visible&amp;quot;;&#39;&amp;gt;Section 4&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;&amp;lt;/ul&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;&amp;lt;div id=&amp;quot;section1&amp;quot;&amp;gt;Section 1 text.&amp;lt;/div&amp;gt;&lt;br /&gt;&amp;lt;div id=&amp;quot;section2&amp;quot;&amp;gt;Section 2 text.&amp;lt;/div&amp;gt;&lt;br /&gt;&amp;lt;div id=&amp;quot;section3&amp;quot;&amp;gt;Section 3 text.&amp;lt;/div&amp;gt;&lt;br /&gt;&amp;lt;div id=&amp;quot;section4&amp;quot;&amp;gt;Section 4 text.&amp;lt;/body&amp;gt;&lt;br /&gt;&amp;lt;/html&amp;gt;&lt;/code&gt;&lt;br /&gt;The code includes a JavaScript function to hide all DIV elements. The function is called when the document is loaded. Clicking each hyperlink shows the related section and hides the others. The drawback is that these methods are supported only in Internet Explorer 5 and above and Netscape Navigator 6 and above. However, I tested it with Mozilla 1.01 with no problems.&lt;br /&gt;&lt;br /&gt;Display information only when necessary&lt;br /&gt;Combining the power of DHTML and JavaScript enables you to preload page content and display portions when appropriate. This increases response time, thus improving performance for the user.</description><link>http://web-performance-research.blogspot.com/2008/07/increase-site-performance-by.html</link><author>noreply@blogger.com (Sekhar Veernapu)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-2455101440367165155.post-2105074097506334266</guid><pubDate>Fri, 11 Jul 2008 11:23:00 +0000</pubDate><atom:updated>2008-07-11T04:32:08.413-07:00</atom:updated><title>Improving ASP.NET Application Performance and Scalability</title><description>&lt;img src=&quot;http://assets.devx.com/dropcaps/3583.gif&quot; width=&quot;23&quot; align=&quot;left&quot; height=&quot;24&quot; /&gt;&lt;!-- END DROPCAP - FIRST PARAGRAPH --&gt; any factors influence  application performance, but in essence, the most important is to be aware of  how to optimize your applications so they consume the least amount of memory and  require the least amount of processing to produce the desired output in a  managed environment.&lt;br /&gt;&lt;br /&gt;This article discusses some best practices that you  can follow during an application&#39;s development life cycle to help ensure that  your application is both scalable and achieves high performance. You don&#39;t have  to use special tools to achieve this, just write structured, readable code,  paying particular attention to techniques that are instrumental for improving,  optimizing and boosting the performance of .NET applications.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Reducing Page Load Time&lt;/b&gt;&lt;br /&gt;Avoid excessively large images, redundant  tags, and nested tables to facilitate faster page loads. Always avoid  unnecessary roundtrips to the web server. Use client side scripts to  dramatically reduce server roundtrips, thereby boosting the perceived, if not  the actual application performance. Take advantage of the &lt;span class=&quot;pf&quot;&gt;Page.IsPostback&lt;/span&gt; property to avoid unnecessary server processing  on a roundtrip, reducing network traffic. I suggest you leave page buffering on  (it is turned on by default) for a page unless you have a specific reason to  turn it off.&lt;br /&gt;&lt;br /&gt;You can pre-compile web pages in your application to reduce  the working set size and boost application performance. Set &lt;span class=&quot;pf&quot;&gt;AutoEventWireup&lt;/span&gt; attribute to &lt;span class=&quot;pf&quot;&gt;false&lt;/span&gt; in the  &lt;span class=&quot;pf&quot;&gt;&lt;pages&gt;&lt;/pages&gt;&lt;/span&gt;section of the server&#39;s &lt;span class=&quot;pf&quot;&gt;Machine.config&lt;/span&gt; file to improve performance further,  e.g.:&lt;br /&gt;&lt;br /&gt; &lt;br /&gt;  &lt;pre&gt;&lt;code&gt;&amp;lt;configuration&amp;gt;&lt;br /&gt;    &amp;lt;system.web&amp;gt;&lt;br /&gt;      &amp;lt;pages autoeventwireup=&amp;quot;true|false&amp;quot;&amp;gt;&lt;br /&gt;    &amp;lt;/system.web&amp;gt;&lt;br /&gt;  &amp;lt;/configuration&amp;gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;The &lt;span class=&quot;pf&quot;&gt;AutoEventWireup&lt;/span&gt; attribute accepts a  Boolean value that indicates whether the ASP.NET pages events are auto-wired. If  the &lt;span class=&quot;pf&quot;&gt;AutoEventWireup&lt;/span&gt; is set to &lt;span class=&quot;pf&quot;&gt;false&lt;/span&gt;,  the runtime does not have to look for each of the page event handlers. &lt;a href=&quot;http://support.microsoft.com/kb/814745&quot; target=&quot;_blank&quot;&gt;This MSDN  article&lt;/a&gt; about the AutoEventWireup Event concludes with, &quot;When you explicitly  set &lt;span class=&quot;pf&quot;&gt;AutoEventWireup&lt;/span&gt; to &lt;span class=&quot;pf&quot;&gt;true&lt;/span&gt;, Visual  Studio .NET or Visual Studio 2005, by default, generates code to bind events to  their event-handler methods. At the same time, the ASP.NET page framework  automatically calls the event-handler methods based on their predefined names.  This can lead to the same event-handler method being called two times when the  page runs.&quot; The article therefore recommends that you always set &lt;span class=&quot;pf&quot;&gt;AutoEventWireup&lt;/span&gt; to &lt;span class=&quot;pf&quot;&gt;false&lt;/span&gt; while working in  Visual Studio .NET.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Efficient ASP.NET State Management Practices&lt;/b&gt;&lt;br /&gt;ViewState is great for  storing control state but can degrade performance—especially on web sites with  large page sizes. If you&#39;ve ever looked at a page that contains a large DataSet,  you know the amount of data stored in ViewState can be overwhelming. Every byte  added to a web page by enabling its ViewState causes two bytes of network  traffic, one in each direction. Evaluate whether each web page you write  requires ViewState and avoid it when possible to speed up the page-load cycle in  your applications. You should typically use ViewState only for controls that  need to persist state. You can turn ViewState on or off at four levels: machine,  application, page, and control. Limiting the size of the ViewState and  eliminating its unnecessary usage would boost the application performance to a  large extent due to the reduced size of the rendered pages and hence the network  traffic. It should be noted that each byte of the view state causes two bytes of  network traffic for each request, one from the server to the client and the  other from the client to the server. For more information on ViewState and how  to turn it off at control, page, application, or machine levels, see &lt;a href=&quot;http://aspalliance.com/909&quot; target=&quot;_blank&quot;&gt;this article&lt;/a&gt; .&lt;br /&gt;&lt;br /&gt;You  can remove the &lt;span class=&quot;pf&quot;&gt;runat=&quot;server&quot;&lt;/span&gt; form tag completely to  reduce page size by 20 bytes. If you don&#39;t remove this tag, the page itself  passes on about 20 bytes of information to ViewState—even when the page&#39;s &lt;span class=&quot;pf&quot;&gt;ViewState&lt;/span&gt; property is set to &lt;span class=&quot;pf&quot;&gt;false&lt;/span&gt;.&lt;br /&gt;&lt;br /&gt;Caching is one of the best strategies for storing  relatively static application data. Caching reads data from memory to avoid  repeatedly retrieving data from a database, file, or any other repository, and  it can provide huge application performance gains. Use &lt;span class=&quot;pf&quot;&gt;Page  Output&lt;/span&gt;, &lt;span class=&quot;pf&quot;&gt;Page Fragment&lt;/span&gt; or &lt;span class=&quot;pf&quot;&gt;Data  Caching&lt;/span&gt; directives depending on your requirements. Cache application-wide  data that multiple users of the application need to share and access, but avoid  storing user-specific data in the cache.&lt;br /&gt;&lt;br /&gt;Use Session State only for  storing a single user&#39;s session data. Avoid storing too many objects in the  Session and turn Session State off for pages that do not need to access session  data. You can turn Session State on or off at the same four levels as ViewState:  machine, application, page, and control.&lt;br /&gt;&lt;br /&gt;Note that there are three  Session State storage modes. The right type of storage mode to choose depends on  factors such as, speed, security, scalability, and reliability. Even though the  &lt;span class=&quot;pf&quot;&gt;InProc&lt;/span&gt; mode of Session State storage is the fastest, it is  not at all well suited to a production environment and not scalable for large  sites. The &lt;span class=&quot;pf&quot;&gt;OutProc&lt;/span&gt; storage mode is well-suited for web  sites with heavy traffic, while the &lt;span class=&quot;pf&quot;&gt;SqlServer&lt;/span&gt; mode is  great for securing session data. No matter which mode you choose though, Session  State has one major disadvantage: the resource will be increasingly strained as  you scale up. There are always tradeoffs. The best mode for security,  scalability, and reliability is not always the best mode for performance, and  vice versa.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Tips for Efficient Memory and Resource Management&lt;/b&gt;&lt;br /&gt;I&#39;ve listed a few  tips in this section that can help you avoid problems. I don&#39;t have room to  explain each tip in-depth here; instead, I&#39;ve provided a basic description and  added links where appropriate so you can explore further on your own.&lt;br /&gt;&lt;br /&gt;&lt;i&gt;Try never to refer to a short-lived object from a long lived one&lt;/i&gt; to avoid  promoting short-lived objects to higher generations. Note that the .NET Garbage  Collector (GC) works more frequently against lower generations than against  higher ones. An in-depth discussion of the .NET GC is beyond the scope of this  article, but this two-part MSDN article on garbage collection (&lt;a href=&quot;http://msdn.microsoft.com/msdnmag/issues/1100/gci/&quot; target=&quot;_blank&quot;&gt;Part  1&lt;/a&gt;, &lt;a href=&quot;http://msdn.microsoft.com/msdnmag/issues/1200/GCI2/&quot; target=&quot;_blank&quot;&gt;Part 2&lt;/a&gt;) provides more background&lt;br /&gt;&lt;br /&gt;&lt;i&gt;Avoid any code that  can promote an object to a higher generation unnecessarily&lt;/i&gt; as shown in the  code snippet below:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;code&gt;   class Employee&lt;br /&gt;  {&lt;br /&gt;   EmployeeRegister empRegister;&lt;br /&gt;    void Create (int empCode, int deptCode, double basic)&lt;br /&gt;     {&lt;br /&gt;      EmployeeRegister empRegister = new EmployeeRegister();&lt;br /&gt;      empRegister.Create(empCode, deptCode, basic);&lt;br /&gt;      this.empRegister = empRegister;&lt;br /&gt;     }&lt;br /&gt;  }&lt;br /&gt; &lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;i&gt;Use &lt;span class=&quot;pf&quot;&gt;Dispose&lt;/span&gt; and &lt;span class=&quot;pf&quot;&gt;Finalize&lt;/span&gt; appropriately to handle unmanaged resources&lt;/i&gt; (for  more information, see my article &lt;a href=&quot;http://www.devx.com/dotnet/Article/33167&quot; target=&quot;_blank&quot;&gt;When and How to  Use Dispose and Finalize in C#&lt;/a&gt;. In fact, you should avoid implementing the  &lt;span class=&quot;pf&quot;&gt;Finalize&lt;/span&gt; method as much as possible.&lt;br /&gt;&lt;br /&gt;&lt;i&gt;Set any  objects no longer required to null prior to making any long-running calls&lt;/i&gt;.  Developers often set locals to &lt;i&gt;null&lt;/i&gt; after they&#39;re done using them, but in  .NET, that&#39;s not required, as the GC can safely determine when objects are no  longer needed or are not reachable, thus making them eligible for garbage  collection. However, if you use machine resources such as files, database  connections, or unmanaged objects, remember to release them in a &lt;span class=&quot;pf&quot;&gt;finally&lt;/span&gt; block—never in a &lt;span class=&quot;pf&quot;&gt;catch&lt;/span&gt; block.&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;Author&#39;s Note: In C#, it&#39;s best to wrap resource-handling code within a &lt;/span&gt;&lt;span style=&quot;font-weight: bold;&quot; class=&quot;pf&quot;&gt;using&lt;/span&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt; block to ensure that the resources are disposed of  properly when they&#39;re no longer needed. When you use the &lt;/span&gt; statement, the .NET framework implicitly creates &lt;span style=&quot;font-weight: bold;&quot; class=&quot;pf&quot;&gt;usingfinally&lt;/span&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt; blocks for those objects that implement IDisposable.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;i&gt;Acquire resources and locks late and dispose of them as soon as possible&lt;/i&gt;.  Ensure that you free or dispose unneeded resources and locks properly. In fact,  I recommend that you avoid locking and synchronization altogether unless it&#39;s  absolutely necessary.  Do not lock on the &lt;span class=&quot;pf&quot;&gt;this&lt;/span&gt; object—it&#39;s  better to lock on a private object.  If you lock on the current object instance  (&lt;span class=&quot;pf&quot;&gt;this&lt;/span&gt;), all the members of the object are also locked  irrespective of whether a lock is required on them. Do not lock on object types,  only on objects themselves&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Efficient Exception Management&lt;/b&gt;&lt;br /&gt;Exceptions are errors that occur at run  time. Exceptions are generally well understood but quite often used improperly.  An understanding of proper exception handling is one of the more important  aspects of efficient programming.&lt;br /&gt;&lt;br /&gt;&lt;i&gt;Handle only those exceptions that  you know how to handle&lt;/i&gt; and avoid handling those that you don&#39;t know how to  handle. As Eric Gunnerson, a former member of Microsoft&#39;s C# team, says &lt;a href=&quot;http://blogs.msdn.com/ericgu/archive/2006/02/15/532615.aspx&quot; target=&quot;_blank&quot;&gt;in his blog&lt;/a&gt;, &quot;the essence of exception handling is to be able  to respond to a specific exception in a specific situation.&quot;&lt;br /&gt;&lt;br /&gt;&lt;i&gt;When  possible, reduce the number of &lt;/i&gt;&lt;span class=&quot;pf&quot;&gt;try...catch&lt;/span&gt;&lt;i&gt; blocks  in your code&lt;/i&gt;; exceptions take longer to be processed and can reduce  application performance drastically. Do not use exceptions to control an  application&#39;s logic flow. Use proper validation techniques instead of exceptions  to avoid throwing unnecessary exceptions.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Efficient Data Access  Strategies&lt;/b&gt;&lt;br /&gt;&lt;i&gt;Prefer DataReaders to DataSets&lt;/i&gt;. DataReaders are much  faster than DataSets for simple sequential data access. Use a DataReader for  fast data-rendering, but not to pass data between layers of the applications or  through different application domains—unlike DataSets which can work in  disconnected mode and can be cached, DataReaders always require an open  connection. When you do have to use a DataSet, you can often set its &lt;span class=&quot;pf&quot;&gt;EnableConstraints&lt;/span&gt; property to false and use the &lt;span class=&quot;pf&quot;&gt;BeginLoadData&lt;/span&gt; and &lt;span class=&quot;pf&quot;&gt;EndLoadData&lt;/span&gt; methods for  faster data rendering. If you are using transactions keep them short to minimize  the lock durations and to improve data concurrency.&lt;br /&gt;&lt;br /&gt;&lt;i&gt;Open database  connections as late as possible and close them immediately when done&lt;/i&gt;.  Effective use of connection pooling can increase application performance by  reducing the number of roundtrips to the server. Note that each database request  in a distributed environment creates network traffic that can cause performance  bottlenecks and degrade the application&#39;s performance. Try to minimize the  number of database connections in the application. Never hold a connection open,  because that decreases the number of available connections in the connection  pool and hence degrades performance if the demand for connections exceeds the  pool count. See &lt;a href=&quot;http://aspalliance.com/1099_Understanding_Connection_Pooling_in_NET&quot; target=&quot;_blank&quot;&gt;this article&lt;/a&gt; for more information on connection pooling.&lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;b&gt;Efficient Coding Practices&lt;/b&gt;&lt;br /&gt;&lt;i&gt;Avoid late binding whenever  possible&lt;/i&gt;. Late-binding adds flexibility but is always slow compared to early  binding. Note that using virtual methods in your code requires late binding,  because virtual methods must be mapped. Any class that contains a virtual method  has its own virtual table. The virtual table in turn contains entries that  correspond to the virtual methods that the class contains. Note that the virtual  method is class specific; there can be only one virtual table per class  regardless of how many virtual methods the class contains. The runtime uses the  virtual table to map a virtual method to the object on which it is called. Hence  there&#39;s additional overhead involved (more resource usage—both processor and  memory) in binding a virtual method to the object on which it is called to  satisfy a virtual method call.&lt;br /&gt;&lt;br /&gt;&lt;i&gt;You should seal final classes (those that cannot be inherited) for  performance gains&lt;/i&gt;.&lt;br /&gt;&lt;br /&gt;&lt;i&gt;Avoid recursive method calls and try to replace  them with loops instead&lt;/i&gt;. Inline frequently called code inside loops. Avoid  calling methods or properties repetitively inside a loop. Especially, avoid  situations that will require boxing and unboxing of value types, because that  carries performance overhead—use generics instead when possible, building  strongly typed collections to avoid boxing and unboxing issues. &lt;a href=&quot;http://msdn2.microsoft.com/en-us/library/ms998547.aspx&quot; target=&quot;_blank&quot;&gt;This  link&lt;/a&gt; provides more information.&lt;br /&gt;&lt;br /&gt;&lt;i&gt;Avoid inefficient string  operations&lt;/i&gt; (see &lt;a href=&quot;http://www.codeproject.com/useritems/StringBuilder_vs_String.asp&quot; target=&quot;_blank&quot;&gt;this article&lt;/a&gt; for more information) and use collections (if  needed) efficiently.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Choosing between Server.Transfer and  Response.Redirect&lt;/b&gt;&lt;br /&gt;Use the &lt;span class=&quot;pf&quot;&gt;Server.Transfer&lt;/span&gt; method to  redirect between pages in the same application; &lt;span class=&quot;pf&quot;&gt;Server.Transfer&lt;/span&gt; avoids an unnecessary client-side redirection.  However, you cannot always just replace &lt;span class=&quot;pf&quot;&gt;Response.Redirect&lt;/span&gt;  calls with &lt;span class=&quot;pf&quot;&gt;Server.Transfer&lt;/span&gt;. If you need authentication and  authorization checks during redirection, use &lt;span class=&quot;pf&quot;&gt;Response.Redirect&lt;/span&gt; instead. The two mechanisms are not  equivalent. When you use &lt;span class=&quot;pf&quot;&gt;Response.Redirect&lt;/span&gt;, make sure you  use the &lt;a href=&quot;http://msdn2.microsoft.com/en-gb/library/system.web.httpresponse.redirect.aspx&quot; target=&quot;_blank&quot;&gt;overloaded method&lt;/a&gt; that accepts a Boolean second parameter, and  pass a value of &lt;span class=&quot;pf&quot;&gt;false&lt;/span&gt; to ensure an internal exception is  not raised. Also note that you can only use &lt;span class=&quot;pf&quot;&gt;Server.Transfer&lt;/span&gt; to transfer control to pages within the same  application. To transfer to pages in other applications, you &lt;i&gt;must&lt;/i&gt; use  &lt;span class=&quot;pf&quot;&gt;Response.Redirect&lt;/span&gt;.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Use Best Practices—and Common  Sense&lt;/b&gt;&lt;br /&gt;Even though there is no specific methodology that can fit in each  and every environment, using best practices such as those discussed in this  article can yield better application performance. You should plan and set some  well-defined performance objectives, create performance test plans, performance  checklists, and perform periodic tests based on the test plans. Keep these  performance factors in mind when designing applications. This process should be  iterative and repeated until we meet the predefined performance goals.&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;</description><link>http://web-performance-research.blogspot.com/2008/07/improving-aspnet-application.html</link><author>noreply@blogger.com (Sekhar Veernapu)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-2455101440367165155.post-6931995796961101312</guid><pubDate>Fri, 11 Jul 2008 09:47:00 +0000</pubDate><atom:updated>2008-07-11T03:13:09.935-07:00</atom:updated><title>Application Performance Issues Cause Organizations to Lose Millions, According to New Aberdeen Group Study</title><description>LEXINGTON, Mass., July 8 /PRNewswire/ -- Application performance issues&lt;br /&gt;are impacting overall corporate revenues by up to 9 percent, according to a&lt;br /&gt;new benchmark report by Aberdeen Group, a Harte-Hanks company (NYSE: HHS)&lt;br /&gt;sponsored in part by Gomez, Inc., a leading provider of web application&lt;br /&gt;experience management services.&lt;br /&gt;&lt;br /&gt;    Entitled &quot;The Lifecycle Approach Brings IT and Business Together,&quot; the&lt;br /&gt;report surveyed 206 organizations between May and June 2008 and found that&lt;br /&gt;58 percent of the organizations surveyed are unsatisfied with the&lt;br /&gt;performance of applications that they currently use. Their top challenge is&lt;br /&gt;the inability to identify issues before end users are impacted.&lt;br /&gt;&lt;br /&gt;    &quot;Being proactive about managing application performance is no longer&lt;br /&gt;optional,&quot; said Bojan Simic, research analyst, Aberdeen. &quot;What can no&lt;br /&gt;longer be ignored is the impact that application performance is having on&lt;br /&gt;some of the key metrics such as revenue growth, customer satisfaction,&lt;br /&gt;employee productivity, and profitability.&quot;&lt;br /&gt;&lt;br /&gt;    Using key performance criteria to distinguish Best-in-Class companies&lt;br /&gt;from Industry Average companies and Laggards, the report found that&lt;br /&gt;Best-in-Class companies were five times more likely to report improvements&lt;br /&gt;in quality of end user experience. It found that 65 percent of&lt;br /&gt;Best-in-Class companies have the ability to measure the quality of end user&lt;br /&gt;experience, with 81 percent reporting improved customer satisfaction.&lt;br /&gt;&lt;br /&gt;    Additionally, what allowed Best-in-Class organizations to outperform&lt;br /&gt;the overwhelming majority of their peers was a full lifecycle approach to&lt;br /&gt;application performance management including the deployment of capabilities&lt;br /&gt;for predicting, monitoring, analyzing, and optimizing application&lt;br /&gt;performance. For example, 63 percent of Best-in-Class companies use tools&lt;br /&gt;for monitoring web application performance and 48 percent use tools to load&lt;br /&gt;test their web applications.&lt;br /&gt;&lt;br /&gt;    The report also found that Best-in-Class organizations experienced:&lt;br /&gt;&lt;br /&gt;    -- 85 percent improved success rates in preventing issues with&lt;br /&gt;application performance before end users are impacted, as opposed to&lt;br /&gt;Laggards who reported zero percent improvement; and&lt;br /&gt;&lt;br /&gt;    -- 106 percent average improvement in application availability,&lt;br /&gt;compared to Laggards who reported two percent improvement.&lt;br /&gt;&lt;br /&gt;    &quot;Aberdeen&#39;s findings empirically underscore the correlation between&lt;br /&gt;quality web experiences and business success,&quot; said Matt Poepsel, Gomez VP&lt;br /&gt;of performance strategies. &quot;For too many businesses, the end user&#39;s&lt;br /&gt;experience remains clouded in obscure information -- or no information at&lt;br /&gt;all -- putting business, brand and profits at risk. The Gomez(R)&lt;br /&gt;ExperienceFirst(SM) platform of services helps businesses ensure quality&lt;br /&gt;end user experiences by testing their web applications in development and&lt;br /&gt;measuring them after deployment, mirroring the proactive, lifecycle&lt;br /&gt;approach to managing and improving application performance prescribed by&lt;br /&gt;Aberdeen in this report.&quot;</description><link>http://web-performance-research.blogspot.com/2008/07/application-performance-issues-cause.html</link><author>noreply@blogger.com (Sekhar Veernapu)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-2455101440367165155.post-2342505825697755674</guid><pubDate>Thu, 03 Jul 2008 07:59:00 +0000</pubDate><atom:updated>2008-07-03T02:31:09.242-07:00</atom:updated><title>Use multiple content sections</title><description>&lt;span style=&quot;font-size:85%;&quot;&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;Take advantage of multiple content sections in your gadget spec to render more tailored views for&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;canvas and profile pages. This will help ensure that the container only loads the necessary components&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;for each view. In particular, focus on making your profile view as lean as possible.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt; Use appData as a cache for content&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt; It&#39;s much faster to request data from the container than it is to hit your own server. There are&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;lots of ways you can cache your application data in the Persistence API and speed up page&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;loads. The profile view is a great place to do this because it gets a lot of page views&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;and there is less dynamic content.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt; Here&#39;s the slow way to load a profile page:&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt; 1.User opens profile page.&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt; 2.Your app uses makeRequest to get data from your server.&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt; 3.Once the data is returned, your app renders the profile page.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt; Here&#39;s a much faster way:&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt; 1.User opens profile page.&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt; 2.Your app uses a DataRequest to get data from the container.&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt; 3.Once the data is returned, your app renders the profile page.&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt; 4.Now, your app uses makeRequest to get data from your server.&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;5.Once the data is returned, your app updates the profile page.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt; An example&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;First, let&#39;s look at using multiple content sections. Here&#39;s the bare minimum:&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-weight: bold;backgroub:#111111&quot;&gt; &lt;/span&gt;;&amp;lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; ?&amp;gt;&lt;br /&gt;&amp;lt;Module&amp;gt;&lt;br /&gt;&amp;lt;ModulePrefs title=&quot;users &amp;amp;lt;3 speed&quot;&amp;gt;&lt;br /&gt;&amp;lt;Require feature=&quot;opensocial-0.7&quot; /&amp;gt;&lt;br /&gt;&amp;lt;/ModulePrefs&amp;gt;&lt;br /&gt;&amp;lt;Content type=&quot;html&quot; view=&quot;profile&quot;&amp;gt;&lt;br /&gt;&amp;lt;![CDATA[&lt;br /&gt; Hello, profile!&lt;br /&gt;]]&amp;gt;&lt;br /&gt;&amp;lt;/Content&amp;gt;&lt;br /&gt;&amp;lt;Content type=&quot;html&quot; view=&quot;canvas&quot;&amp;gt;&lt;br /&gt;&amp;lt;![CDATA[&lt;br /&gt; Hello, canvas!&lt;br /&gt;]]&amp;gt;&lt;br /&gt;&amp;lt;/Content&amp;gt;&lt;br /&gt;&amp;lt;/Module&amp;gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt; Now let&#39;s use the technique where we populate the profile view with HTML cached in appData:&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;Content type=&quot;html&quot; view=&quot;profile&quot;&amp;gt;&lt;br /&gt;&amp;lt;![CDATA[&lt;br /&gt;&amp;lt;script type=&quot;text/javascript&quot;&amp;gt;&lt;br /&gt;function request() {&lt;br /&gt;var req = opensocial.newDataRequest();&lt;br /&gt;req.add(req.newFetchPersonRequest(opensocial.DataRequest.PersonId.OWNER), &quot;owner&quot;);&lt;br /&gt;req.add(req.newFetchPersonAppDataRequest(opensocial.DataRequest.PersonId.OWNER, &quot;profile&quot;), &quot;usrdata&quot;);&lt;br /&gt;req.send(response);&lt;br /&gt;};&lt;br /&gt;function response(data) {&lt;br /&gt;console.log(data);&lt;br /&gt;var usrdata = data.get(&quot;usrdata&quot;).getData(),&lt;br /&gt;  owner = data.get(&quot;owner&quot;).getData(),&lt;br /&gt;  profileHtml = &#39;No data&#39;;&lt;br /&gt;if (usrdata[owner.getId()]) {&lt;br /&gt;profileHtml = usrdata[owner.getId()].profile || &#39;Empty data&#39;;&lt;br /&gt;}&lt;br /&gt;document.write(profileHtml);&lt;br /&gt;};&lt;br /&gt;gadgets.util.registerOnLoadHandler(request);&lt;br /&gt;&amp;lt;/script&amp;gt;&lt;br /&gt;]]&amp;gt;&lt;br /&gt;&amp;lt;/Content&amp;gt;&lt;br /&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt; Finally, implement some functionality for the canvas view. When the user takes an action that&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;will update the data shown in their profile, update the &#39;profile&#39; field in appData.&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;This app lets the user set a quote to be displayed on their profile.&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;When the &#39;save&#39; link is clicked, the quote and the HTML to display in the profile view are updated in appData.&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;Here&#39;s the full application spec:&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt; &lt;/span&gt;&lt;br /&gt;&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;UTF-8&amp;quot; ?&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;Module&amp;gt;&lt;br /&gt;&lt;br /&gt;  &amp;lt;ModulePrefs title=&amp;quot;users &amp;amp;lt;3 speed&amp;quot;&amp;gt;&lt;br /&gt;&lt;br /&gt;    &amp;lt;Require feature=&amp;quot;opensocial-0.7&amp;quot; /&amp;gt;&lt;br /&gt;&lt;br /&gt;  &amp;lt;/ModulePrefs&amp;gt;&lt;br /&gt;&lt;br /&gt;  &amp;lt;Content type=&amp;quot;html&amp;quot; view=&amp;quot;profile&amp;quot;&amp;gt;&lt;br /&gt;&lt;br /&gt;    &amp;lt;![CDATA[&lt;br /&gt;&lt;br /&gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;&lt;br /&gt;&lt;br /&gt;  function request() {&lt;br /&gt;&lt;br /&gt;    var req = opensocial.newDataRequest();&lt;br /&gt;&lt;br /&gt;    req.add(req.newFetchPersonRequest(opensocial.DataRequest.PersonId.OWNER), &amp;quot;owner&amp;quot;);&lt;br /&gt;&lt;br /&gt;    req.add(req.newFetchPersonAppDataRequest(opensocial.DataRequest.PersonId.OWNER, &amp;quot;profile&amp;quot;), &amp;quot;usrdata&amp;quot;);&lt;br /&gt;&lt;br /&gt;    req.send(response);&lt;br /&gt;&lt;br /&gt;  };&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;  function response(data) {&lt;br /&gt;&lt;br /&gt;    console.log(data);&lt;br /&gt;&lt;br /&gt;    var usrdata = data.get(&amp;quot;usrdata&amp;quot;).getData(),&lt;br /&gt;&lt;br /&gt;        owner = data.get(&amp;quot;owner&amp;quot;).getData(),&lt;br /&gt;&lt;br /&gt;        profileHtml = &#39;No data&#39;;&lt;br /&gt;&lt;br /&gt;    if (usrdata[owner.getId()]) {&lt;br /&gt;&lt;br /&gt;      profileHtml = usrdata[owner.getId()].profile || &#39;Empty data&#39;;&lt;br /&gt;&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    document.write(profileHtml);&lt;br /&gt;&lt;br /&gt;};&lt;br /&gt;&lt;br /&gt; &lt;br /&gt;&lt;br /&gt;  gadgets.util.registerOnLoadHandler(request);&lt;br /&gt;&lt;br /&gt;&amp;lt;/script&amp;gt;&lt;br /&gt;&lt;br /&gt;    ]]&amp;gt;&lt;br /&gt;&lt;br /&gt;  &amp;lt;/Content&amp;gt;&lt;br /&gt;&lt;br /&gt;  &amp;lt;Content type=&amp;quot;html&amp;quot; view=&amp;quot;canvas&amp;quot;&amp;gt;&lt;br /&gt;&lt;br /&gt;    &amp;lt;![CDATA[&lt;br /&gt;&lt;br /&gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;&lt;br /&gt;&lt;br /&gt;  function request() {&lt;br /&gt;&lt;br /&gt;    var req = opensocial.newDataRequest();&lt;br /&gt;&lt;br /&gt;    req.add(req.newFetchPersonRequest(opensocial.DataRequest.PersonId.OWNER), &amp;quot;owner&amp;quot;);&lt;br /&gt;&lt;br /&gt;    req.add(req.newFetchPersonRequest(opensocial.DataRequest.PersonId.VIEWER), &amp;quot;viewer&amp;quot;);&lt;br /&gt;&lt;br /&gt;    req.add(req.newFetchPersonAppDataRequest(opensocial.DataRequest.PersonId.OWNER, &amp;quot;quote&amp;quot;), &amp;quot;appData&amp;quot;);&lt;br /&gt;&lt;br /&gt;    req.send(response);&lt;br /&gt;&lt;br /&gt;  };&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;  function response(data) {&lt;br /&gt;&lt;br /&gt;    var viewer = data.get(&amp;quot;viewer&amp;quot;) &amp;amp;&amp;amp; data.get(&amp;quot;viewer&amp;quot;).getData(),&lt;br /&gt;&lt;br /&gt;        owner = data.get(&amp;quot;owner&amp;quot;) &amp;amp;&amp;amp; data.get(&amp;quot;owner&amp;quot;).getData(),&lt;br /&gt;&lt;br /&gt;        appData = data.get(&amp;quot;appData&amp;quot;) &amp;amp;&amp;amp; data.get(&amp;quot;appData&amp;quot;).getData(),&lt;br /&gt;&lt;br /&gt;        quote = &#39;&#39;,&lt;br /&gt;&lt;br /&gt;        text = &#39;&#39;;&lt;br /&gt;&lt;br /&gt;    if ((viewer.getId() || -1) == (owner.getId() || -2)) {&lt;br /&gt;&lt;br /&gt;      if (appData[owner.getId()]) {&lt;br /&gt;&lt;br /&gt;        quote = appData[owner.getId()];&lt;br /&gt;&lt;br /&gt;      }&lt;br /&gt;&lt;br /&gt;      text = [&#39;Edit your quote: &#39;,&lt;br /&gt;&lt;br /&gt;              &#39;&amp;lt;input id=&amp;quot;quote_input&amp;quot; type=&amp;quot;text&amp;quot;/&amp;gt; &#39;,&lt;br /&gt;&lt;br /&gt;              &#39;&amp;lt;a href=&amp;quot;javascript:void(0);&amp;quot; onclick=&amp;quot;save();&amp;quot; value=&amp;quot;&#39;,&lt;br /&gt;&lt;br /&gt;              quote,&lt;br /&gt;&lt;br /&gt;              &#39;&amp;quot;&amp;gt;save&amp;lt;/a&amp;gt;&#39;].join(&#39;&#39;);&lt;br /&gt;&lt;br /&gt;      document.getElementById(&#39;main&#39;).innerHTML = text;&lt;br /&gt;&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;  };&lt;br /&gt;&lt;br /&gt;                                                              &lt;br /&gt;&lt;br /&gt;  function save() {&lt;br /&gt;&lt;br /&gt;    var quote = document.getElementById(&#39;quote_input&#39;).value,&lt;br /&gt;&lt;br /&gt;        profileHtml = &#39;&#39;;&lt;br /&gt;&lt;br /&gt;    profileHtml = [&#39;Latest quote: &#39;, quote].join(&#39;&#39;);&lt;br /&gt;&lt;br /&gt;    req = opensocial.newDataRequest();&lt;br /&gt;&lt;br /&gt;    req.add(req.newUpdatePersonAppDataRequest(&lt;br /&gt;&lt;br /&gt;        opensocial.DataRequest.PersonId.VIEWER, &amp;quot;quote&amp;quot;, quote), &amp;quot;updatequote&amp;quot;);&lt;br /&gt;&lt;br /&gt;    req.add(req.newUpdatePersonAppDataRequest(&lt;br /&gt;&lt;br /&gt;        opensocial.DataRequest.PersonId.VIEWER, &amp;quot;profile&amp;quot;, profileHtml), &amp;quot;updateprofile&amp;quot;);&lt;br /&gt;&lt;br /&gt;    req.send(response2);&lt;br /&gt;&lt;br /&gt;  };&lt;br /&gt;&lt;br /&gt; &lt;br /&gt;&lt;br /&gt;  function response2(data) {&lt;br /&gt;&lt;br /&gt;    if (!data.hadError()) {&lt;br /&gt;&lt;br /&gt;      document.getElementById(&amp;quot;status&amp;quot;).innerHTML = &amp;quot;Saved quote at &amp;quot; + new Date();&lt;br /&gt;&lt;br /&gt;    } else {&lt;br /&gt;&lt;br /&gt;      document.getElementById(&amp;quot;status&amp;quot;).innerHTML = &amp;quot;There was a problem updating your profile&amp;quot;;&lt;br /&gt;&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;    /*&lt;br /&gt;&lt;br /&gt;     * Now that the page is loaded you can use makeRequest to&lt;br /&gt;&lt;br /&gt;     * see if you have fresher data on your server.&lt;br /&gt;&lt;br /&gt;    */&lt;br /&gt;&lt;br /&gt;  };&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;  function status(text) {&lt;br /&gt;&lt;br /&gt;    var dom =&lt;br /&gt;&lt;br /&gt;    dom.innerHTML = text;&lt;br /&gt;&lt;br /&gt;  };&lt;br /&gt;&lt;br /&gt; &lt;br /&gt;&lt;br /&gt;  gadgets.util.registerOnLoadHandler(request);&lt;br /&gt;&lt;br /&gt;&amp;lt;/script&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;div id=&amp;quot;main&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;div id=&amp;quot;status&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;&lt;br /&gt;    ]]&amp;gt;&lt;br /&gt;&lt;br /&gt;  &amp;lt;/Content&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;/Module&amp;gt;&lt;br /&gt;</description><link>http://web-performance-research.blogspot.com/2008/07/take-advantage-of-multiple-content.html</link><author>noreply@blogger.com (Sekhar Veernapu)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-2455101440367165155.post-1297884470506873669</guid><pubDate>Thu, 03 Jul 2008 06:20:00 +0000</pubDate><atom:updated>2008-07-03T00:54:24.920-07:00</atom:updated><title>Best practices for web development</title><description>Many techniques that are used in normal web development will also benefit your OpenSocial app. Here are some of the most effective techniques.&lt;br /&gt;&lt;br /&gt;  &lt;span style=&quot;font-weight: bold;&quot;&gt;Control the caching on your content&lt;/span&gt;&lt;br /&gt;&lt;br /&gt; Most containers offer support for the Cache-Control HTTP header. You have server-side control over how your resources are cached, so be sure to set your headers appropriately for maximum benefit&lt;br /&gt;&lt;br /&gt;   The &lt;code&gt;Cache-Control&lt;/code&gt; header is best described in the &lt;a href=&quot;http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.9&quot; target=&quot;_blank&quot;&gt;HTTP/1.1 specification &lt;/a&gt;but there&lt;br/&gt; are some &lt;a href=&quot;http://www.mnot.net/cache_docs/#CACHE-CONTROL&quot; target=&quot;_blank&quot;&gt;simpler descriptions&lt;/a&gt; available as well. If you&#39;re not sure about the cache &lt;br/&gt;headers your server is currently sending, you can try some &lt;a href=&quot;http://www.mnot.net/cacheability/&quot; target=&quot;_blank&quot;&gt;publicly available tools&lt;/a&gt; to &lt;br/&gt;examine the cache headers on your files and see if they need to be tweaked.&lt;br/&gt;&lt;br/&gt;&lt;br/&gt;&lt;br /&gt;&lt;br /&gt;  Be aware that the Cache-Controlheader will be examined for all content coming from&lt;br /&gt;your server, including XML application specs, responses from makeRequest&lt;br /&gt;(both prefetched and not), and proxied images. Be sure to set caching headers for all of this content!&lt;br /&gt;&lt;br /&gt;  &lt;span style=&quot;font-weight: bold;&quot;&gt;Notes on Apache&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;  Apache defaults to using Last-Modified and ETag headers to control&lt;br /&gt;caching for static files, rather than the recommended Expires and Cache-Control: max-age headers&lt;br /&gt;. If you are using Apache, change your cache headers to Expires and Cache-Control: max-age!&lt;br /&gt;&lt;br /&gt;  Need to disable caching on your Apache server? Use the following in your .htaccess&lt;br /&gt;file to disable caching on .css, .js, and .xml files (change the&lt;br /&gt;FilesMatch line if you need to support more filetypes):&lt;br /&gt;&lt;br /&gt;  Header unset ETag&lt;br /&gt;&lt;br /&gt;  FileETag None&lt;br /&gt;&lt;br /&gt;  Header set Cache-Control &quot;no-cache&quot;&lt;br /&gt;&lt;br /&gt;  What are the benefits? Your server has much more control over how the container caches its&lt;br /&gt;&lt;br /&gt;content. You can set a low cache expiration for content that changes often, and a high cache timeout for&lt;br /&gt;&lt;br /&gt;content that does not change. Caching will become much more efficient once you set the appropriate headers&lt;br /&gt;&lt;br /&gt;  Reducing the number of fetches&lt;br /&gt; The HTTP/1.1 specification states:&lt;br /&gt;Clients that use persistent connections SHOULD limit the number of simultaneous connections that they&lt;br /&gt;maintain to a given server. A single-user client SHOULD NOT maintain more than 2 connections with any&lt;br /&gt;server or proxy.&lt;br /&gt;&lt;br /&gt;For this reason, some internet browsers (like IE7) will only download two files from a given server at a&lt;br /&gt;&lt;br /&gt;time, shared amongst all HTML, XML, image, CSS, and JavaScript files. To reduce the number of connections&lt;br /&gt;that a user has to make back to your server, consolidate and inline as much code as possible.&lt;br /&gt;&lt;br /&gt; If your JavaScript includes look like:&lt;br /&gt;&lt;br /&gt;&amp;lt;code&amp;gt;&amp;lt;span style=&amp;quot;font-weight: bold;&amp;quot;&amp;gt;&amp;lt;script src=&amp;quot;http://www.example.com/javascript.core.js&amp;quot; type=&amp;quot;text/javascript&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;span style=&amp;quot;font-weight: bold;&amp;quot;&amp;gt;  &amp;lt;script src=&amp;quot;http://www.example.com/javascript.extra.js&amp;quot; type=&amp;quot;text/javascript&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;then you should combine each file into one master JavaScript file:&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;&lt;script src=&quot;http://www.example.com/javascript.all.js&quot; type=&quot;text/javascript&quot;&gt;&lt;/script&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;Better yet, inline your code if at all possible:&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;&lt;script type=&quot;text/javascript&quot;&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;   function1() {&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;      ...&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;   };&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;   ...&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;&lt;/script&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;This will save server connections for other assets. Remember that this approach can be used for CSS, as well&lt;br /&gt;.&lt;br /&gt;To decrease the number of image files your application needs to load, you can use image spriting to combine&lt;br /&gt;&lt;br /&gt;all your image files into a single master &quot;sprite&quot; file. Check out &lt;a href=&quot;http://www.alistapart.com/articles/sprites&quot; target=&quot;_blank&quot;&gt;A List Apart&#39;s CSS Spriting article&lt;/a&gt;&lt;br /&gt;for a good description of this technique.&lt;br /&gt;&lt;br /&gt;Generally speaking, concatenating your files is a great performance improvement you can make. Because of the&lt;br /&gt;aggressive caching that containers perform, even using a relatively slow server-side script to&lt;br /&gt;automatically concatenate files will still wind up performing better than separate files (once the&lt;br /&gt;automatically concatenated file is cached). Aim for a single CSS and a single JS file in production.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;What are the benefits? This approach keeps the number of server connections low, and reduces the total number&lt;br /&gt;of HTTP requests that each user of your application has to make.&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;Some other best practices:&lt;/span&gt;&lt;br /&gt;1.Turn on gzip for any content you deliver. Good things come in small packages.&lt;br /&gt;&lt;br /&gt;2.Minimize JS and CSS. Again, small is good.&lt;br /&gt;&lt;br /&gt;3.Split CSS and image files across 2-4 servers. Browsers limit the number of concurrent connections to any one&lt;br /&gt;server.&lt;br /&gt;&lt;br /&gt;4.Place JavaScript as late in the page as possible. Loading JavaScript blocks the downloading of other&lt;br /&gt;important components like images and CSS.&lt;br /&gt;&lt;br /&gt;Tip: Try the &lt;a href=&quot;http://developer.yahoo.com/yslow/&quot; target=&quot;_blank&quot;&gt;YSlow Firefox plugin&lt;/a&gt; to analyze your app&#39;s performance.</description><link>http://web-performance-research.blogspot.com/2008/07/best-practices-for-web-development.html</link><author>noreply@blogger.com (Sekhar Veernapu)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-2455101440367165155.post-4753008279434528495</guid><pubDate>Thu, 03 Jul 2008 05:26:00 +0000</pubDate><atom:updated>2008-07-02T23:19:33.358-07:00</atom:updated><title>Latency Tips for Orkut--Orkut-specific techniques</title><description>&lt;span style=&quot;font-weight: bold;font-family:verdana;&quot; &gt;&lt;span&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;&lt;span style=&quot;font-size:100%;&quot;&gt;Prefetch data from orkut:&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;The orkut team has implemented a &quot;pre-fetcher&quot; that will analyze your app and attempt to load the data you need at the same time it&#39;s rendering the container page, so when your app sends a DataRequest, the response is almost instantaneous. To get the most out of this feature, follow these guidelines:&lt;br /&gt;&lt;br /&gt;Do request data that you will always or nearly always need, even if it&#39;s not needed immediately on loading your gadget.&lt;br /&gt;Do batch up multiple request items into one DataRequest.&lt;br /&gt;Don&#39;t request data you don&#39;t need.&lt;br /&gt;Don&#39;t add newUpdatePersonAppDataRequest to your first DataRequest.&lt;br /&gt;Don&#39;t call opensocial.requestCreateActivity before sending your first DataRequest.&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-weight: bold;font-family:verdana;font-size:100%;&quot;  &gt;&lt;span&gt;&lt;br /&gt;Preload data from your server:&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-weight: bold;font-family:verdana;&quot; &gt;&lt;span&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;If your application uses a makeRequest call to fetch data from a third party server, chances are that you&#39;ve written something similar to:&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;;font-family:verdana;font-size:85%;&quot;  &gt;&lt;span&gt;function request()&lt;br /&gt;&lt;br /&gt;{&lt;br /&gt;&lt;br /&gt;var params = [];&lt;br /&gt;....&lt;br /&gt;gadgets.io.makeRequest(&quot;http://www.example.com/content.html&quot;, response, params);&lt;br /&gt;&lt;br /&gt;};&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-weight: bold;font-family:verdana;font-size:85%;&quot;  &gt;&lt;span&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;;font-family:verdana;font-size:85%;&quot;  &gt;&lt;span&gt;gadgets.util.registerOnLoadHandler(request);&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-weight: bold;font-family:verdana;font-size:85%;&quot;  &gt;&lt;span&gt;&lt;br /&gt;&lt;br /&gt;While this code is syntactically correct, it isn&#39;t very efficient at loading data. Users of your application will need to:&lt;br /&gt;&lt;br /&gt;1. Wait for orkut to render your application IFrame.&lt;br /&gt;2. Wait for the IFrame to finish loading so the OnLoadHandler methods will execute&lt;br /&gt;3. Wait for the makeRequest call to return data from your server.&lt;br /&gt;&lt;br /&gt;During this time, a slow application will show a loading animation in the best case, or nothing at all in the worst. To address this, orkut will offer additional syntax for preloading content from a makeRequest call while the gadget is being rendered. This feature is enabled through the addition of an extra parameter in your ModulePrefs. If your makeRequest call looks like:&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;;font-family:verdana;font-size:85%;&quot;  &gt;&lt;span&gt;var params = {};&lt;br /&gt;&lt;br /&gt;params[gadgets.io.RequestParameters.CONTENT_TYPE] = gadgets.io.ContentType.JSON;&lt;br /&gt;&lt;br /&gt;gadgets.io.makeRequest(&quot;http://www.example.com&quot;, response, params);&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-weight: bold;font-family:verdana;font-size:85%;&quot;  &gt;&lt;span&gt;&lt;br /&gt;&lt;br /&gt;You can cache the request by adding a tag:&lt;br /&gt;&lt;br /&gt;When your application IFrame loads, you will see something similar to the following embedded in the source:&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;;font-family:verdana;font-size:85%;&quot;  &gt;&lt;span&gt;gadgets.io.preloaded_ = {&quot;http://www.example.com&quot;:{&quot;body&quot;:&quot;...&quot;,&quot;rc&quot;:200}};&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-weight: bold;font-family:verdana;font-size:85%;&quot;  &gt;&lt;span&gt;&lt;br /&gt;&lt;br /&gt;Where &quot;...&quot; is the content that exists at http://www.example.com. When your application executes the makeRequest call, this content will be returned instantly, without needing to hit your server again. Signed request calls can take advantage of preloads with a slight change to the preload syntax. If your signed request code looks like:&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;;font-family:verdana;font-size:85%;&quot;  &gt;&lt;span&gt;var params = {};&lt;br /&gt;&lt;br /&gt;params[gadgets.io.RequestParameters.CONTENT_TYPE] = gadgets.io.ContentType.JSON;&lt;br /&gt;&lt;br /&gt;params[gadgets.io.RequestParameters.AUTHORIZATION] = gadgets.io.AuthorizationType.SIGNED;&lt;br /&gt;&lt;br /&gt;gadgets.io.makeRequest(&quot;http://www.example.com&quot;, response, params);&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-weight: bold;font-family:verdana;&quot; &gt;&lt;span&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;&lt;br /&gt;&lt;br /&gt;The corresponding preload code you should use is:&lt;br /&gt;&lt;br /&gt;There are a few more optimizations you can use to make preloads work even better:&lt;br /&gt;&lt;br /&gt;1. Turn off sending the viewer in signed requests. If you don&#39;t need the VIEWER ID for your signed&lt;br /&gt;request, disable it by adding signViewer=&quot;false&quot; to your tag. This will allow orkut to cache your&lt;br /&gt;request for a lot more requests. This is a critical improvement for profile pages!&lt;br /&gt;&lt;br /&gt;2. Use multiple tags if you have more than one request. You&#39;re not limited to one tag, so preload whatever you can.&lt;br /&gt;&lt;br /&gt;3. Restrict preloads to the correct view. If you only use a certain request in a specific view, restrict&lt;br /&gt;the preload to that view by adding a views attribute to your tag. For example, to restrict a&lt;br /&gt;preload to the canvas view, add views=&quot;canvas&quot; to your tag. You can also specify multiple comma&lt;br /&gt;separated views, like views=&quot;canvas,profile&quot;.&lt;br /&gt;&lt;br /&gt;What are the benefits? Users no longer need to wait for your application to finish loading on orkut before&lt;br /&gt;executing a makeRequest call. Orkut will make the request and insert the response directly into the&lt;br /&gt;application as it renders your application.&lt;br /&gt;&lt;br /&gt;Cache your static content&lt;br /&gt;&lt;br /&gt;Orkut will now rewrite the appropriate href or src attributes on HTML elements to take advantage of the&lt;br /&gt;caching proxy, meaning that all non-dynamic references to remote content will automatically get the&lt;br /&gt;benefit of caching.&lt;br /&gt;&lt;br /&gt;If your source contains an image tag which looks like:&lt;br /&gt;&lt;br /&gt;&quot;&lt;code&gt;&lt;img src=&quot;http://www.example.com/i_heart_apis.png&quot; /&gt; &lt;/code&gt;&quot;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-weight: bold;font-family:verdana;&quot; &gt;&lt;span&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;&lt;br /&gt;Orkut will render the image tag as:&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-weight: bold;font-family:verdana;&quot; &gt;&lt;span&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;&quot;&lt;code&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;img src=&quot;http://www.gmodules.com/ig/proxy?url=http%3A%2F%2Fwww.example.com%2Fi_heart_apis.png&quot; /&gt; &lt;span style=&quot;font-weight: bold;font-family:verdana;&quot; &gt;&lt;span&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;&lt;/code&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-weight: bold;font-family:verdana;&quot; &gt;&lt;span&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;What are the benefits? Users no longer need to wait for your application to finish loading on orkut before&lt;br /&gt;executing a makeRequest call. Orkut will make the request and insert the response directly into&lt;br /&gt;the application as it renders your application.&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-size:100%;&quot;&gt;Cache your static content&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Orkut will now rewrite the appropriate href or src attributes on HTML elements to take advantage of the&lt;br /&gt;caching proxy, meaning that all non-dynamic references to remote content will automatically get the benefit&lt;br /&gt;of caching.&lt;br /&gt;&lt;br /&gt;If your source contains an image tag which looks like:&lt;br /&gt;&lt;br /&gt;Orkut will render the image tag as:&lt;br /&gt;&lt;br /&gt;Any HTML fetched using makeRequest or otherwise passed through the proxy will also have its links rewritten&lt;br /&gt;in this manner. Caching is now automatic throughout your entire application.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;However, caching can make development difficult, so if you really need to disable this automatic rewriting,&lt;br /&gt;you can use the following code inside the section of your gadget spec:NONE&lt;br /&gt;&lt;br /&gt;Keep in mind that this should only be used to help develop your application. Your production apps should not&lt;br /&gt;rely on this feature!&lt;br /&gt;&lt;br /&gt;What are the benefits? This approach can dramatically reduce the load on your server for image, CSS, and&lt;br /&gt;JavaScript resources that are directly included in your application source, without you needing to&lt;br /&gt;change any code at all.&lt;br /&gt;&lt;br /&gt;Note: Orkut&#39;s rewriting is currently not compatible with the element. If you use the element to use relative&lt;br /&gt;paths in your application, you will need to change your code to use fully-qualified URLs.&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;</description><link>http://web-performance-research.blogspot.com/2008/07/latency-tips-for-orkut-orkut-specific.html</link><author>noreply@blogger.com (Sekhar Veernapu)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-2455101440367165155.post-3873797328530940538</guid><pubDate>Wed, 11 Jun 2008 06:04:00 +0000</pubDate><atom:updated>2008-06-11T00:12:37.629-07:00</atom:updated><title>What is open social API</title><description>&lt;p class=&quot;MsoNormal&quot;&gt;&lt;b style=&quot;&quot;&gt;          What is open social API?&lt;o:p&gt;&lt;/o:p&gt;&lt;/b&gt;&lt;/p&gt;  &lt;p class=&quot;MsoNormal&quot;&gt;&lt;b style=&quot;&quot;&gt;&lt;span style=&quot;color:silver;&quot;&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;  &lt;p&gt;&lt;b style=&quot;&quot;&gt;&lt;span style=&quot;color:silver;&quot;&gt;The OpenSocial API is a set of common APIs for building social applications on many websites. There are two ways to access the OpenSocial API: &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;  &lt;p&gt;&lt;b style=&quot;&quot;&gt;&lt;span style=&quot;color:silver;&quot;&gt;1. client-side using the JavaScript API &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;  &lt;p&gt;&lt;b style=&quot;&quot;&gt;&lt;span style=&quot;color:silver;&quot;&gt;2. server-side using Restful data APIs.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;  &lt;p&gt;&lt;b style=&quot;&quot;&gt;&lt;span style=&quot;color:silver;&quot;&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;  &lt;p&gt;&lt;b style=&quot;&quot;&gt;&lt;span style=&quot;color:silver;&quot;&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;  &lt;p class=&quot;MsoNormal&quot; style=&quot;margin-top: 0.25in;&quot;&gt;&lt;b&gt;&lt;span style=&quot;;font-size:15;color:silver;&quot;  &gt;JavaScript API&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;  &lt;p class=&quot;MsoNormal&quot; style=&quot;line-height: 125%;&quot;&gt;&lt;b style=&quot;&quot;&gt;&lt;span style=&quot;color:silver;&quot;&gt;The JavaScript API lives under the &lt;a href=&quot;http://code.google.com/apis/opensocial/docs/reference.html&quot;&gt;&lt;span style=&quot;color:silver;&quot;&gt;opensocial.* namespace&lt;/span&gt;&lt;/a&gt; and provides access to three primary areas of functionality:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;  &lt;p class=&quot;MsoNormal&quot; style=&quot;margin: 0.05in 0in 0.0001pt 0.45in; text-indent: -0.25in; line-height: 125%;&quot;&gt;&lt;!--[if !supportLists]--&gt;&lt;span style=&quot;line-height: 125%;font-family:Symbol;font-size:10;color:silver;&quot;   &gt;&lt;span style=&quot;&quot;&gt;·&lt;span style=&quot;&quot;&gt;            &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;!--[endif]--&gt;&lt;b style=&quot;&quot;&gt;&lt;span style=&quot;color:silver;&quot;&gt;People -- information about individual people and their relationships to each other &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;    &lt;p class=&quot;MsoNormal&quot; style=&quot;margin: 0.05in 0in 0.0001pt 0.45in; text-indent: -0.25in; line-height: 125%;&quot;&gt;&lt;!--[if !supportLists]--&gt;&lt;span style=&quot;line-height: 125%;font-family:Symbol;font-size:10;color:silver;&quot;   &gt;&lt;span style=&quot;&quot;&gt;·&lt;span style=&quot;&quot;&gt;            &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;!--[endif]--&gt;&lt;b style=&quot;&quot;&gt;&lt;span style=&quot;color:silver;&quot;&gt;Activities -- ability to post and view updates on what people are doing &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;line-height: 125%;font-family:Symbol;font-size:10;color:silver;&quot;   &gt;&lt;span style=&quot;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;margin: 0.05in 0in 0.0001pt 0.45in; text-indent: -0.25in; line-height: 125%;&quot;&gt;&lt;span style=&quot;line-height: 125%;font-family:Symbol;font-size:10;color:silver;&quot;   &gt;&lt;span style=&quot;&quot;&gt;·&lt;span style=&quot;&quot;&gt;            &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;!--[endif]--&gt;&lt;b style=&quot;&quot;&gt;&lt;span style=&quot;color:silver;&quot;&gt;Persistence -- a simple key-value data store to allow server-free stateful applications &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;  &lt;p class=&quot;MsoNormal&quot; style=&quot;line-height: 125%;&quot;&gt;&lt;b style=&quot;&quot;&gt;&lt;span style=&quot;color:silver;&quot;&gt;Here are some of the things you can do with the JavaScript API:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;  &lt;p class=&quot;MsoNormal&quot; style=&quot;margin: 0.05in 0in 0.0001pt 0.45in; text-indent: -0.25in; line-height: 125%;&quot;&gt;&lt;!--[if !supportLists]--&gt;&lt;span style=&quot;line-height: 125%;font-family:Symbol;font-size:10;color:silver;&quot;   &gt;&lt;span style=&quot;&quot;&gt;·&lt;span style=&quot;&quot;&gt;            &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;!--[endif]--&gt;&lt;b style=&quot;&quot;&gt;&lt;span style=&quot;color:silver;&quot;&gt;Build applications without maintaining your own server &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;  &lt;p class=&quot;MsoNormal&quot; style=&quot;margin: 0.05in 0in 0.0001pt 0.45in; text-indent: -0.25in; line-height: 125%;&quot;&gt;&lt;!--[if !supportLists]--&gt;&lt;span style=&quot;line-height: 125%;font-family:Symbol;font-size:10;color:silver;&quot;   &gt;&lt;span style=&quot;&quot;&gt;·&lt;span style=&quot;&quot;&gt;            &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;!--[endif]--&gt;&lt;b style=&quot;&quot;&gt;&lt;span style=&quot;color:silver;&quot;&gt;Build applications that include a server-side component (for offline processing and/or access from other websites) &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;  &lt;p class=&quot;MsoNormal&quot; style=&quot;margin: 0.05in 0in 0.0001pt 0.45in; text-indent: -0.25in; line-height: 125%;&quot;&gt;&lt;!--[if !supportLists]--&gt;&lt;span style=&quot;line-height: 125%;font-family:Symbol;font-size:10;color:silver;&quot;   &gt;&lt;span style=&quot;&quot;&gt;·&lt;span style=&quot;&quot;&gt;            &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;!--[endif]--&gt;&lt;b style=&quot;&quot;&gt;&lt;span style=&quot;color:silver;&quot;&gt;Create brand-new applications &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;  &lt;p class=&quot;MsoNormal&quot; style=&quot;margin: 0.05in 0in 0.0001pt 0.45in; text-indent: -0.25in; line-height: 125%;&quot;&gt;&lt;!--[if !supportLists]--&gt;&lt;span style=&quot;line-height: 125%;font-family:Symbol;font-size:10;color:silver;&quot;   &gt;&lt;span style=&quot;&quot;&gt;·&lt;span style=&quot;&quot;&gt;            &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;!--[endif]--&gt;&lt;b style=&quot;&quot;&gt;&lt;span style=&quot;color:silver;&quot;&gt;Expose existing web applications in the context of existing social websites &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;  &lt;p class=&quot;MsoNormal&quot; style=&quot;margin: 0.05in 0in 0.0001pt 0.45in; text-indent: -0.25in; line-height: 125%;&quot;&gt;&lt;!--[if !supportLists]--&gt;&lt;span style=&quot;line-height: 125%;font-family:Symbol;font-size:10;color:silver;&quot;   &gt;&lt;span style=&quot;&quot;&gt;·&lt;span style=&quot;&quot;&gt;            &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;!--[endif]--&gt;&lt;b style=&quot;&quot;&gt;&lt;span style=&quot;color:silver;&quot;&gt;Add social features to existing gadgets &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;  &lt;p class=&quot;MsoNormal&quot; style=&quot;margin: 0.05in 0in 0.0001pt 0.45in; text-indent: -0.25in; line-height: 125%;&quot;&gt;&lt;!--[if !supportLists]--&gt;&lt;span style=&quot;line-height: 125%;font-family:Symbol;font-size:10;color:silver;&quot;   &gt;&lt;span style=&quot;&quot;&gt;·&lt;span style=&quot;&quot;&gt;            &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;!--[endif]--&gt;&lt;b style=&quot;&quot;&gt;&lt;span style=&quot;color:silver;&quot;&gt;Write one application that can run in the context of many different social websites &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;  &lt;p class=&quot;MsoNormal&quot; style=&quot;line-height: 125%;&quot;&gt;&lt;b style=&quot;&quot;&gt;&lt;span style=&quot;color:silver;&quot;&gt;The JavaScript API is designed to use standard web technologies:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;  &lt;p class=&quot;MsoNormal&quot; style=&quot;margin: 0.05in 0in 0.0001pt 0.45in; text-indent: -0.25in; line-height: 125%;&quot;&gt;&lt;!--[if !supportLists]--&gt;&lt;span style=&quot;line-height: 125%;font-family:Symbol;font-size:10;color:silver;&quot;   &gt;&lt;span style=&quot;&quot;&gt;·&lt;span style=&quot;&quot;&gt;            &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;!--[endif]--&gt;&lt;b style=&quot;&quot;&gt;&lt;span style=&quot;color:silver;&quot;&gt;It&#39;s packaged as a set of methods in the opensocial.* namespace. &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;  &lt;p class=&quot;MsoNormal&quot; style=&quot;margin: 0.05in 0in 0.0001pt 0.45in; text-indent: -0.25in; line-height: 125%;&quot;&gt;&lt;!--[if !supportLists]--&gt;&lt;span style=&quot;line-height: 125%;font-family:Symbol;font-size:10;color:silver;&quot;   &gt;&lt;span style=&quot;&quot;&gt;·&lt;span style=&quot;&quot;&gt;            &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;!--[endif]--&gt;&lt;b style=&quot;&quot;&gt;&lt;span style=&quot;color:silver;&quot;&gt;It allows you to use any standard JavaScript programming techniques and third-party libraries. &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;  &lt;p class=&quot;MsoNormal&quot; style=&quot;margin: 0.05in 0in 0.0001pt 0.45in; text-indent: -0.25in; line-height: 125%;&quot;&gt;&lt;!--[if !supportLists]--&gt;&lt;span style=&quot;line-height: 125%;font-family:Symbol;font-size:10;color:silver;&quot;   &gt;&lt;span style=&quot;&quot;&gt;·&lt;span style=&quot;&quot;&gt;            &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;!--[endif]--&gt;&lt;b style=&quot;&quot;&gt;&lt;span style=&quot;color:silver;&quot;&gt;It includes a full asynchronous callback system to support rich &lt;st1:city st=&quot;on&quot;&gt;&lt;st1:place st=&quot;on&quot;&gt;AJAX&lt;/st1:place&gt;&lt;/st1:city&gt; interactivity. &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;  &lt;p class=&quot;MsoNormal&quot; style=&quot;line-height: 125%;&quot;&gt;&lt;b style=&quot;&quot;&gt;&lt;span style=&quot;color:silver;&quot;&gt;To build an application using the OpenSocial JavaScript API, check out the &lt;a href=&quot;http://code.google.com/apis/opensocial/gettingstarted.html&quot;&gt;&lt;span style=&quot;color:silver;&quot;&gt;Getting Started Guide&lt;/span&gt;&lt;/a&gt; or work through the &lt;a href=&quot;http://code.google.com/apis/opensocial/articles/tutorial/&quot;&gt;&lt;span style=&quot;color:silver;&quot;&gt;OpenSocial Tutorial&lt;/span&gt;&lt;/a&gt;.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;  &lt;p class=&quot;MsoNormal&quot; style=&quot;margin-top: 0.25in;&quot;&gt;&lt;b&gt;&lt;span style=&quot;;font-size:15;color:silver;&quot;  &gt;RESTful Data API&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;  &lt;p class=&quot;MsoNormal&quot; style=&quot;margin-top: 0.25in;&quot;&gt;&lt;b&gt;&lt;span style=&quot;;font-size:15;color:silver;&quot;  &gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;  &lt;p class=&quot;MsoNormal&quot; style=&quot;line-height: 125%;&quot;&gt;&lt;b style=&quot;&quot;&gt;&lt;span style=&quot;color:silver;&quot;&gt;The &lt;a href=&quot;http://code.google.com/apis/opensocial/docs/0.8/restfulspec.html&quot;&gt;&lt;span style=&quot;color:silver;&quot;&gt;RESTful Data API&lt;/span&gt;&lt;/a&gt; will provide complementary functionality to the JavaScript API, so you can access people, activities, and data from your server.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;  &lt;p class=&quot;MsoNormal&quot; style=&quot;line-height: 125%;&quot;&gt;&lt;b style=&quot;&quot;&gt;&lt;span style=&quot;color:silver;&quot;&gt;The RESTful data API is also designed to use standard web technologies:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;  &lt;p class=&quot;MsoNormal&quot; style=&quot;margin: 0.05in 0in 0.0001pt 0.45in; text-indent: -0.25in; line-height: 125%;&quot;&gt;&lt;!--[if !supportLists]--&gt;&lt;span style=&quot;line-height: 125%;font-family:Symbol;font-size:10;color:silver;&quot;   &gt;&lt;span style=&quot;&quot;&gt;·&lt;span style=&quot;&quot;&gt;            &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;!--[endif]--&gt;&lt;b style=&quot;&quot;&gt;&lt;span style=&quot;color:silver;&quot;&gt;Server interactions are based on the RESTful &lt;a href=&quot;http://www.ietf.org/rfc/rfc4287.txt&quot;&gt;&lt;span style=&quot;color:silver;&quot;&gt;AtomPub&lt;/span&gt;&lt;/a&gt; protocol. &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;  &lt;p class=&quot;MsoNormal&quot; style=&quot;margin: 0.05in 0in 0.0001pt 0.45in; text-indent: -0.25in; line-height: 125%;&quot;&gt;&lt;!--[if !supportLists]--&gt;&lt;span style=&quot;line-height: 125%;font-family:Symbol;font-size:10;color:silver;&quot;   &gt;&lt;span style=&quot;&quot;&gt;·&lt;span style=&quot;&quot;&gt;            &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;!--[endif]--&gt;&lt;b style=&quot;&quot;&gt;&lt;span style=&quot;color:silver;&quot;&gt;Authentication is handled by &lt;a href=&quot;http://oauth.net/core/1.0/&quot;&gt;&lt;span style=&quot;color:silver;&quot;&gt;OAuth&lt;/span&gt;&lt;/a&gt;. &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;  &lt;p&gt;&lt;span style=&quot;;font-family:Helvetica;color:silver;&quot;  &gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=&quot;MsoNormal&quot;&gt;&lt;b style=&quot;&quot;&gt;&lt;span style=&quot;color:silver;&quot;&gt;This Tutorial is mainly for Orkut developers&lt;/span&gt;&lt;/b&gt;&lt;b style=&quot;&quot;&gt;&lt;span style=&quot;;font-family:Wingdings;color:silver;&quot;  &gt;&lt;span style=&quot;&quot;&gt;L&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color:silver;&quot;&gt; Sample Codes;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;  &lt;p class=&quot;MsoNormal&quot;&gt;&lt;b style=&quot;&quot;&gt;&lt;span style=&quot;color:silver;&quot;&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;  &lt;p class=&quot;MsoNormal&quot;&gt;&lt;b style=&quot;&quot;&gt;&lt;span style=&quot;color:silver;&quot;&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;  &lt;p class=&quot;MsoNormal&quot;&gt;&lt;b style=&quot;&quot;&gt;&lt;span style=&quot;color:silver;&quot;&gt;Getting friends from Orkut:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;  &lt;p class=&quot;MsoNormal&quot;&gt;&lt;b style=&quot;&quot;&gt;&lt;span style=&quot;color:silver;&quot;&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;  &lt;p class=&quot;MsoNormal&quot;&gt;&lt;b style=&quot;&quot;&gt;&lt;span style=&quot;color:silver;&quot;&gt;In this we had two roles &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;  &lt;p class=&quot;MsoNormal&quot;&gt;&lt;b style=&quot;&quot;&gt;&lt;span style=&quot;color:silver;&quot;&gt;1.owner &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;  &lt;p class=&quot;MsoNormal&quot;&gt;&lt;b style=&quot;&quot;&gt;&lt;span style=&quot;color:silver;&quot;&gt;2.viewer&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;  &lt;p class=&quot;MsoNormal&quot;&gt;&lt;b style=&quot;&quot;&gt;&lt;span style=&quot;color:silver;&quot;&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;  &lt;p class=&quot;MsoNormal&quot;&gt;&lt;b style=&quot;&quot;&gt;&lt;span style=&quot;color:silver;&quot;&gt;&lt;span style=&quot;&quot;&gt;  &lt;/span&gt;Suppose take an example if u logged in to your orkut profile then u r the owner and viewer for your profile. and if you go to your friends profile then your are viewer for your friend profile. Your friend is owner for that profile.&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;  &lt;p class=&quot;MsoNormal&quot;&gt;&lt;b style=&quot;&quot;&gt;&lt;span style=&quot;color:silver;&quot;&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;b style=&quot;&quot;&gt;&lt;span style=&quot;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;</description><link>http://web-performance-research.blogspot.com/2008/06/getting-frineds-from-orkut.html</link><author>noreply@blogger.com (Sekhar Veernapu)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-2455101440367165155.post-5081728698904989569</guid><pubDate>Tue, 10 Jun 2008 09:07:00 +0000</pubDate><atom:updated>2008-06-10T02:14:22.026-07:00</atom:updated><title>Thankyou</title><description>&lt;span style=&quot;color: rgb(153, 153, 255);&quot;&gt;   &lt;/span&gt;&lt;span style=&quot;font-weight: bold; color: rgb(153, 153, 255);font-family:verdana;&quot; &gt;Thank you for visiting this Blog&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-family:verdana;&quot;&gt;        Keep visiting this for updates .In future we add Open social developer kit.&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family:verdana;&quot;&gt;                                                                                            -- RajaSekhar Veernapu.&lt;/span&gt;</description><link>http://web-performance-research.blogspot.com/2008/06/thankyou.html</link><author>noreply@blogger.com (Sekhar Veernapu)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-2455101440367165155.post-9054432781505603884</guid><pubDate>Tue, 27 May 2008 05:20:00 +0000</pubDate><atom:updated>2008-05-27T00:00:52.232-07:00</atom:updated><title></title><description>&lt;h3 style=&quot;font-weight: bold; color: rgb(255, 255, 255);font-family:verdana;&quot;&gt;&lt;span style=&quot;font-weight: normal;&quot;&gt;Best Practices for Speeding Up Your Web Site&lt;/span&gt;&lt;br /&gt;&lt;/h3&gt;&lt;p style=&quot;font-family: verdana; color: rgb(255, 255, 255);&quot;&gt;The Exceptional Performance team has identified a number of best practices for making web pages fast.The list includes 34 best practices divided into 7 categories.&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;&lt;a style=&quot;font-family: verdana; color: rgb(255, 255, 255);&quot; name=&quot;num_http&quot;&gt;Minimize HTTP Requests:&lt;/a&gt;&lt;span style=&quot;color: rgb(255, 255, 255);font-family:verdana;&quot; &gt;&lt;br /&gt;&lt;/span&gt;&lt;p style=&quot;font-family: verdana; color: rgb(255, 255, 255);&quot; class=&quot;date&quot;&gt;tag: content&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;font-family: verdana; color: rgb(255, 255, 255);&quot;&gt;80% of the end-user response time is spent on the front-end. Most of this time is tied up in downloading all the components in the page: images, stylesheets, scripts, Flash, etc. Reducing the number of components in turn reduces the number of HTTP requests required to render the page. This is the key to faster pages.&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;font-family: verdana; color: rgb(255, 255, 255);&quot;&gt;One way to reduce the number of components in the page is to simplify the page&#39;s design. But is there a way to build pages with richer content while also achieving fast response times? Here are some techniques for reducing the number of HTTP requests, while still supporting rich page designs.&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;font-family: verdana; color: rgb(255, 255, 255);&quot;&gt;&lt;strong&gt;Combined files&lt;/strong&gt; are a way to reduce the number of HTTP requests by combining all scripts into a single script, and similarly combining all CSS into a single stylesheet. Combining files is more challenging when the scripts and stylesheets vary from page to page, but making this part of your release process improves response times.&lt;/p&gt;&lt;a style=&quot;font-family: verdana; color: rgb(255, 255, 255);&quot; href=&quot;http://alistapart.com/articles/sprites&quot; target=&quot;_blank&quot;&gt;&lt;strong&gt;CSS Sprites&lt;/strong&gt;&lt;/a&gt;&lt;span style=&quot;color: rgb(255, 255, 255);font-family:verdana;&quot; &gt; are the preferred method for reducing the number of image requests. Combine your background images into a single image and use the CSS &lt;/span&gt;&lt;code style=&quot;font-family: verdana; color: rgb(255, 255, 255);&quot;&gt;background-image&lt;/code&gt;&lt;span style=&quot;color: rgb(255, 255, 255);font-family:verdana;&quot; &gt; and &lt;/span&gt;&lt;code style=&quot;font-family: verdana; color: rgb(255, 255, 255);&quot;&gt;background-position&lt;/code&gt;&lt;span style=&quot;color: rgb(255, 255, 255);font-family:verdana;&quot; &gt; properties to display the desired image segment.&lt;/span&gt;&lt;br /&gt;&lt;p style=&quot;font-family: verdana; color: rgb(255, 255, 255);&quot;&gt;&lt;a href=&quot;http://www.w3.org/TR/html401/struct/objects.html#h-13.6&quot; target=&quot;_blank&quot;&gt;&lt;strong&gt;Image maps&lt;/strong&gt;&lt;/a&gt; combine multiple images into a single image. The overall size is about the same, but reducing the number of HTTP requests speeds up the page. Image maps only work if the images are contiguous in the page, such as a navigation bar. Defining the coordinates of image maps can be tedious and error prone. Using image maps for navigation is not accessible too, so it&#39;s not recommended.&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;font-family: verdana; color: rgb(255, 255, 255);&quot;&gt;&lt;strong&gt;Inline images&lt;/strong&gt; use the &lt;a href=&quot;http://tools.ietf.org/html/rfc2397&quot;&gt;&lt;code&gt;data:&lt;/code&gt; URL scheme&lt;/a&gt; to embed the image data in the actual page. This can increase the size of your HTML document. Combining inline images into your (cached) stylesheets is a way to reduce HTTP requests and avoid increasing the size of your pages. Inline images are not yet supported across all major browsers.&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;font-family: verdana; color: rgb(255, 255, 255);&quot;&gt;Reducing the number of HTTP requests in your page is the place to start. This is the most important guideline for improving performance for first time visitors. As described in Tenni Theurer&#39;s blog post &lt;a href=&quot;http://web-performance-research.blogspot.com/2008/05/performance-research-part-2-browser.html&quot; target=&quot;_blank&quot;&gt;Browser Cache Usage - Exposed!&lt;/a&gt;, 40-60% of daily visitors to your site come in with an empty cache. Making your page fast for these first time visitors is key to a better user experience.&lt;/p&gt;&lt;br /&gt;&lt;a style=&quot;font-family: verdana; color: rgb(255, 255, 255);&quot; name=&quot;cdn&quot;&gt;Use a Content Delivery Network:&lt;/a&gt;&lt;br /&gt;&lt;p style=&quot;font-family: verdana; color: rgb(255, 255, 255);&quot;&gt;tag: server&lt;/p&gt;&lt;p style=&quot;font-family: verdana; color: rgb(255, 255, 255);&quot;&gt;The user&#39;s proximity to your web server has an impact on response times. Deploying your content across multiple, geographically dispersed servers will make your pages load faster from the user&#39;s perspective. But where should you start?&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;font-family: verdana; color: rgb(255, 255, 255);&quot;&gt;As a first step to implementing geographically dispersed content, don&#39;t attempt to redesign your web application to work in a distributed architecture. Depending on the application, changing the architecture could include daunting tasks such as synchronizing session state and replicating database transactions across server locations. Attempts to reduce the distance between users and your content could be delayed by, or never pass, this application architecture step.&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;font-family: verdana; color: rgb(255, 255, 255);&quot;&gt;Remember that 80-90% of the end-user response time is spent downloading all the components in the page: images, stylesheets, scripts, Flash, etc. This is the &lt;em&gt;Performance Golden Rule&lt;/em&gt;. Rather than starting with the difficult task of redesigning your application architecture, it&#39;s better to first disperse your static content. This not only achieves a bigger reduction in response times, but it&#39;s easier thanks to content delivery networks.&lt;br /&gt;&lt;/p&gt;&lt;p  style=&quot;color: rgb(255, 255, 255); font-weight: bold;font-family:verdana;&quot;&gt;&lt;span style=&quot;font-weight: normal;&quot;&gt;A content delivery network (CDN) is a collection of web servers distributed across multiple locations to deliver content more efficiently to users. The server selected for delivering content to a specific user is typically based on a measure of network proximity. For example, the server with the fewest network hops or the server with the quickest response time is chosen.&lt;/span&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;font-family: verdana; color: rgb(255, 255, 255);&quot;&gt;Some large Internet companies own their own CDN, but it&#39;s cost-effective to use a CDN service provider, such as &lt;a href=&quot;http://www.akamai.com/&quot; target=&quot;_blank&quot;&gt;Akamai Technologies&lt;/a&gt;, &lt;a href=&quot;http://www.mirror-image.com/&quot; target=&quot;_blank&quot;&gt;Mirror Image Internet&lt;/a&gt;, or &lt;a href=&quot;http://www.limelightnetworks.com/&quot; target=&quot;_blank&quot;&gt;Limelight Networks&lt;/a&gt;. For start-up companies and private web sites, the cost of a CDN service can be prohibitive, but as your target audience grows larger and becomes more global, a CDN is necessary to achieve fast response times. At Yahoo!, properties that moved static content off their application web servers to a CDN improved end-user response times by 20% or more. Switching to a CDN is a relatively easy code change that will dramatically improve the speed of your web site.&lt;br /&gt;&lt;/p&gt;&lt;a style=&quot;font-family: verdana; color: rgb(255, 255, 255);&quot; name=&quot;expires&quot;&gt;Add an Expires or a Cache-Control Header&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;p style=&quot;font-family: verdana; color: rgb(255, 255, 255);&quot;&gt;tag: server&lt;br /&gt;There are two things in this rule:&lt;br /&gt;&lt;/p&gt;&lt;ul style=&quot;font-family: verdana; color: rgb(255, 255, 255);&quot;&gt;&lt;li&gt;For static components: implement &quot;Never expire&quot; policy by setting far future &lt;code&gt;Expires&lt;/code&gt; header&lt;/li&gt;&lt;br /&gt;&lt;li&gt;For dynamic components: use an appropriate &lt;code&gt;Cache-Control&lt;/code&gt; header to help the browser with conditional requests&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p style=&quot;font-family: verdana; color: rgb(255, 255, 255);&quot;&gt;Web page designs are getting richer and richer, which means more scripts, stylesheets, images, and Flash in the page. A first-time visitor to your page may have to make several HTTP requests, but by using the Expires header you make those components cacheable. This avoids unnecessary HTTP requests on subsequent page views. Expires headers are most often used with images, but they should be used on &lt;em&gt;all&lt;/em&gt; components including scripts, stylesheets, and Flash components.&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;font-family: verdana; color: rgb(255, 255, 255);&quot;&gt;Browsers (and proxies) use a cache to reduce the number and size of HTTP requests, making web pages load faster. A web server uses the Expires header in the HTTP response to tell the client how long a component can be cached. This is a far future Expires header, telling the browser that this response won&#39;t be stale until April 15, 2010.&lt;br /&gt;&lt;/p&gt;&lt;pre  style=&quot;color: rgb(255, 255, 255); font-weight: bold;font-family:verdana;&quot;&gt;&lt;span style=&quot;font-weight: normal;&quot;&gt;      Expires: Thu, 15 Apr 2010 20:00:00 GMT&lt;/span&gt;&lt;br /&gt;&lt;/pre&gt;&lt;p style=&quot;font-family: verdana; color: rgb(255, 255, 255);&quot;&gt;If your server is Apache, use the ExiresDefault directive to set an expiration date relative to the current date. This example of the ExpiresDefault directive sets the Expires date 10 years out from the time of the request.&lt;br /&gt;&lt;/p&gt;&lt;pre style=&quot;font-family: verdana; color: rgb(255, 255, 255);&quot;&gt;      ExpiresDefault &quot;access plus 10 years&quot;&lt;br /&gt;&lt;/pre&gt;&lt;p style=&quot;font-family: verdana; color: rgb(255, 255, 255);&quot;&gt;Keep in mind, if you use a far future Expires header you have to change the component&#39;s filename whenever the component changes. At Yahoo! we often make this step part of the build process: a version number is embedded in the component&#39;s filename, for example, yahoo_2.0.6.js.&lt;/p&gt;&lt;span style=&quot;color: rgb(255, 255, 255);font-family:verdana;&quot; &gt;Using a far future Expires header affects page views only after a user has already visited your site. It has no effect on the number of HTTP requests when a user visits your site for the first time and the browser&#39;s cache is empty. Therefore the impact of this performance improvement depends on how often users hit your pages with a primed cache. (A &quot;primed cache&quot; already contains all of the components in the page.) We &lt;/span&gt;&lt;a style=&quot;font-family: verdana; color: rgb(255, 255, 255);&quot; href=&quot;http://web-performance-research.blogspot.com/2008/05/performance-research-part-2-browser.html&quot; target=&quot;_blank&quot;&gt;measured this at Yahoo!&lt;/a&gt;&lt;span style=&quot;color: rgb(255, 255, 255);font-family:verdana;&quot; &gt; and found the number of page views with a primed cache is 75-85%. By using a far future Expires header, you increase the number of components that are cached by the browser and re-used on subsequent page views without sending a single byte over the user&#39;s Internet connection.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;a style=&quot;font-family: verdana; color: rgb(255, 255, 255);&quot; name=&quot;gzip&quot;&gt;Gzip Components&lt;br /&gt;&lt;br /&gt;&lt;/a&gt;&lt;span style=&quot;color: rgb(255, 255, 255);font-family:verdana;&quot; &gt;tag: server&lt;/span&gt;&lt;br /&gt;&lt;p style=&quot;font-family: verdana; color: rgb(255, 255, 255);&quot;&gt;The time it takes to transfer an HTTP request and response across the network can be significantly reduced by decisions made by front-end engineers. It&#39;s true that the end-user&#39;s bandwidth speed, Internet service provider, proximity to peering exchange points, etc. are beyond the control of the development team. But there are other variables that affect response times. Compression reduces response times by reducing the size of the HTTP response.&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;font-family: verdana; color: rgb(255, 255, 255);&quot;&gt;Starting with HTTP/1.1, web clients indicate support for compression with the Accept-Encoding header in the HTTP request.&lt;br /&gt;&lt;/p&gt;&lt;pre style=&quot;font-family: verdana; color: rgb(255, 255, 255);&quot;&gt;      Accept-Encoding: gzip, deflate&lt;br /&gt;&lt;/pre&gt;&lt;p style=&quot;font-family: verdana; color: rgb(255, 255, 255);&quot;&gt;If the web server sees this header in the request, it may compress the response using one of the methods listed by the client. The web server notifies the web client of this via the Content-Encoding header in the response.&lt;br /&gt;&lt;/p&gt;&lt;pre style=&quot;font-family: verdana; color: rgb(255, 255, 255);&quot;&gt;      Content-Encoding: gzip&lt;br /&gt;&lt;/pre&gt;&lt;p style=&quot;font-family: verdana; color: rgb(255, 255, 255);&quot;&gt;Gzip is the most popular and effective compression method at this time. It was developed by the GNU project and standardized by &lt;a href=&quot;http://www.ietf.org/rfc/rfc1952.txt&quot; target=&quot;_blank&quot;&gt;RFC 1952&lt;/a&gt;. The only other compression format you&#39;re likely to see is deflate, but it&#39;s less effective and less popular.&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;font-family: verdana; color: rgb(255, 255, 255);&quot;&gt;Gzipping generally reduces the response size by about 70%. Approximately 90% of today&#39;s Internet traffic travels through browsers that claim to support gzip. If you use Apache, the module configuring gzip depends on your version: Apache 1.3 uses &lt;a href=&quot;http://sourceforge.net/projects/mod-gzip/&quot; target=&quot;_blank&quot;&gt;mod_gzip&lt;/a&gt; while Apache 2.x uses &lt;a href=&quot;http://httpd.apache.org/docs/2.0/mod/mod_deflate.html&quot; target=&quot;_blank&quot;&gt;mod_deflate&lt;/a&gt;.&lt;br /&gt;&lt;/p&gt;&lt;p  style=&quot;color: rgb(255, 255, 255); font-weight: bold;font-family:verdana;&quot;&gt;&lt;span style=&quot;font-weight: normal;&quot;&gt;There are known issues with browsers and proxies that may cause a mismatch in what the browser expects and what it receives with regard to compressed content. Fortunately, these edge cases are dwindling as the use of older browsers drops off. The Apache modules help out by adding appropriate Vary response headers automatically.&lt;/span&gt;&lt;br /&gt;&lt;/p&gt;&lt;p  style=&quot;font-weight: bold; color: rgb(255, 255, 255);font-family:verdana;&quot;&gt;&lt;span style=&quot;font-weight: normal;&quot;&gt;Servers choose what to gzip based on file type, but are typically too limited in what they decide to compress. Most web sites gzip their HTML documents. It&#39;s also worthwhile to gzip your scripts and stylesheets, but many web sites miss this opportunity. In fact, it&#39;s worthwhile to compress any text response including XML and JSON. Image and PDF files should not be gzipped because they are already compressed. Trying to gzip them not only wastes CPU but can potentially increase file sizes.&lt;/span&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;font-family: verdana; color: rgb(255, 255, 255);&quot;&gt;Gzipping as many file types as possible is an easy way to reduce page weight and accelerate the user experience.&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;&lt;a style=&quot;font-family: verdana; color: rgb(255, 255, 255);&quot; name=&quot;css_top&quot;&gt;Put Stylesheets at the Top&lt;/a&gt;&lt;br /&gt;&lt;p style=&quot;font-family: verdana; color: rgb(255, 255, 255);&quot; class=&quot;date&quot;&gt;tag: css&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;font-family: verdana; color: rgb(255, 255, 255);&quot;&gt;While researching performance at Yahoo!, we discovered that moving stylesheets to the document HEAD makes pages &lt;em&gt;apprear&lt;/em&gt; to be loading faster. This is because putting stylesheets in the HEAD allows the page to render progressively.&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;font-family: verdana; color: rgb(255, 255, 255);&quot;&gt;Front-end engineers that care about performance want a page to load progressively; that is, we want the browser to display whatever content it has as soon as possible. This is especially important for pages with a lot of content and for users on slower Internet connections. The importance of giving users visual feedback, such as progress indicators, has been well researched and &lt;a href=&quot;http://www.useit.com/papers/responsetime.html&quot; target=&quot;_blank&quot;&gt;documented&lt;/a&gt;. In our case the HTML page is the progress indicator! When the browser loads the page progressively the header, the navigation bar, the logo at the top, etc. all serve as visual feedback for the user who is waiting for the page. This improves the overall user experience.&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;font-family: verdana; color: rgb(255, 255, 255);&quot;&gt;The problem with putting stylesheets near the bottom of the document is that it prohibits progressive rendering in many browsers, including Internet Explorer. These browsers block rendering to avoid having to redraw elements of the page if their styles change. The user is stuck viewing a blank white page.&lt;br /&gt;The &lt;a href=&quot;http://www.w3.org/TR/html4/struct/links.html#h-12.3&quot; target=&quot;_blank&quot;&gt;HTML specification&lt;/a&gt; clearly states that stylesheets are to be included in the HEAD of the page: &quot;Unlike A, [LINK] may only appear in the HEAD section of a document, although it may appear any number of times.&quot; Neither of the alternatives, the blank white screen or flash of unstyled content, are worth the risk. The optimal solution is to follow the HTML specification and load your stylesheets in the document HEAD.&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;&lt;a style=&quot;font-family: verdana; color: rgb(255, 255, 255);&quot; name=&quot;js_bottom&quot;&gt;Put Scripts at the Bottom&lt;/a&gt;&lt;br /&gt;&lt;p style=&quot;font-family: verdana; color: rgb(255, 255, 255);&quot; class=&quot;date&quot;&gt;tag: javascript&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;font-family: verdana; color: rgb(255, 255, 255);&quot;&gt;The problem caused by scripts is that they block parallel downloads. The &lt;a href=&quot;http://www.w3.org/Protocols/rfc2616/rfc2616-sec8.html#sec8.1.4&quot; target=&quot;_blank&quot;&gt;HTTP/1.1 specification&lt;/a&gt; suggests that browsers download no more than two components in parallel per hostname. If you serve your images from multiple hostnames, you can get more than two downloads to occur in parallel. While a script is downloading, however, the browser won&#39;t start any other downloads, even on different hostnames.&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;font-family: verdana; color: rgb(255, 255, 255);&quot;&gt;In some situations it&#39;s not easy to move scripts to the bottom. If, for example, the script uses &lt;code&gt;document.write&lt;/code&gt; to insert part of the page&#39;s content, it can&#39;t be moved lower in the page. There might also be scoping issues. In many cases, there are ways to workaround these situations.&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;font-family: verdana; color: rgb(255, 255, 255);&quot;&gt;An alternative suggestion that often comes up is to use deferred scripts. The &lt;code&gt;DEFER&lt;/code&gt; attribute indicates that the script does not contain document.write, and is a clue to browsers that they can continue rendering. Unfortunately, Firefox doesn&#39;t support the &lt;code&gt;DEFER&lt;/code&gt; attribute. In Internet Explorer, the script may be deferred, but not as much as desired. If a script can be deferred, it can also be moved to the bottom of the page. That will make your web pages load faster.&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;&lt;a style=&quot;font-family: verdana; color: rgb(255, 255, 255);&quot; name=&quot;css_expressions&quot;&gt;Avoid CSS Expressions&lt;/a&gt;&lt;br /&gt;&lt;p style=&quot;font-family: verdana; color: rgb(255, 255, 255);&quot;&gt;tag: css&lt;/p&gt;&lt;p style=&quot;font-family: verdana; color: rgb(255, 255, 255);&quot;&gt;CSS expressions are a powerful (and dangerous) way to set CSS properties dynamically. They&#39;re supported in Internet Explorer, starting with &lt;a href=&quot;http://msdn.microsoft.com/workshop/author/dhtml/overview/recalc.asp&quot; target=&quot;_blank&quot;&gt;version 5&lt;/a&gt;. As an example, the background color could be set to alternate every hour using CSS expressions.&lt;br /&gt;&lt;/p&gt;&lt;pre style=&quot;font-family: verdana; color: rgb(255, 255, 255);&quot;&gt;      background-color: expression( (new Date()).getHours()%2 ? &quot;#B8D4FF&quot; : &quot;#F08A00&quot; );&lt;/pre&gt;&lt;span style=&quot;color: rgb(255, 255, 255);font-family:verdana;&quot; &gt;As shown here, the &lt;/span&gt;&lt;code style=&quot;font-family: verdana; color: rgb(255, 255, 255);&quot;&gt;expression&lt;/code&gt;&lt;span style=&quot;color: rgb(255, 255, 255);font-family:verdana;&quot; &gt; method accepts a JavaScript expression. The CSS property is set to the result of evaluating the JavaScript expression. The &lt;/span&gt;&lt;code style=&quot;font-family: verdana; color: rgb(255, 255, 255);&quot;&gt;expression&lt;/code&gt;&lt;span style=&quot;color: rgb(255, 255, 255);font-family:verdana;&quot; &gt; method is ignored by other browsers, so it is useful for setting properties in Internet Explorer needed to create a consistent experience across browsers.&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: rgb(255, 255, 255);font-family:verdana;&quot; &gt;The problem with expressions is that they are evaluated more frequently than most people expect. Not only are they evaluated when the page is rendered and resized, but also when the page is scrolled and even when the user moves the mouse over the page. Adding a counter to the CSS expression allows us to keep track of when and how often a CSS expression is evaluated. Moving the mouse around the page can easily generate more than 10,000 evaluations.&lt;/span&gt;&lt;br /&gt;&lt;p style=&quot;font-family: verdana; color: rgb(255, 255, 255);&quot;&gt;One way to reduce the number of times your CSS expression is evaluated is to use one-time expressions, where the first time the expression is evaluated it sets the style property to an explicit value, which replaces the CSS expression. If the style property must be set dynamically throughout the life of the page, using event handlers instead of CSS expressions is an alternative approach. If you must use CSS expressions, remember that they may be evaluated thousands of times and could affect the performance of your page.&lt;/p&gt;&lt;br /&gt;&lt;a style=&quot;font-family: verdana; color: rgb(255, 255, 255);&quot; name=&quot;external&quot;&gt;Make JavaScript and CSS External&lt;/a&gt;&lt;br /&gt;&lt;p style=&quot;font-family: verdana; color: rgb(255, 255, 255);&quot; class=&quot;date&quot;&gt;tag: javascript, css&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;font-family: verdana; color: rgb(255, 255, 255);&quot;&gt;Many of these performance rules deal with how external components are managed. However, before these considerations arise you should ask a more basic question: Should JavaScript and CSS be contained in external files, or inlined in the page itself?&lt;/p&gt;&lt;p style=&quot;font-family: verdana; color: rgb(255, 255, 255);&quot;&gt;Using external files in the real world generally produces faster pages because the JavaScript and CSS files are cached by the browser. JavaScript and CSS that are inlined in HTML documents get downloaded every time the HTML document is requested. This reduces the number of HTTP requests that are needed, but increases the size of the HTML document. On the other hand, if the JavaScript and CSS are in external files cached by the browser, the size of the HTML document is reduced without increasing the number of HTTP requests.&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;font-family: verdana; color: rgb(255, 255, 255);&quot;&gt;The key factor, then, is the frequency with which external JavaScript and CSS components are cached relative to the number of HTML documents requested. This factor, although difficult to quantify, can be gauged using various metrics. If users on your site have multiple page views per session and many of your pages re-use the same scripts and stylesheets, there is a greater potential benefit from cached external files.&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;font-family: verdana; color: rgb(255, 255, 255);&quot;&gt;Many web sites fall in the middle of these metrics. For these sites, the best solution generally is to deploy the JavaScript and CSS as external files. The only exception where inlining is preferable is with home pages, such as &lt;a href=&quot;http://www.yahoo.com/&quot; target=&quot;_blank&quot;&gt;Yahoo!&#39;s front page&lt;/a&gt; and &lt;a href=&quot;http://my.yahoo.com/&quot; target=&quot;_blank&quot;&gt;My Yahoo!&lt;/a&gt;.&lt;br /&gt;Home pages that have few (perhaps only one) page view per session may find that inlining JavaScript and CSS results in faster end-user response times.&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;font-family: verdana; color: rgb(255, 255, 255);&quot;&gt;For front pages that are typically the first of many page views, there are techniques that leverage the reduction of HTTP requests that inlining provides, as well as the caching benefits achieved through using external files. One such technique is to inline JavaScript and CSS in the front page, but dynamically download the external files after the page has finished loading. Subsequent pages would reference the external files that should already be in the browser&#39;s cache.&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;&lt;a style=&quot;font-family: verdana; color: rgb(255, 255, 255);&quot; name=&quot;dns_lookups&quot;&gt;Reduce DNS Lookups&lt;/a&gt;&lt;br /&gt;&lt;p style=&quot;font-family: verdana; color: rgb(255, 255, 255);&quot;&gt;tag: content&lt;/p&gt;&lt;p style=&quot;font-family: verdana; color: rgb(255, 255, 255);&quot;&gt;The Domain Name System (DNS) maps hostnames to IP addresses, just as phonebooks map people&#39;s names to their phone numbers. When you type www.yahoo.com into your browser, a DNS resolver contacted by the browser returns that server&#39;s IP address. DNS has a cost. It typically takes 20-120 milliseconds for DNS to lookup the IP address for a given hostname. The browser can&#39;t download anything from this hostname until the DNS lookup is completed.&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;font-family: verdana; color: rgb(255, 255, 255);&quot;&gt;DNS lookups are cached for better performance. This caching can occur on a special caching server, maintained by the user&#39;s ISP or local area network, but there is also caching that occurs on the individual user&#39;s computer. The DNS information remains in the operating system&#39;s DNS cache (the &quot;DNS Client service&quot; on Microsoft Windows). Most browsers have their own caches, separate from the operating system&#39;s cache. As long as the browser keeps a DNS record in its own cache, it doesn&#39;t bother the operating system with a request for the record.&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;font-family: verdana; color: rgb(255, 255, 255);&quot;&gt;Internet Explorer caches DNS lookups for 30 minutes by default, as specified by the  &lt;code&gt;DnsCacheTimeout&lt;/code&gt; registry setting. Firefox caches DNS lookups for 1 minute, controlled by the &lt;code&gt;network.dnsCacheExpiration&lt;/code&gt; configuration setting. (Fasterfox changes this to 1 hour.)&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;font-family: verdana; color: rgb(255, 255, 255);&quot;&gt;When the client&#39;s DNS cache is empty (for both the browser and the operating system), the number of DNS lookups is equal to the number of unique hostnames in the web page. This includes the hostnames used in the page&#39;s URL, images, script files, stylesheets, Flash objects, etc. Reducing the number of unique hostnames reduces the number of DNS lookups.&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;font-family: verdana; color: rgb(255, 255, 255);&quot;&gt;Reducing the number of unique hostnames has the potential to reduce the amount of parallel downloading that takes place in the page. Avoiding DNS lookups cuts response times, but reducing parallel downloads may increase response times. My guideline is to split these components across at least two but no more than four hostnames. This results in a good compromise between reducing DNS lookups and allowing a high degree of parallel downloads.&lt;/p&gt;&lt;p style=&quot;font-family: verdana; color: rgb(255, 255, 255);&quot;&gt; &lt;/p&gt;&lt;a style=&quot;font-family: verdana; color: rgb(255, 255, 255);&quot; name=&quot;minify&quot;&gt;Minify JavaScript and CSS&lt;/a&gt;&lt;br /&gt;&lt;p style=&quot;font-family: verdana; color: rgb(255, 255, 255);&quot; class=&quot;date&quot;&gt;tag: javascript, css&lt;br /&gt;&lt;/p&gt;&lt;p  style=&quot;color: rgb(255, 255, 255); font-weight: bold;font-family:verdana;&quot;&gt;&lt;span style=&quot;font-weight: normal;&quot;&gt;Minification is the practice of removing unnecessary characters from code to reduce its size thereby improving load times. When code is minified all comments are removed, as well as unneeded white space characters (space, newline, and tab). In the case of JavaScript, this improves response time performance because the size of the downloaded file is reduced. Two popular tools for minifying JavaScript code are &lt;/span&gt;&lt;a style=&quot;font-weight: normal;&quot; href=&quot;http://crockford.com/javascript/jsmin&quot; target=&quot;_blank&quot;&gt;JSMin&lt;/a&gt;&lt;span style=&quot;font-weight: normal;&quot;&gt; and &lt;/span&gt;&lt;a style=&quot;font-weight: normal;&quot; href=&quot;http://developer.yahoo.com/yui/compressor/&quot; target=&quot;_blank&quot;&gt;YUI Compressor&lt;/a&gt;&lt;span style=&quot;font-weight: normal;&quot;&gt;. The YUI compressor can also minify CSS.&lt;/span&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;font-family: verdana; color: rgb(255, 255, 255);&quot;&gt;Obfuscation is an alternative optimization that can be applied to source code. It&#39;s more complex than minification and thus more likely to generate bugs as a result of the obfuscation step itself. In a survey of ten top U.S. web sites, minification achieved a 21% size reduction versus 25% for obfuscation. Although obfuscation has a higher size reduction, minifying JavaScript is less risky.&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;font-family: verdana; color: rgb(255, 255, 255);&quot;&gt;In addition to minifying external scripts and styles, inlined &lt;code&gt;&amp;lt;script&amp;gt;&lt;/code&gt; and &lt;code&gt;&amp;lt;style&amp;gt;&lt;/code&gt; blocks can and should also be minified. Even if you gzip your scripts and styles, minifying them will still reduce the size by 5% or more. As the use and size of JavaScript and CSS increases, so will the savings gained by minifying your code.&lt;br /&gt;&lt;/p&gt;&lt;a style=&quot;font-family: verdana; color: rgb(255, 255, 255);&quot; name=&quot;redirects&quot;&gt;Avoid Redirects&lt;/a&gt;&lt;span style=&quot;color: rgb(255, 255, 255);font-family:verdana;&quot; &gt;tag: content&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;p style=&quot;font-family: verdana; color: rgb(255, 255, 255);&quot;&gt;Redirects are accomplished using the 301 and 302 status codes. Here&#39;s an example of the HTTP headers in a 301 response:&lt;br /&gt;&lt;/p&gt;&lt;pre style=&quot;font-family: verdana; color: rgb(255, 255, 255);&quot;&gt;      HTTP/1.1 301 Moved Permanently&lt;br /&gt;Location: http://example.com/newuri&lt;br /&gt;Content-Type: text/html&lt;br /&gt;&lt;/pre&gt;&lt;p style=&quot;font-family: verdana; color: rgb(255, 255, 255);&quot;&gt;The browser automatically takes the user to the URL specified in the &lt;code&gt;Location&lt;/code&gt; field. All the information necessary for a redirect is in the headers. The body of the response is typically empty. Despite their names, neither a 301 nor a 302 response is cached in practice unless additional headers, such as &lt;code&gt;Expires&lt;/code&gt; or &lt;code&gt;Cache-Control&lt;/code&gt;, indicate it should be. The meta refresh tag and JavaScript are other ways to direct users to a different URL, but if you must do a redirect, the preferred technique is to use the standard 3xx HTTP status codes, primarily to ensure the back button works correctly.&lt;br /&gt;The main thing to remember is that redirects slow down the user experience. Inserting a redirect between the user and the HTML document delays everything in the page since nothing in the page can be rendered and no components can start being downloaded until the HTML document has arrived.&lt;br /&gt;&lt;/p&gt;&lt;p  style=&quot;color: rgb(255, 255, 255); font-weight: bold;font-family:verdana;&quot;&gt;&lt;span style=&quot;font-weight: normal;&quot;&gt;One of the most wasteful redirects happens frequently and web developers are generally not aware of it. It occurs when a trailing slash (/) is missing from a URL that should otherwise have one. For example, going to &lt;/span&gt;&lt;a style=&quot;font-weight: normal;&quot; href=&quot;http://astrology.yahoo.com/astrology&quot; target=&quot;_blank&quot;&gt;http://astrology.yahoo.com/astrology&lt;/a&gt;&lt;span style=&quot;font-weight: normal;&quot;&gt; results in a 301 response containing a redirect to &lt;/span&gt;&lt;a style=&quot;font-weight: normal;&quot; href=&quot;http://astrology.yahoo.com/astrology/&quot; target=&quot;_blank&quot;&gt;http://astrology.yahoo.com/astrology/&lt;/a&gt;&lt;span style=&quot;font-weight: normal;&quot;&gt; (notice the added trailing slash). This is fixed in Apache by using &lt;/span&gt;&lt;code style=&quot;font-weight: normal;&quot;&gt;Alias&lt;/code&gt;&lt;span style=&quot;font-weight: normal;&quot;&gt; or &lt;/span&gt;&lt;code style=&quot;font-weight: normal;&quot;&gt;mod_rewrite&lt;/code&gt;&lt;span style=&quot;font-weight: normal;&quot;&gt;, or the &lt;/span&gt;&lt;code style=&quot;font-weight: normal;&quot;&gt;DirectorySlash&lt;/code&gt; directive if you&#39;re using Apache handlers.&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;font-family: verdana; color: rgb(255, 255, 255);&quot;&gt;Connecting an old web site to a new one is another common use for redirects. Others include connecting different parts of a website and directing the user based on certain conditions (type of browser, type of user account, etc.). Using a redirect to connect two web sites is simple and requires little additional coding. Although using redirects in these situations reduces the complexity for developers, it degrades the user experience. Alternatives for this use of redirects include using &lt;code&gt;Alias&lt;/code&gt; and &lt;code&gt;mod_rewrite&lt;/code&gt; if the two code paths are hosted on the same server. If a domain name change is the cause of using redirects, an alternative is to create a CNAME (a DNS record that creates an alias pointing from one domain name to another) in combination with &lt;code&gt;Alias&lt;/code&gt; or &lt;code&gt;mod_rewrite&lt;/code&gt;.&lt;/p&gt;&lt;br /&gt;&lt;h2 style=&quot;font-family: verdana; color: rgb(255, 255, 255); font-weight: normal;&quot; id=&quot;js_dupes&quot;&gt;Remove Duplicate Scripts&lt;br /&gt;&lt;/h2&gt;&lt;p style=&quot;font-family: verdana; color: rgb(255, 255, 255);&quot; class=&quot;date&quot;&gt;tag: javascript&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;font-family: verdana; color: rgb(255, 255, 255);&quot;&gt;It hurts performance to include the same JavaScript file twice in one page. This isn&#39;t as unusual as you might think. A review of the ten top U.S. web sites shows that two of them contain a duplicated script. Two main factors increase the odds of a script being duplicated in a single web page: team size and number of scripts. When it does happen, duplicate scripts hurt performance by creating unnecessary HTTP requests and wasted JavaScript execution.&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;font-family: verdana; color: rgb(255, 255, 255);&quot;&gt;Unnecessary HTTP requests happen in Internet Explorer, but not in Firefox. In Internet Explorer, if an external script is included twice and is not cacheable, it generates two HTTP requests during page loading. Even if the script is cacheable, extra HTTP requests occur when the user reloads the page.&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;font-family: verdana; color: rgb(255, 255, 255);&quot;&gt;In addition to generating wasteful HTTP requests, time is wasted evaluating the script multiple times. This redundant JavaScript execution happens in both Firefox and Internet Explorer, regardless of whether the script is cacheable.&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;font-family: verdana; color: rgb(255, 255, 255);&quot;&gt;One way to avoid accidentally including the same script twice is to implement a script management module in your templating system. The typical way to include a script is to use the SCRIPT tag in your HTML page.&lt;br /&gt;&lt;/p&gt;&lt;pre style=&quot;font-family: verdana; color: rgb(255, 255, 255);&quot;&gt;      &amp;lt;script type=&quot;text/javascript&quot; src=&quot;menu_1.0.17.js&quot;&amp;gt;&amp;lt;/script&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;p style=&quot;font-family: verdana; color: rgb(255, 255, 255);&quot;&gt;An alternative in PHP would be to create a function called &lt;code&gt;insertScript&lt;/code&gt;.&lt;br /&gt;&lt;/p&gt;&lt;pre style=&quot;font-family: verdana; color: rgb(255, 255, 255);&quot;&gt;      &amp;lt;?php insertScript(&quot;menu.js&quot;) ?&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;p style=&quot;font-family: verdana; color: rgb(255, 255, 255);&quot;&gt;In addition to preventing the same script from being inserted multiple times, this function could handle other issues with scripts, such as dependency checking and adding version numbers to script filenames to support far future Expires headers.&lt;br /&gt;&lt;/p&gt;&lt;h2 style=&quot;font-family: verdana; color: rgb(255, 255, 255); font-weight: normal;&quot; id=&quot;etags&quot;&gt;Configure ETags:&lt;br /&gt;&lt;/h2&gt;&lt;p style=&quot;font-family: verdana; color: rgb(255, 255, 255);&quot; class=&quot;date&quot;&gt;tag: server&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;font-family: verdana; color: rgb(255, 255, 255);&quot;&gt;Entity tags (ETags) are a mechanism that web servers and browsers use to determine whether the component in the browser&#39;s cache matches the one on the origin server. (An &quot;entity&quot; is another word a &quot;component&quot;: images, scripts, stylesheets, etc.) ETags were added to provide a mechanism for validating entities that is more flexible than the last-modified date. An ETag is a string that uniquely identifies a specific version of a component. The only format constraints are that the string be quoted. The origin server specifies the component&#39;s ETag using the &lt;code&gt;ETag&lt;/code&gt; response header.&lt;br /&gt;&lt;/p&gt;&lt;pre style=&quot;font-family: verdana; color: rgb(255, 255, 255);&quot;&gt;      HTTP/1.1 200 OK&lt;br /&gt;Last-Modified: Tue, 12 Dec 2006 03:03:59 GMT&lt;br /&gt;ETag: &quot;10c24bc-4ab-457e1c1f&quot;&lt;br /&gt;Content-Length: 12195&lt;br /&gt;&lt;/pre&gt;&lt;p style=&quot;font-family: verdana; color: rgb(255, 255, 255);&quot;&gt;Later, if the browser has to validate a component, it uses the &lt;code&gt;If-None-Match&lt;/code&gt; header to pass the ETag back to the origin server. If the ETags match, a 304 status code is returned reducing the response by 12195 bytes for this example.&lt;br /&gt;&lt;/p&gt;&lt;pre style=&quot;font-family: verdana; color: rgb(255, 255, 255);&quot;&gt;      GET /i/yahoo.gif HTTP/1.1&lt;br /&gt;Host: us.yimg.com&lt;br /&gt;If-Modified-Since: Tue, 12 Dec 2006 03:03:59 GMT&lt;br /&gt;If-None-Match: &quot;10c24bc-4ab-457e1c1f&quot;&lt;br /&gt;HTTP/1.1 304 Not Modified&lt;br /&gt;&lt;/pre&gt;&lt;p style=&quot;font-family: verdana; color: rgb(255, 255, 255);&quot;&gt;The problem with ETags is that they typically are constructed using attributes that make them unique to a specific server hosting a site. ETags won&#39;t match when a browser gets the original component from one server and later tries to validate that component on a different server, a situation that is all too common on Web sites that use a cluster of servers to handle requests. By default, both Apache and IIS embed data in the ETag that dramatically reduces the odds of the validity test succeeding on web sites with multiple servers.&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;font-family: verdana; color: rgb(255, 255, 255);&quot;&gt;The ETag format for Apache 1.3 and 2.x is &lt;code&gt;inode-size-timestamp&lt;/code&gt;. Although a given file may reside in the same directory across multiple servers, and have the same file size, permissions, timestamp, etc., its inode is different from one server to the next.&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;font-family: verdana; color: rgb(255, 255, 255);&quot;&gt;IIS 5.0 and 6.0 have a similar issue with ETags. The format for ETags on IIS is &lt;code&gt;Filetimestamp:ChangeNumber&lt;/code&gt;. A &lt;code&gt;ChangeNumber&lt;/code&gt; is a counter used to track configuration changes to IIS. It&#39;s unlikely that the &lt;code&gt;ChangeNumber&lt;/code&gt; is the same across all IIS servers behind a web site.&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;font-family: verdana; color: rgb(255, 255, 255);&quot;&gt;The end result is ETags generated by Apache and IIS for the exact same component won&#39;t match from one server to another. If the ETags don&#39;t match, the user doesn&#39;t receive the small, fast 304 response that ETags were designed for; instead, they&#39;ll get a normal 200 response along with all the data for the component. If you host your web site on just one server, this isn&#39;t a problem. But if you have multiple servers hosting your web site, and you&#39;re using Apache or IIS with the default ETag configuration, your users are getting slower pages, your servers have a higher load, you&#39;re consuming greater bandwidth, and proxies aren&#39;t caching your content efficiently. Even if your components have a far future &lt;code&gt;Expires&lt;/code&gt; header, a conditional GET request is still made whenever the user hits Reload or Refresh.&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;font-family: verdana; color: rgb(255, 255, 255);&quot;&gt;If you&#39;re not taking advantage of the flexible validation model that ETags provide, it&#39;s better to just remove the ETag altogether. The &lt;code&gt;Last-Modified&lt;/code&gt; header validates based on the component&#39;s timestamp. And removing the ETag reduces the size of the HTTP headers in both the response and subsequent requests. This &lt;a href=&quot;http://support.microsoft.com/?id=922733&quot; target=&quot;_blank&quot;&gt;Microsoft Support article&lt;/a&gt; describes how to remove ETags. In Apache, this is done by simply adding the following line to your Apache configuration file:&lt;br /&gt;&lt;/p&gt;&lt;pre style=&quot;font-family: verdana; color: rgb(255, 255, 255);&quot;&gt;      FileETag &lt;/pre&gt;&lt;br /&gt;&lt;h2 style=&quot;font-family: verdana; color: rgb(255, 255, 255); font-weight: normal;&quot; id=&quot;cacheajax&quot;&gt;Make Ajax Cacheable&lt;br /&gt;&lt;/h2&gt;&lt;p style=&quot;font-family: verdana; color: rgb(255, 255, 255);&quot; class=&quot;date&quot;&gt;tag: content&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;font-family: verdana; color: rgb(255, 255, 255);&quot;&gt;One of the cited benefits of Ajax is that it provides instantaneous feedback to the user because it requests information asynchronously from the backend web server. However, using Ajax is no guarantee that the user won&#39;t be twiddling his thumbs waiting for those asynchronous JavaScript and XML responses to return. In many applications, whether or not the user is kept waiting depends on how Ajax is used. For example, in a web-based email client the user will be kept waiting for the results of an Ajax request to find all the email messages that match their search criteria. It&#39;s important to remember that &quot;asynchronous&quot; does not imply &quot;instantaneous&quot;.&lt;/p&gt;&lt;span style=&quot;color: rgb(255, 255, 255);font-family:verdana;&quot; &gt;To improve performance, it&#39;s important to optimize these Ajax responses. The most important way to improve the performance of Ajax is to make the responses cacheable, as discussed in &lt;/span&gt;&lt;a style=&quot;font-family: verdana; color: rgb(255, 255, 255);&quot; href=&quot;http://www.blogger.com/post-create.g?blogID=2455101440367165155#expires&quot;&gt;Add an Expires or a Cache-Control Header&lt;/a&gt;&lt;span style=&quot;color: rgb(255, 255, 255);font-family:verdana;&quot; &gt;. Some of the other rules also apply to Ajax:&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;ul style=&quot;font-family: verdana; color: rgb(255, 255, 255);&quot;&gt;&lt;br /&gt;&lt;li&gt; &lt;a href=&quot;http://www.blogger.com/post-create.g?blogID=2455101440367165155#gzip&quot;&gt;Gzip Components&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt; &lt;a href=&quot;http://www.blogger.com/post-create.g?blogID=2455101440367165155#dns_lookups&quot;&gt;Reduce DNS Lookups&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt; &lt;a href=&quot;http://www.blogger.com/post-create.g?blogID=2455101440367165155#minify&quot;&gt;Minify JavaScript&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt; &lt;a href=&quot;http://www.blogger.com/post-create.g?blogID=2455101440367165155#redirects&quot;&gt;Avoid Redirects&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt; &lt;a href=&quot;http://www.blogger.com/post-create.g?blogID=2455101440367165155#etags&quot;&gt;Configure ETags&lt;/a&gt;&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p style=&quot;font-family: verdana; color: rgb(255, 255, 255);&quot;&gt;Let&#39;s look at an example. A Web 2.0 email client might use Ajax to download the user&#39;s address book for autocompletion. If the user hasn&#39;t modified her address book since the last time she used the email web app, the previous address book response could be read from cache if that Ajax response was made cacheable with a future Expires or Cache-Control header. The browser must be informed when to use a previously cached address book response versus requesting a new one. This could be done by adding a timestamp to the address book Ajax URL indicating the last time the user modified her address book, for example, &lt;code&gt;&amp;amp;t=1190241612&lt;/code&gt;. If the address book hasn&#39;t been modified since the last download, the timestamp will be the same and the address book will be read from the browser&#39;s cache eliminating an extra HTTP roundtrip. If the user has modified her address book, the timestamp ensures the new URL doesn&#39;t match the cached response, and the browser will request the updated address book entries.&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p style=&quot;font-family: verdana; color: rgb(255, 255, 255);&quot;&gt;Even though your Ajax responses are created dynamically, and might only be applicable to a single user, they can still be cached. Doing so will make your Web 2.0 apps faster.&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;h2 style=&quot;font-family: verdana; color: rgb(255, 255, 255); font-weight: normal;&quot; id=&quot;flush&quot;&gt;Flush the Buffer Early&lt;br /&gt;&lt;/h2&gt;&lt;p style=&quot;font-family: verdana; color: rgb(255, 255, 255);&quot;&gt;tag: server&lt;br /&gt;&lt;br /&gt;When users request a page, it can take anywhere from 200 to 500ms for the backend server to stitch together the HTML page.&lt;br /&gt;During this time, the browser is idle as it waits for the data to arrive.&lt;br /&gt;In PHP you have the function &lt;a href=&quot;http://php.net/flush&quot; target=&quot;_blank&quot;&gt;flush()&lt;/a&gt;.&lt;br /&gt;It allows you to send your partially ready HTML response to the browser so that&lt;br /&gt;the browser can start fetching components while your backend is busy with the rest of the HTML page.&lt;br /&gt;The benefit is mainly seen on busy backends or light frontends.&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;font-family: verdana; color: rgb(255, 255, 255);&quot;&gt;&lt;br /&gt;A good place to consider flushing is right after the HEAD because the HTML for the head is&lt;br /&gt;usually easier to produce and it allows you to include any CSS and JavaScript&lt;br /&gt;files for the browser to start fetching in parallel while the backend is still processing.&lt;br /&gt;Example:&lt;br /&gt;&lt;/p&gt;&lt;pre style=&quot;font-family: verdana; color: rgb(255, 255, 255);&quot;&gt;    ... &amp;lt;!-- css, js --&amp;gt;&lt;br /&gt;&amp;lt;/head&amp;gt;&lt;br /&gt;&lt;span class=&quot;hilite&quot;&gt;&amp;lt;?php flush(); ?&amp;gt;&lt;/span&gt;&lt;br /&gt;&amp;lt;body&amp;gt;&lt;br /&gt;... &amp;lt;!-- content --&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;a style=&quot;font-family: verdana; color: rgb(255, 255, 255);&quot; href=&quot;http://search.yahoo.com/&quot;&gt;Yahoo! search&lt;/a&gt;&lt;span style=&quot;color: rgb(255, 255, 255);font-family:verdana;&quot; &gt; pioneered research and real user testing to prove the benefits of using this technique.&lt;/span&gt;&lt;br /&gt;&lt;p style=&quot;font-family: verdana; color: rgb(255, 255, 255);&quot;&gt;&lt;a href=&quot;http://www.blogger.com/post-create.g?blogID=2455101440367165155#page-nav&quot;&gt;top&lt;/a&gt;&lt;br /&gt;&lt;/p&gt;&lt;h2 style=&quot;font-family: verdana; color: rgb(255, 255, 255); font-weight: normal;&quot; id=&quot;ajax_get&quot;&gt;Use GET for AJAX Requests&lt;/h2&gt;&lt;span style=&quot;color: rgb(255, 255, 255);font-family:verdana;&quot; &gt;tag: server&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;p  style=&quot;color: rgb(255, 255, 255); font-weight: bold;font-family:verdana;&quot;&gt;&lt;br /&gt;&lt;span style=&quot;font-weight: normal;&quot;&gt;The &lt;/span&gt;&lt;a style=&quot;font-weight: normal;&quot; href=&quot;http://mail.yahoo.com/&quot;&gt;Yahoo! Mail&lt;/a&gt;&lt;span style=&quot;font-weight: normal;&quot;&gt; team found that when using &lt;/span&gt;&lt;code style=&quot;font-weight: normal;&quot;&gt;XMLHttpRequest&lt;/code&gt;&lt;span style=&quot;font-weight: normal;&quot;&gt;, POST is implemented in the browsers as a two-step process:&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-weight: normal;&quot;&gt;sending the headers first, then sending data. So it&#39;s best to use GET, which only takes one TCP packet to send (unless you have a lot of cookies).&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-weight: normal;&quot;&gt;The maximum URL length in IE is 2K, so if you send more than 2K data you might not be able to use GET.&lt;/span&gt;&lt;br /&gt;&lt;/p&gt;&lt;span style=&quot;color: rgb(255, 255, 255);font-family:verdana;&quot; &gt;An interesting side affect is that POST without actually posting any data behaves like GET.&lt;/span&gt;&lt;br /&gt;&lt;p style=&quot;font-family: verdana; color: rgb(255, 255, 255);&quot;&gt;Based on the &lt;a href=&quot;http://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html&quot; target=&quot;_blank&quot;&gt;HTTP specs&lt;/a&gt;, GET is meant for retrieving information, so it&lt;br /&gt;makes sense (semantically) to use GET when you&#39;re only requesting data, as opposed to sending data to be stored server-side.&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;&lt;h2 style=&quot;font-family: verdana; color: rgb(255, 255, 255); font-weight: normal;&quot; id=&quot;postload&quot;&gt;Post-load Components&lt;br /&gt;&lt;/h2&gt;&lt;p style=&quot;font-family: verdana; color: rgb(255, 255, 255);&quot;&gt;tag: content&lt;br /&gt;&lt;br /&gt;You can take a closer look at your page and ask yourself: &quot;What&#39;s absolutely required in order to render the page initially?&quot;.&lt;br /&gt;The rest of the content and components can wait.&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;font-family: verdana; color: rgb(255, 255, 255);&quot;&gt;&lt;br /&gt;JavaScript is an ideal candidate for splitting before and after the onload event. For example&lt;br /&gt;if you have JavaScript code and libraries that do drag and drop and animations, those can wait,&lt;br /&gt;because dragging elements on the page comes after the initial rendering.&lt;br /&gt;Other places to look for candidates for post-loading include hidden content (content that appears after a user action) and images below the fold.&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;font-family: verdana; color: rgb(255, 255, 255);&quot;&gt;&lt;br /&gt;Tools to help you out in your effort: &lt;a href=&quot;http://developer.yahoo.com/yui/imageloader/&quot;&gt;YUI Image Loader&lt;/a&gt; allows you to delay images&lt;br /&gt;below the fold and the &lt;a href=&quot;http://developer.yahoo.com/yui/get/&quot;&gt;YUI Get utility&lt;/a&gt; is an easy way to include JS and CSS on the fly.&lt;br /&gt;For an example in the wild take a look at &lt;a href=&quot;http://www.yahoo.com/&quot;&gt;Yahoo! Home Page&lt;/a&gt; with Firebug&#39;s Net Panel turned on.&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;&lt;p style=&quot;font-family: verdana; color: rgb(255, 255, 255);&quot;&gt;&lt;br /&gt;It&#39;s good when the performance goals are inline with other&lt;br /&gt;web development best practices. In this case, the idea of progressive enhancement tells us that JavaScript, when supported, can&lt;br /&gt;improve the user experience but you have to make sure the page works even without JavaScript. So after you&#39;ve made sure the page&lt;br /&gt;works fine, you can enhance it with some post-loaded scripts that give you more bells and whistles such as drag and drop and animations.&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;&lt;h2 style=&quot;font-family: verdana; color: rgb(255, 255, 255); font-weight: normal;&quot; id=&quot;preload&quot;&gt;Preload Components&lt;/h2&gt;&lt;span style=&quot;color: rgb(255, 255, 255);font-family:verdana;&quot; &gt;tag: content&lt;/span&gt;&lt;br /&gt;&lt;p style=&quot;font-family: verdana; color: rgb(255, 255, 255);&quot;&gt;  Preload may look like the opposite of post-load, but it actually has a different goal.&lt;br /&gt;By preloading components you can take advantage of the time the browser is idle and request components&lt;br /&gt;(like images, styles and scripts) you&#39;ll need in the future.&lt;br /&gt;This way when the user visits the next page, you could have most of the components already in&lt;br /&gt;the cache and your page will load much faster for the user.&lt;br /&gt;&lt;br /&gt;There are actually several types of preloading:&lt;br /&gt;&lt;/p&gt;&lt;ul style=&quot;font-family: verdana; color: rgb(255, 255, 255);&quot;&gt;&lt;li&gt;&lt;em&gt;Unconditional&lt;/em&gt; preload - as soon as onload fires, you go ahead and fetch some extra components.&lt;br /&gt;Check google.com for an example of how a sprite image is requested onload. This sprite image is&lt;br /&gt;not needed on the google.com homepage, but it is needed on the consecutive search result page.&lt;/li&gt;&lt;br /&gt;&lt;li&gt;&lt;em&gt;Conditional&lt;/em&gt; preload - based on a user action you make an educated guess where the user is headed next and preload accordingly.&lt;br /&gt;On &lt;a href=&quot;http://search.yahoo.com/&quot;&gt;search.yahoo.com&lt;/a&gt; you can see how some extra components are requested&lt;br /&gt;after you start typing in the input box.&lt;/li&gt;&lt;br /&gt;&lt;li&gt;&lt;em&gt;Anticipated&lt;/em&gt; preload - preload in advance before launching a redesign. It often happens after a redesign that you hear:&lt;br /&gt;&quot;The new site is cool, but it&#39;s slower than before&quot;. Part of the problem could be that the users were visiting your old site with a&lt;br /&gt;full cache, but the new one is always an empty cache experience. You can mitigate this side effect by preloading some&lt;br /&gt;components before you even launched the redesign. Your old site can use the time the browser is idle and request images and scripts&lt;br /&gt;that will be used by the new site&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;&lt;br /&gt;&lt;h2 style=&quot;font-family: verdana; color: rgb(255, 255, 255); font-weight: normal;&quot; id=&quot;min_dom&quot;&gt;Reduce the Number of DOM Elements&lt;br /&gt;&lt;/h2&gt;&lt;p style=&quot;font-family: verdana; color: rgb(255, 255, 255);&quot;&gt;tag: content&lt;br /&gt;&lt;br /&gt;A complex page means more bytes to download and it also means slower DOM access in JavaScript. It makes a difference&lt;br /&gt;if you loop through 500 or 5000 DOM elements on the page when you want to add an event handler for example.&lt;br /&gt;&lt;br /&gt;A high number of DOM elements can be a symptom that there&#39;s something that should be improved with the markup&lt;br /&gt;of the page without necessarily removing content.&lt;br /&gt;Are you using nested tables for layout purposes?&lt;br /&gt;Are you throwing in more &lt;code&gt;&amp;lt;div&amp;gt;&lt;/code&gt;s only to fix layout issues?&lt;br /&gt;Maybe there&#39;s a better and more semantically correct way to do your markup.&lt;br /&gt;&lt;br /&gt;A great help with layouts are the &lt;a href=&quot;http://developer.yahoo.com/yui/&quot;&gt;YUI CSS utilities&lt;/a&gt;:&lt;br /&gt;grids.css can help you with the overall layout, fonts.css and reset.css&lt;br /&gt;can help you strip away the browser&#39;s defaults formatting.&lt;br /&gt;This is a chance to start fresh and think about your markup,&lt;br /&gt;for example use &lt;code&gt;&amp;lt;div&amp;gt;&lt;/code&gt;s only when it makes sense semantically, and not because it renders a new line.&lt;br /&gt;&lt;br /&gt;The number of DOM elements is easy to test, just type in Firebug&#39;s console:&lt;br /&gt;&lt;br /&gt;&lt;code&gt;document.getElementsByTagName(&#39;*&#39;).length&lt;/code&gt;&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;&lt;p style=&quot;font-family: verdana; color: rgb(255, 255, 255);&quot;&gt;&lt;br /&gt;And how many DOM elements are too many? Check other similar pages that have good markup.&lt;br /&gt;For example the &lt;a href=&quot;http://www.yahoo.com/&quot;&gt;Yahoo! Home Page&lt;/a&gt; is a pretty busy page and still under 700 elements (HTML tags).&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;h2 style=&quot;font-family: verdana; color: rgb(255, 255, 255); font-weight: normal;&quot; id=&quot;split&quot;&gt;Split Components Across Domains&lt;br /&gt;&lt;/h2&gt;&lt;p style=&quot;font-family: verdana; color: rgb(255, 255, 255);&quot; class=&quot;date&quot;&gt;tag: content&lt;/p&gt;&lt;span style=&quot;color: rgb(255, 255, 255);font-family:verdana;&quot; &gt;Splitting components allows you to maximize parallel downloads. Make sure you&#39;re using&lt;/span&gt;&lt;br /&gt;&lt;p style=&quot;font-family: verdana; color: rgb(255, 255, 255);&quot;&gt;  not more than 2-4 domains because of the DNS lookup penalty.&lt;br /&gt;For example, you can host your HTML and dynamic content&lt;br /&gt;on &lt;code&gt;www.example.org&lt;/code&gt;&lt;br /&gt;and split static components between &lt;code&gt;static1.example.org&lt;/code&gt; and &lt;code&gt;static2.example.org&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;For more information check&lt;br /&gt;&quot;&lt;a href=&quot;http://web-performance-research.blogspot.com/2008/05/performance-research-part-4-maximizing.html&quot; target=&quot;_blank&quot;&gt;Maximizing Parallel Downloads in the Carpool Lane&lt;/a&gt;&quot; by Tenni Theurer and Patty Chi.&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;h2 style=&quot;font-family: verdana; color: rgb(255, 255, 255); font-weight: normal;&quot; id=&quot;iframes&quot;&gt;Minimize the Number of iframes&lt;br /&gt;&lt;/h2&gt;&lt;p  style=&quot;color: rgb(255, 255, 255); font-weight: bold;font-family:verdana;&quot; class=&quot;date&quot;&gt;&lt;span style=&quot;font-weight: normal;&quot;&gt;tag: content&lt;/span&gt;&lt;br /&gt;&lt;/p&gt;&lt;p  style=&quot;color: rgb(255, 255, 255); font-weight: bold;font-family:verdana;&quot;&gt;&lt;br /&gt;&lt;span style=&quot;font-weight: normal;&quot;&gt;Iframes allow an HTML document to be inserted in the parent document.&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-weight: normal;&quot;&gt;It&#39;s important to understand how iframes work so they can be used effectively.&lt;/span&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;font-family: verdana; color: rgb(255, 255, 255);&quot;&gt;&lt;br /&gt;&lt;code&gt;&amp;lt;iframe&amp;gt;&lt;/code&gt; pros:&lt;br /&gt;&lt;/p&gt;&lt;ul style=&quot;font-family: verdana; color: rgb(255, 255, 255);&quot;&gt;&lt;li&gt;Helps with slow third-party content like badges and ads&lt;/li&gt;&lt;br /&gt;&lt;li&gt;Security sandbox&lt;/li&gt;&lt;br /&gt;&lt;li&gt;Download scripts in parallel&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p style=&quot;font-family: verdana; color: rgb(255, 255, 255);&quot;&gt;  &lt;code&gt;&amp;lt;iframe&amp;gt;&lt;/code&gt; cons:&lt;/p&gt;&lt;ul style=&quot;font-family: verdana; color: rgb(255, 255, 255);&quot;&gt;&lt;br /&gt;&lt;li&gt;Costly even if blank&lt;/li&gt;&lt;br /&gt;&lt;li&gt;Blocks page onload&lt;/li&gt;&lt;br /&gt;&lt;li&gt;Non-semantic&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;&lt;br /&gt;&lt;h2 style=&quot;font-family: verdana; color: rgb(255, 255, 255); font-weight: normal;&quot; id=&quot;no404&quot;&gt;No 404s&lt;br /&gt;&lt;/h2&gt;&lt;p style=&quot;font-family: verdana; color: rgb(255, 255, 255);&quot; class=&quot;date&quot;&gt;tag: content&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;font-family: verdana; color: rgb(255, 255, 255);&quot;&gt;&lt;br /&gt;HTTP requests are expensive so making an HTTP request and getting a useless response (i.e. 404 Not Found)&lt;br /&gt;is totally unnecessary and will slow down the user experience without any benefit.&lt;br /&gt;&lt;br /&gt;Some sites have helpful 404s &quot;Did you mean X?&quot;, which is great for the user&lt;br /&gt;experience but also wastes server resources (like database, etc).&lt;br /&gt;Particularly bad is when the link to an external JavaScript is wrong and the result is a 404.&lt;br /&gt;First, this download will block parallel downloads. Next the browser may try to parse&lt;br /&gt;the 404 response body as if it were JavaScript code, trying to find something usable in it.&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;&lt;h2 style=&quot;font-family: verdana; color: rgb(255, 255, 255); font-weight: normal;&quot; id=&quot;cookie_size&quot;&gt;Reduce Cookie Size&lt;/h2&gt;&lt;span style=&quot;color: rgb(255, 255, 255);font-family:verdana;&quot; &gt;tag: cookie&lt;/span&gt;&lt;br /&gt;&lt;p style=&quot;font-family: verdana; color: rgb(255, 255, 255);&quot;&gt;&lt;br /&gt;HTTP cookies are used for a variety of reasons such as authentication and personalization.&lt;br /&gt;Information about cookies is exchanged in the HTTP headers between web servers and browsers.&lt;br /&gt;It&#39;s important to keep the size of cookies as low as possible to minimize the impact on the user&#39;s response time.&lt;br /&gt;&lt;/p&gt;&lt;span style=&quot;color: rgb(255, 255, 255);font-family:verdana;&quot; &gt;For more information check&lt;/span&gt;&lt;br /&gt;&lt;p style=&quot;font-family: verdana; color: rgb(255, 255, 255);&quot;&gt;  &lt;a href=&quot;http://web-performance-research.blogspot.com/2008/05/performance-research-part-3-when-cookie.html&quot; target=&quot;_blank&quot;&gt;&quot;When the Cookie Crumbles&quot;&lt;/a&gt; by Tenni Theurer and Patty Chi.&lt;br /&gt;The take-home of this research:&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;font-family: verdana; color: rgb(255, 255, 255);&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;ul style=&quot;font-family: verdana; color: rgb(255, 255, 255);&quot;&gt;&lt;br /&gt;&lt;li&gt;Eliminate unnecessary cookies&lt;/li&gt;&lt;br /&gt;&lt;li&gt;Keep cookie sizes as low as possible to minimize the impact on the user response time&lt;/li&gt;&lt;br /&gt;&lt;li&gt;Be mindful of setting cookies at the appropriate domain level so other sub-domains are not affected&lt;/li&gt;&lt;br /&gt;&lt;li&gt;Set an Expires date appropriately. An earlier Expires date or none removes the cookie sooner, improving the user response time&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;h2 style=&quot;font-family: verdana; color: rgb(255, 255, 255); font-weight: normal;&quot; id=&quot;cookie_free&quot;&gt;Use Cookie-free Domains for Components&lt;br /&gt;&lt;/h2&gt;&lt;p style=&quot;font-family: verdana; color: rgb(255, 255, 255);&quot; class=&quot;date&quot;&gt;tag: cookie&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;font-family: verdana; color: rgb(255, 255, 255);&quot;&gt;&lt;br /&gt;When the browser makes a request for a static image and sends cookies together with the request,&lt;br /&gt;the server doesn&#39;t have any use for those cookies. So they only create network traffic for no good&lt;br /&gt;reason. You should make sure static components are requested with cookie-free requests. Create&lt;br /&gt;a subdomain and host all your static components there.&lt;br /&gt;&lt;br /&gt;If your domain is &lt;code&gt;www.example.org&lt;/code&gt;, you can host your static components&lt;br /&gt;on &lt;code&gt;static.example.org&lt;/code&gt;. However, if you&#39;ve already set cookies on the top-level domain&lt;br /&gt;&lt;code&gt;example.org&lt;/code&gt; as opposed to &lt;code&gt;www.example.org&lt;/code&gt;, then all the requests to&lt;br /&gt;&lt;code&gt;static.example.org&lt;/code&gt; will include those cookies. In this case, you can buy a whole new domain, host your static&lt;br /&gt;components there, and keep this domain cookie-free. Yahoo! uses &lt;code&gt;yimg.com&lt;/code&gt;, YouTube uses &lt;code&gt;ytimg.com&lt;/code&gt;,&lt;br /&gt;Amazon uses &lt;code&gt;images-amazon.com&lt;/code&gt; and so on.&lt;br /&gt;&lt;br /&gt;Another benefit of hosting static components on a cookie-free domain is that some proxies might refuse to cache&lt;br /&gt;the components that are requested with cookies.&lt;br /&gt;On a related note, if you wonder if you should use example.org or www.example.org for your home page, consider the cookie impact.&lt;br /&gt;Omitting www leaves you no choice but to write cookies to &lt;code&gt;*.example.org&lt;/code&gt;, so for performance reasons it&#39;s best to use the&lt;br /&gt;www subdomain and&lt;br /&gt;write the cookies to that subdomain.&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;h2 style=&quot;font-family: verdana; color: rgb(255, 255, 255); font-weight: normal;&quot; id=&quot;dom_access&quot;&gt;Minimize DOM Access&lt;/h2&gt;&lt;span style=&quot;color: rgb(255, 255, 255);font-family:verdana;&quot; &gt;tag: javascript&lt;/span&gt;&lt;br /&gt;&lt;p style=&quot;font-family: verdana; color: rgb(255, 255, 255);&quot;&gt;  Accessing DOM elements with JavaScript is slow so in order to have a more responsive page, you should:&lt;br /&gt;&lt;/p&gt;&lt;ul style=&quot;font-family: verdana; color: rgb(255, 255, 255);&quot;&gt;&lt;br /&gt;&lt;li&gt;Cache references to accessed elements&lt;/li&gt;&lt;br /&gt;&lt;li&gt;Update nodes &quot;offline&quot; and then add them to the tree&lt;/li&gt;&lt;br /&gt;&lt;li&gt;Avoid fixing layout with JavaScript&lt;/li&gt;&lt;/ul&gt;&lt;p style=&quot;font-family: verdana; color: rgb(255, 255, 255);&quot;&gt;&lt;br /&gt;For more information check the YUI theatre&#39;s&lt;br /&gt;&lt;a href=&quot;http://yuiblog.com/blog/2007/12/20/video-lecomte/&quot; target=&quot;_blank&quot;&gt;&quot;High Performance Ajax Applications&quot;&lt;/a&gt;&lt;br /&gt;by Julien Lecomte.&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;h2 style=&quot;font-family: verdana; color: rgb(255, 255, 255); font-weight: normal;&quot; id=&quot;events&quot;&gt;Develop Smart Event Handlers&lt;/h2&gt;&lt;span style=&quot;color: rgb(255, 255, 255);font-family:verdana;&quot; &gt;tag: javascript&lt;/span&gt;&lt;br /&gt;&lt;p style=&quot;font-family: verdana; color: rgb(255, 255, 255);&quot;&gt;&lt;br /&gt;Sometimes pages feel less responsive because of too many event handlers attached to different&lt;br /&gt;elements of the DOM tree which are then executed too often. That&#39;s why using &lt;em&gt;event delegation&lt;/em&gt; is a good approach.&lt;br /&gt;If you have 10 buttons inside a &lt;code&gt;div&lt;/code&gt;, attach only one event handler to the div wrapper, instead of&lt;br /&gt;one handler for each button. Events bubble up so you&#39;ll be able to catch the event and figure out which button it originated from.&lt;br /&gt;&lt;/p&gt;&lt;span style=&quot;color: rgb(255, 255, 255);font-family:verdana;&quot; &gt;You also don&#39;t need to wait for the onload event in order to start doing something with the DOM tree.&lt;/span&gt;&lt;br /&gt;&lt;p style=&quot;font-family: verdana; color: rgb(255, 255, 255);&quot;&gt;  Often all you need is the element you want to access to be available in the tree. You don&#39;t have to wait for all images to be downloaded.&lt;br /&gt;&lt;br /&gt;&lt;code&gt;DOMContentLoaded&lt;/code&gt; is the event you might consider using instead of onload, but until it&#39;s available in all browsers, youcan use the &lt;a href=&quot;http://developer.yahoo.com/yui/event/&quot; target=&quot;_blank&quot;&gt;YUI Event&lt;/a&gt; utility, which has an &lt;code&gt;&lt;a href=&quot;http://developer.yahoo.com/yui/event/#onavailable&quot; target=&quot;_blank&quot;&gt;onAvailable&lt;/a&gt;&lt;/code&gt; method.&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;&lt;p style=&quot;font-family: verdana; color: rgb(255, 255, 255);&quot;&gt;  For more information check the YUI theatre&#39;s&lt;br /&gt;&lt;a href=&quot;http://yuiblog.com/blog/2007/12/20/video-lecomte/&quot; target=&quot;_blank&quot;&gt;&quot;High Performance Ajax Applications&quot;&lt;/a&gt;&lt;br /&gt;by Julien Lecomte.&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;&lt;h2 style=&quot;font-family: verdana; color: rgb(255, 255, 255); font-weight: normal;&quot; id=&quot;csslink&quot;&gt;Choose &amp;lt;link&amp;gt; over @import&lt;/h2&gt;&lt;span style=&quot;color: rgb(255, 255, 255);font-family:verdana;&quot; &gt;tag: css&lt;/span&gt;&lt;br /&gt;&lt;p style=&quot;font-family: verdana; color: rgb(255, 255, 255);&quot;&gt;&lt;br /&gt;One of the previous best practices states that CSS should be at the top in order to allow for&lt;br /&gt;progressive rendering.&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;font-family: verdana; color: rgb(255, 255, 255);&quot;&gt;  In IE &lt;code&gt;@import&lt;/code&gt; behaves the same as using &lt;code&gt;&amp;lt;link&amp;gt;&lt;/code&gt; at the bottom of the page, so it&#39;s best not to use it.&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;h2 style=&quot;font-family: verdana; color: rgb(255, 255, 255); font-weight: normal;&quot; id=&quot;no_filters&quot;&gt;Avoid Filters&lt;br /&gt;&lt;/h2&gt;&lt;p style=&quot;font-family: verdana; color: rgb(255, 255, 255);&quot; class=&quot;date&quot;&gt;tag: css&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;font-family: verdana; color: rgb(255, 255, 255);&quot;&gt;&lt;br /&gt;The IE-proprietary &lt;code&gt;AlphaImageLoader&lt;/code&gt; filter aims to fix a problem with semi-transparent true color PNGs in IE versions &amp;lt; 7.&lt;br /&gt;The problem with this filter is that it blocks rendering and freezes the browser while the image is being downloaded.&lt;br /&gt;It also increases memory consumption and is applied per element, not per image, so the problem is multiplied.&lt;br /&gt;&lt;br /&gt;The best approach is to avoid &lt;code&gt;AlphaImageLoader&lt;/code&gt; completely and use gracefully degrading PNG8 instead, which are fine in IE.&lt;br /&gt;If you absolutely need &lt;code&gt;AlphaImageLoader&lt;/code&gt;, use the underscore hack &lt;code&gt;_filter&lt;/code&gt; as to not penalize your IE7+ users.&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;&lt;h2 style=&quot;font-family: verdana; color: rgb(255, 255, 255); font-weight: normal;&quot; id=&quot;opt_images&quot;&gt;Optimize Images&lt;br /&gt;&lt;/h2&gt;&lt;p style=&quot;font-family: verdana; color: rgb(255, 255, 255);&quot; class=&quot;date&quot;&gt;tag: images&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;font-family: verdana; color: rgb(255, 255, 255);&quot;&gt;&lt;br /&gt;After a designer is done with creating the images for your web page, there are still some things you can try before you&lt;br /&gt;FTP those images to your web server.&lt;br /&gt;&lt;/p&gt;&lt;ul style=&quot;font-family: verdana; color: rgb(255, 255, 255);&quot;&gt;&lt;li&gt;You can check the GIFs and see if they are using a palette size corresponding&lt;br /&gt;to the number of colors in the image. Using &lt;a href=&quot;http://www.imagemagick.org/&quot; target=&quot;_blank&quot;&gt;imagemagick&lt;/a&gt; it&#39;s easy to check using&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;code&gt;identify -verbose image.gif&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;When you see an image useing 4 colors and a 256 color &quot;slots&quot; in the palette, there is room for improvement.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;&lt;br /&gt;Try converting GIFs to PNGs and see if there is a saving. More often than not, there is.&lt;br /&gt;Developers often hesitate to use PNGs due to the limited support in browsers, but this is now a thing of the past.&lt;br /&gt;The only real problem is alpha-transparency in true color PNGs, but then again, GIFs are not true color and don&#39;t&lt;br /&gt;support variable transparency either.&lt;br /&gt;So anything a GIF can do, a palette PNG (PNG8) can do too (except for animations).&lt;br /&gt;This simple imagemagick command results in totally safe-to-use&lt;br /&gt;PNGs:&lt;br /&gt;&lt;code&gt;convert image.gif image.png&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&quot;All we are saying is: Give PiNG a Chance!&quot;&lt;br /&gt;&lt;/li&gt;&lt;li&gt;&lt;br /&gt;Run &lt;a href=&quot;http://pmt.sourceforge.net/pngcrush/&quot; target=&quot;_blank&quot;&gt;pngcrush&lt;/a&gt; (or any other PNG optimizer tool) on all your PNGs. Example:&lt;br /&gt;&lt;br /&gt;&lt;code&gt;pngcrush image.png -rem alla -reduce -brute result.png&lt;/code&gt;&lt;br /&gt;&lt;/li&gt;&lt;br /&gt;&lt;li&gt;&lt;br /&gt;Run jpegtran on all your JPEGs. This tool does lossless JPEG operations such as rotation and can also be used to optimize&lt;br /&gt;and remove comments and other useless information (such as EXIF information) from your images.&lt;br /&gt;&lt;br /&gt;&lt;code&gt;jpegtran -copy none -optimize -perfect src.jpg dest.jpg&lt;/code&gt;&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;&lt;br /&gt;&lt;h2 style=&quot;font-family: verdana; color: rgb(255, 255, 255); font-weight: normal;&quot; id=&quot;opt_sprites&quot;&gt;Optimize CSS Sprites&lt;br /&gt;&lt;/h2&gt;&lt;p style=&quot;font-family: verdana; color: rgb(255, 255, 255);&quot; class=&quot;date&quot;&gt;tag: images&lt;br /&gt;&lt;/p&gt;&lt;ul style=&quot;font-family: verdana; color: rgb(255, 255, 255);&quot;&gt;&lt;br /&gt;&lt;li&gt;Arranging the images in the sprite horizontally as opposed to vertically usually results in a smaller file size.&lt;/li&gt;&lt;br /&gt;&lt;li&gt;Combining similar colors in a sprite helps you keep the color count low, ideally under 256 colors so to fit in a PNG8.&lt;/li&gt;&lt;br /&gt;&lt;li&gt;&quot;Be mobile-friendly&quot; and don&#39;t leave big gaps between the images in a sprite. This doesn&#39;t affect the file size as much&lt;br /&gt;but requires less memory for the user agent to decompress the image into a pixel map.&lt;br /&gt;100x100 image is 10 thousand pixels, where 1000x1000 is 1 million pixels&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;&lt;h2 style=&quot;font-family: verdana; color: rgb(255, 255, 255); font-weight: normal;&quot; id=&quot;no_scale&quot;&gt;Don&#39;t Scale Images in HTML&lt;br /&gt;&lt;/h2&gt;&lt;p style=&quot;font-family: verdana; color: rgb(255, 255, 255);&quot;&gt;tag: images&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Don&#39;t use a bigger image than you need just because you can set the width and height in HTML.&lt;br /&gt;If you need&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&amp;lt;img width=&quot;100&quot; height=&quot;100&quot; src=&quot;mycat.jpg&quot; alt=&quot;My Cat&quot; /&amp;gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;then your image (mycat.jpg) should be 100x100px rather than a scaled down 500x500px image.&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;h2 style=&quot;font-family: verdana; color: rgb(255, 255, 255); font-weight: normal;&quot; id=&quot;favicon&quot;&gt;Make favicon.ico Small and Cacheable&lt;br /&gt;&lt;/h2&gt;&lt;p style=&quot;font-family: verdana; color: rgb(255, 255, 255);&quot;&gt;tag: images&lt;br /&gt;&lt;br /&gt;The favicon.ico is an image that stays in the root of your server.&lt;br /&gt;It&#39;s a necessary evil because even if you don&#39;t care about it the&lt;br /&gt;browser will still request it, so it&#39;s better not to respond with a &lt;code&gt;404 Not Found&lt;/code&gt;.&lt;br /&gt;Also since it&#39;s on the same server, cookies are sent every time it&#39;s requested.&lt;br /&gt;This image also interferes with the download sequence, for example in IE when you request&lt;br /&gt;extra components in the onload, the favicon will be downloaded before these extra components.&lt;br /&gt;&lt;br /&gt;So to mitigate the drawbacks of having a favicon.ico make sure:&lt;br /&gt;&lt;/p&gt;&lt;ul style=&quot;font-family: verdana; color: rgb(255, 255, 255);&quot;&gt;&lt;li&gt;It&#39;s small, preferably under 1K.&lt;/li&gt;&lt;br /&gt;&lt;li&gt;Set Expires header with what you feel comfortable (since you cannot rename it if you decide to change it).&lt;br /&gt;You can probably safely set the Expires header a few months in the future.&lt;br /&gt;You can check the last modified date of your current favicon.ico to make an informed decision.&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p style=&quot;font-family: verdana; color: rgb(255, 255, 255);&quot;&gt;&lt;br /&gt;&lt;a href=&quot;http://www.imagemagick.org/&quot; target=&quot;_blank&quot;&gt;Imagemagick&lt;/a&gt; can help you create small favicons&lt;br /&gt;&lt;/p&gt;&lt;h2 style=&quot;font-family: verdana; color: rgb(255, 255, 255); font-weight: normal;&quot; id=&quot;under25&quot;&gt;Keep Components under 25K&lt;/h2&gt;&lt;span style=&quot;color: rgb(255, 255, 255);font-family:verdana;&quot; &gt;tag: mobile&lt;/span&gt;&lt;br /&gt;&lt;p style=&quot;font-family: verdana; color: rgb(255, 255, 255);&quot;&gt;&lt;br /&gt;This restriction is related to the fact that iPhone won&#39;t cache components bigger than 25K.&lt;br /&gt;Note that this is the &lt;em&gt;uncompressed&lt;/em&gt; size. This is where minification is important&lt;br /&gt;because gzip alone may not be sufficient.&lt;br /&gt;&lt;br /&gt;For more information check&lt;br /&gt;&lt;a href=&quot;http://web-performance-research.blogspot.com/2008/05/performance-research-part-5-iphone.html&quot; target=&quot;_blank&quot;&gt;&quot;Performance Research, Part 5: iPhone Cacheability - Making it Stick&quot;&lt;/a&gt;&lt;br /&gt;by Wayne Shea and Tenni Theurer.&lt;br /&gt;&lt;/p&gt;&lt;span style=&quot;color: rgb(255, 255, 255);font-family:verdana;&quot; &gt;Pack Components into a Multipart Document&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;p  style=&quot;color: rgb(255, 255, 255); font-weight: bold;font-family:verdana;&quot;&gt;&lt;span style=&quot;font-weight: normal;&quot;&gt;tag: mobile&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-weight: normal;&quot;&gt;Packing components into a multipart document is like an email with attachments,&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-weight: normal;&quot;&gt;it helps you fetch several components with one HTTP request (remember: HTTP requests are expensive).&lt;/span&gt;&lt;br /&gt;&lt;/p&gt;&lt;div style=&quot;text-align: justify; color: rgb(255, 255, 255);&quot;&gt;When you use this technique, first check if the user agent supports it (iPhone does not).&lt;br /&gt;&lt;/div&gt;&lt;p style=&quot;font-family: verdana; color: rgb(255, 255, 255); font-weight: bold;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;b style=&quot;font-weight: bold; font-family: verdana; color: rgb(255, 255, 255);&quot;&gt;&lt;br /&gt;&lt;/b&gt;</description><link>http://web-performance-research.blogspot.com/2008/05/exceptional-performance-best-practices.html</link><author>noreply@blogger.com (Sekhar Veernapu)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-2455101440367165155.post-8932550580584858691</guid><pubDate>Tue, 27 May 2008 04:19:00 +0000</pubDate><atom:updated>2008-05-27T00:04:10.615-07:00</atom:updated><title>Performance Research, Part 5: iPhone Cacheability - Making it Stick</title><description>&lt;p style=&quot;font-family: verdana; color: rgb(255, 255, 255);&quot;&gt;At &lt;a href=&quot;http://www.macworldexpo.com/&quot;&gt;MacWorld 2008&lt;/a&gt;, Steve Jobs  announced that Apple sold 4 million iPhones to date, that’s 20,000 iPhones sold  every day. &lt;a href=&quot;http://marketshare.hitslink.com/report.aspx?sample=4&amp;amp;qprid=10&amp;amp;qpmr=14&amp;amp;qpdt=1&amp;amp;qpct=0&amp;amp;qptimeframe=M&amp;amp;qpsp=107&quot;&gt;Net  Applications&lt;/a&gt; reports that total web browsing on iPhone is up at 0.12% for  December 2007, topping the web browsing on all Windows Mobile devices combined.  Apple’s iPhone has changed the game for many users browsing the web on a mobile  device. Web developers can now create functionally rich and visually appealing  applications that run within the iPhone’s version of the Safari Mobile web  browser. While the iPhone presents new and exciting opportunities for mobile web  application developers, it also provides a unique set of performance  challenges.&lt;/p&gt; &lt;p style=&quot;font-family: verdana; color: rgb(255, 255, 255);&quot;&gt;Limited information is available on this device and understanding the cache  properties of the browser is essential to creating a high performance web site.  In earlier posts, we described how &lt;a href=&quot;http://web-performance-research.blogspot.com/2008/05/performance-research-part-1-what-8020.html&quot; target=&quot;_blank&quot;&gt;80% or  more&lt;/a&gt; of the end-user response time is spent on the front-end, and &lt;a target=&quot;_blank&quot; href=&quot;http://web-performance-research.blogspot.com/2008/05/performance-research-part-2-browser.html&quot;&gt;why the  cache matters&lt;/a&gt;. In this research, Yahoo!’s Exceptional Performance team  investigated the iPhone cache properties and looked at how the performance rules  are affected. We were particularly interested in the following cache properties  on the iPhone:&lt;/p&gt; &lt;ul style=&quot;font-family: verdana; color: rgb(255, 255, 255);&quot;&gt;&lt;li&gt;The maximum cache limit for an individual component.  &lt;/li&gt;&lt;li&gt;The maximum cache limit for multiple components.  &lt;/li&gt;&lt;li&gt;The effect of gzipped components on the maximum cache limits.  &lt;/li&gt;&lt;li&gt;Whether cached components are persistent between power cycles.  &lt;/li&gt;&lt;/ul&gt; &lt;p style=&quot;font-family: verdana; color: rgb(255, 255, 255);&quot;&gt;We conducted our cache experiments with both Apple’s iPhone and iPod Touch,  and came to the same conclusions.&lt;/p&gt; &lt;h3 style=&quot;font-family: verdana; color: rgb(255, 255, 255);&quot;&gt;Cache Hit or Miss?&lt;/h3&gt; &lt;p style=&quot;font-family: verdana; color: rgb(255, 255, 255);&quot;&gt;In &lt;a target=&quot;_blank&quot; href=&quot;http://web-performance-research.blogspot.com/2008/05/performance-research-part-2-browser.html&quot;&gt;Part  2&lt;/a&gt;, we discussed the importance to differentiate between end user experiences  for an empty versus a primed cache page view.&lt;/p&gt; &lt;p style=&quot;font-family: verdana; color: rgb(255, 255, 255);&quot;&gt;When an external component (scripts, stylesheets, and images) is referenced  in an HTML page, the browser makes an HTTP request and stores the component in  memory while the HTML page is rendered. Though components are stored in the  browser’s memory during rendering, they may or may not be stored in the  browser’s cache. A “cache miss” refers to when the browser bypasses the cache  and requests the component over the network. A “cache hit” refers to when the  component is found in the cache and the corresponding HTTP requests are  avoided.&lt;/p&gt; &lt;p style=&quot;font-family: verdana; color: rgb(255, 255, 255);&quot;&gt;Components are cacheable when they include either the expires or  cache-control header. &lt;/p&gt;&lt;pre style=&quot;font-family: verdana; color: rgb(255, 255, 255);&quot;&gt;      Expires: [Expiration time in GMT Format]&lt;br /&gt;  Cache-Control: max-age=[Expiration time in seconds]&lt;br /&gt;&lt;/pre&gt; &lt;p style=&quot;font-family: verdana; color: rgb(255, 255, 255);&quot;&gt;Components that do not have one of the above headers will not be cached by  the browser. To discover the cache capabilities on the iPhone browser and get a  cache hit, we configured the server to include the following response  header:&lt;/p&gt;&lt;pre style=&quot;font-family: verdana; color: rgb(255, 255, 255);&quot;&gt;      Expires: Thu, 15 Apr 2010 20:00:00 GMT&lt;br /&gt;&lt;/pre&gt; &lt;h3 style=&quot;font-family: verdana; color: rgb(255, 255, 255);&quot;&gt;Maximum Cache Limits&lt;/h3&gt; &lt;p style=&quot;font-family: verdana; color: rgb(255, 255, 255);&quot;&gt;In our experiments, we varied the size of different types of components  (images, stylesheets, and scripts) to determine the maximum cache size for an  individual component. We found that if the size of component is greater than 25  KB, the iPhone’s browser does not cache the component. Thus, web pages designed  specifically for the iPhone should reduce the size of each component to 25  Kbytes or less for optimal caching behavior.&lt;/p&gt; &lt;p style=&quot;font-family: verdana; color: rgb(255, 255, 255);&quot;&gt;The good news is if the browser downloads a component larger than 25 KB,  components already in the browser cache are not affected. Components already in  the cache are only replaced by newer cacheable components under 25 KB using the  LRU (least recently used) algorithm.&lt;/p&gt; &lt;p style=&quot;font-family: verdana; color: rgb(255, 255, 255);&quot;&gt;Apple’s &lt;a href=&quot;http://developer.apple.com/iphone/devcenter/designingcontent.html&quot;&gt;website&lt;/a&gt;  indicates a 10 MB limit for individual components. The limit applies to the  browser ability to store component in memory (not disk). However, the actual  size that the iPhone can handle is much smaller, and depends on memory  fragmentation and other applications that may be running concurrently. The  uncached components are reclaimed by the browser when the page unloads.&lt;/p&gt; &lt;p style=&quot;font-family: verdana; color: rgb(255, 255, 255);&quot;&gt;To determine the maximum limit of the iPhone cache for multiple components,  we incremented the number of 25 KB sized components embedded in our page. We  tested the various component types and found that the iPhone browser was able to  cache a maximum of 19 external 25KB components. The maximum cache limit for  multiple components is found to be 475K - 500 KB. &lt;/p&gt; &lt;h3 style=&quot;font-family: verdana; color: rgb(255, 255, 255);&quot;&gt;Compressed Components&lt;/h3&gt; &lt;p style=&quot;font-family: verdana; color: rgb(255, 255, 255);&quot;&gt;We also analyzed the impact of the cache characteristics on components  transmitted with and without compression. We were surprised to find that the 25  KB maximum cache limit for a component is independent to whether the component  was sent gzipped. The Safari browser on the iPhone decodes the component  &lt;i&gt;before&lt;/i&gt; saving it to the cache. Therefore, only the uncompressed size  matters, which further emphasizes the importance of keeping the size of  components small.&lt;/p&gt; &lt;h3 style=&quot;font-family: verdana; color: rgb(255, 255, 255);&quot;&gt;The Effect of Power Cycle&lt;/h3&gt; &lt;p style=&quot;font-family: verdana; color: rgb(255, 255, 255);&quot;&gt;Every once in awhile, iPhone and iPod Touch users will need to force a hard  reset, or in other words, cut the power and reboot the device. This is achieved  by a hold of the sleep button for five seconds, and a simple slide to power off.  Suppose a user was browsing your site at the moment before the reset. Will the  images and stylesheets still be in the browser’s cache when the user returns to  ensure a speedy response time when the user returns? We discovered that the  iPhone browser cache is not persisted across power cycle. This means that the  Safari browser cache on iPhone allocates memory from the system memory to create  cached components but does not save the cached components in persistent storage.  &lt;/p&gt; &lt;h3 style=&quot;font-family: verdana; color: rgb(255, 255, 255);&quot;&gt;Case Study: Yahoo! Front Page&lt;/h3&gt; &lt;p style=&quot;font-family: verdana; color: rgb(255, 255, 255);&quot;&gt;Yahoo! launched a beta version of the mobile home page at the Consumer  Electronics Show (CES) in January 2008. From a performance standpoint, this  makes perfect sense. The iPhone has an amazing UI, but it is limited by the  small cache size and slow network speed. Downloading large components over the  air through the EDGE network is slower compared to DSL. According to published  reports, the typical data download speed varies from 82 kbps to 150 kbps. Though  the WiFi network speed is usually more acceptable, it’s better to give users the  choice in which experience they’d prefer. Let’s take a closer look at the  caching characteristics of the &lt;a href=&quot;http://beta.m.yahoo.com/&quot;&gt;mobile&lt;/a&gt; and  &lt;a href=&quot;http://www.yahoo.com/&quot;&gt;desktop&lt;/a&gt; versions of Yahoo!’s Home Page on the  iPhone. Figure 1 below shows a comparison between the two.&lt;/p&gt; &lt;div style=&quot;font-family: verdana; color: rgb(255, 255, 255);&quot;&gt; &lt;h4&gt;&lt;strong&gt;Figure 1.&lt;/strong&gt; Yahoo! Front Page Mobile and Desktop versions on  the iPhone&lt;/h4&gt; &lt;p&gt;&lt;img style=&quot;width: 233px; height: 290px;&quot; alt=&quot;Yahoo! Front Page Mobile and Desktop versions on the iPhone&quot; src=&quot;http://yuiblog.com/assets/performance/iphone-side-by-side.png&quot; /&gt;&lt;/p&gt;&lt;/div&gt; &lt;p style=&quot;font-family: verdana; color: rgb(255, 255, 255);&quot;&gt;The desktop version of Yahoo!’s home page is roughly 11 times heavier in  total size than the mobile version. As a result, the response time to load the  desktop version on the iPhone is over 10 times as long. Table 1 shows a summary  of the total size and number of HTTP requests to load the Yahoo!’s Front Page  mobile version. Loading the page on the iPhone over the EDGE network, it took on  average 2.2 seconds to load with an empty cache and on average only 1.5 seconds  to load with a primed cache. Table 2 shows the desktop version took on average  25.4 seconds to load with an empty cache and on average 19.9 seconds with a  primed cache. That’s 32% faster with a primed cache than empty cache to load the  mobile version, rather than only 22% faster to load the desktop version. While  the mobile site is designed for optimal caching behavior, the desktop version  contains many more components that are uncacheable by the iPhone.&lt;/p&gt; &lt;div style=&quot;font-family: verdana; color: rgb(255, 255, 255);&quot; class=&quot;figure&quot;&gt; &lt;table class=&quot;chart&quot;&gt; &lt;caption&gt;Table 1. iPhone Mobile Experience&lt;/caption&gt; &lt;tbody&gt; &lt;tr&gt; &lt;th&gt;&lt;br /&gt;&lt;/th&gt; &lt;th&gt;Empty Cache&lt;/th&gt; &lt;th&gt;Primed Cache&lt;/th&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;HTML/Text&lt;/td&gt; &lt;td&gt;5K (23K*)&lt;/td&gt; &lt;td&gt;5K (23K*)&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;Images&lt;/td&gt; &lt;td&gt;14K&lt;/td&gt; &lt;td&gt;5K&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;Total Size&lt;/td&gt; &lt;td&gt;19K (37K*)&lt;/td&gt; &lt;td&gt;10K (28K*)&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;HTTP Requests&lt;/td&gt; &lt;td&gt;23&lt;/td&gt; &lt;td&gt;4&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;Response Time&lt;/td&gt; &lt;td&gt;2.2 sec&lt;/td&gt; &lt;td&gt;1.5 sec&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/div&gt; &lt;div style=&quot;font-family: verdana; color: rgb(255, 255, 255);&quot; class=&quot;figure&quot;&gt; &lt;table style=&quot;width: 262px; height: 174px;&quot; class=&quot;chart&quot;&gt; &lt;caption&gt;Table 2. iPhone Desktop Experience&lt;/caption&gt; &lt;tbody&gt; &lt;tr&gt; &lt;th&gt;&lt;br /&gt;&lt;/th&gt; &lt;th&gt;Empty Cache&lt;/th&gt; &lt;th&gt;Primed Cache&lt;/th&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;HTML/Text&lt;/td&gt; &lt;td&gt;32K (121K*)&lt;/td&gt; &lt;td&gt;32K (121K*)&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;Images&lt;/td&gt; &lt;td&gt;117K&lt;/td&gt; &lt;td&gt;32K&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;JS/CSS&lt;/td&gt; &lt;td&gt;74K (278K*)&lt;/td&gt; &lt;td&gt;73K (272K*)&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;Total Size&lt;/td&gt; &lt;td&gt;223K (517K*)&lt;/td&gt; &lt;td&gt;137K (425K*)&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;HTTP Requests&lt;/td&gt; &lt;td&gt;30&lt;/td&gt; &lt;td&gt;4&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;Response Time&lt;/td&gt; &lt;td&gt;25.4 sec&lt;/td&gt; &lt;td&gt;19.9 sec&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt; &lt;p&gt;&lt;strong&gt;* &lt;/strong&gt;Uncompressed sizes measured in kilobytes.&lt;/p&gt;&lt;/div&gt; &lt;h3 style=&quot;font-family: verdana; color: rgb(255, 255, 255);&quot;&gt;Takeaways&lt;/h3&gt; &lt;p style=&quot;font-family: verdana; color: rgb(255, 255, 255);&quot;&gt;Design sites specific for iPhone users. In addition to improved usability,  you will also reduce the overall page weight and enhance end-user’s performance.  Yahoo!’s Exceptional Performance team identified &lt;a href=&quot;http://web-performance-research.blogspot.com/2008/05/exceptional-performance-best-practices.html&quot;&gt;13 rules for making web  pages fast&lt;/a&gt;. The iPhone cache experiment suggests an additional performance  rule specific for developing web sites for the iPhone:&lt;/p&gt; &lt;h4 style=&quot;font-family: verdana; color: rgb(255, 255, 255);&quot;&gt;Reduce the size of each component to 25 Kbytes or less for optimal caching  behavior.&lt;/h4&gt; &lt;p style=&quot;font-family: verdana; color: rgb(255, 255, 255);&quot;&gt;Given that the wireless network speed on iPhone is limited and the browser  cache is cleared across power cycle, it is even more important to make fewer  HTTP requests to achieve good performance than in the desktop world. To reduce  the number of HTTP requests, Safari on iPhone supports image map, CSS sprites,  inline images and inline CSS images. Take advantage of the browser cache  whenever possible. If an external component can be shared across multiple pages  in the site, remember that each individual component has to be smaller than 25  KB to be cacheable. Also, the maximum cache limit of all components is 475 - 500  KB. Minify all the JavaScript, CSS and HTML. For components that aren’t shared  across multiple pages, consider making them inline.&lt;/p&gt;</description><link>http://web-performance-research.blogspot.com/2008/05/performance-research-part-5-iphone.html</link><author>noreply@blogger.com (Sekhar Veernapu)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-2455101440367165155.post-8935411861911423847</guid><pubDate>Mon, 26 May 2008 10:31:00 +0000</pubDate><atom:updated>2008-05-26T03:39:21.450-07:00</atom:updated><title>Performance Research, Part 4: Maximizing Parallel Downloads in the Carpool Lane</title><description>&lt;h3 style=&quot;color: rgb(255, 255, 255);&quot; id=&quot;parallel-downloads&quot;&gt;P&lt;span style=&quot;font-family:verdana;&quot;&gt;arallel Downloads&lt;/span&gt;&lt;/h3&gt; &lt;p style=&quot;color: rgb(255, 255, 255); font-family: verdana;&quot;&gt;The biggest impact on end-user response times is the number of components in  the page. Each component requires an extra HTTP request, perhaps not when the  cache is full, but definitely when the cache is empty. Knowing that the browser  performs HTTP requests in parallel, you may ask why the number of HTTP requests  affects response time. Can’t the browser download them all at once?&lt;/p&gt; &lt;p style=&quot;color: rgb(255, 255, 255); font-family: verdana;&quot;&gt;The explanation goes back to the HTTP/1.1 spec, which suggests that browsers  download two components in parallel per hostname. Many web pages download all  their components from a single hostname. Viewing these HTTP requests reveals a  stair-step pattern, as shown in Figure 1.&lt;/p&gt; &lt;div style=&quot;color: rgb(255, 255, 255); font-family: verdana;&quot; class=&quot;chart&quot; id=&quot;figure-1&quot;&gt; &lt;h4&gt;&lt;strong&gt;Figure 1.&lt;/strong&gt; Downloading 2 components in parallel&lt;/h4&gt; &lt;p&gt;&lt;img id=&quot;two_parallel&quot; alt=&quot;Figure 1. Downloading 2 components in parallel&quot; src=&quot;http://yuiblog.com/assets/performance/two_parallel.gif&quot; longdesc=&quot;two_parallel.gif&quot; height=&quot;200&quot; width=&quot;311&quot; /&gt;&lt;/p&gt;&lt;/div&gt; &lt;p style=&quot;color: rgb(255, 255, 255); font-family: verdana;&quot;&gt;If a web page evenly distributed its components across two hostnames, the  overall response time would be about twice as fast. The HTTP requests would look  as shown in Figure 2, with four components downloaded in parallel (two per  hostname). The horizontal width of the box is the same, to give a visual cue as  to how much faster this page loads.&lt;/p&gt; &lt;div style=&quot;color: rgb(255, 255, 255); font-family: verdana;&quot; class=&quot;chart&quot; id=&quot;figure-2&quot;&gt; &lt;h4&gt;&lt;strong&gt;Figure 2.&lt;/strong&gt; Downloading 4 components in parallel&lt;/h4&gt; &lt;p&gt;&lt;img id=&quot;four_parallel&quot; alt=&quot;Figure 2. Downloading 4 components in parallel&quot; src=&quot;http://yuiblog.com/assets/performance/four_parallel.gif&quot; longdesc=&quot;four_parallel.gif&quot; height=&quot;200&quot; width=&quot;311&quot; /&gt;&lt;/p&gt;&lt;/div&gt; &lt;p style=&quot;color: rgb(255, 255, 255); font-family: verdana;&quot;&gt;Limiting parallel downloads to two per hostname is a guideline. By default,  both Internet Explorer and Firefox follow the guideline, but users can override  this default behavior. Internet Explorer stores the value in the Registry  Editor. (See &lt;a href=&quot;http://support.microsoft.com/?kbid=282402&quot; target=&quot;_blank&quot;&gt;Microsoft Help  and Support&lt;/a&gt;.) Firefox’s setting is controlled by the network.http.max-persistent-connections-per-server  setting, accessible in the about:config page.&lt;/p&gt; &lt;p style=&quot;color: rgb(255, 255, 255); font-family: verdana;&quot;&gt;It’s interesting to note that for HTTP/1.0, Firefox’s default is to download  eight components in parallel per hostname. Figure 3 shows what it would look  like to download these ten images if Firefox’s HTTP/1.0 settings are used. It’s  even faster than Figure 2, and we didn’t have to split the images across two  hostnames.&lt;/p&gt; &lt;div style=&quot;color: rgb(255, 255, 255); font-family: verdana;&quot; class=&quot;chart&quot; id=&quot;figure-3&quot;&gt; &lt;h4&gt;&lt;strong&gt;Figure 3.&lt;/strong&gt; Downloading 8 components in parallel&lt;/h4&gt; &lt;p&gt;&lt;img style=&quot;width: 252px; height: 200px;&quot; id=&quot;eight_parallel&quot; alt=&quot;Figure 3. Downloading 8 components in parallel&quot; src=&quot;http://yuiblog.com/assets/performance/eight_parallel.gif&quot; /&gt;&lt;/p&gt;&lt;/div&gt; &lt;p style=&quot;color: rgb(255, 255, 255); font-family: verdana;&quot;&gt;Most web sites today use HTTP/1.1, but the idea of increasing parallel  downloads beyond two per hostname is intriguing. Instead of relying on users to  modify their browser settings, front-end engineers could simply use CNAMEs (DNS  aliases) to split their components across multiple hostnames. Maximizing  parallel downloads doesn’t come without a cost. Depending on your bandwidth and  CPU speed, too many parallel downloads can degrade performance.&lt;/p&gt; &lt;p style=&quot;color: rgb(255, 255, 255); font-family: verdana;&quot;&gt;If browsers limit the number of parallel downloads to two (per hostname over  HTTP/1.1), this raises the question:&lt;/p&gt; &lt;h3 style=&quot;color: rgb(255, 255, 255); font-family: verdana;&quot; id=&quot;what-if&quot;&gt;What if we use additional aliases to increase parallel downloads  in our pages?&lt;/h3&gt; &lt;p style=&quot;color: rgb(255, 255, 255); font-family: verdana;&quot;&gt;We’ve seen a couple great blogs and articles written recently on the subject,  most notably &lt;a href=&quot;http://www.ajaxperformance.com/?p=33&quot;&gt;Ryan Breen of  Gomez&lt;/a&gt; and &lt;a href=&quot;http://www.die.net/musings/page_load_time/&quot;&gt;Aaron Hopkins  over at Google&lt;/a&gt;. Here’s another spin. The performance team at Examle.com! ran an  experiment to measure the impact of using various numbers of hostname aliases.  The experiment measured an empty HTML document with 20 images on the page. The  images were fetched from the same servers as those used by real Take any exmple site ! pages. We  ran the experiment in a controlled environment using a test harness that fetches  a set of URLs repeatedly while measuring how long it takes to load the page on  DSL. The results are shown in Figure 4.&lt;/p&gt; &lt;div style=&quot;color: rgb(255, 255, 255); font-family: verdana;&quot; class=&quot;chart&quot; id=&quot;figure-4&quot;&gt; &lt;h4&gt;&lt;strong&gt;Figure 4.&lt;/strong&gt; Loading an Empty HTML Document with 20 images  using Various Number of Aliases&lt;/h4&gt; &lt;p&gt;&lt;img style=&quot;width: 338px; height: 386px;&quot; id=&quot;expt&quot; alt=&quot;Figure 4. Loading an Empty HTML Document with 20 images using Various Number of Aliases&quot; src=&quot;http://yuiblog.com/assets/performance/expt.gif&quot; /&gt;&lt;/p&gt; &lt;p class=&quot;gloss&quot;&gt;&lt;strong&gt;Note: &lt;/strong&gt;Times are for cached aliases, empty file  cache page loads on DSL (~800 kbps).&lt;/p&gt;&lt;/div&gt; &lt;p style=&quot;color: rgb(255, 255, 255); font-family: verdana;&quot;&gt;In our experiment, we vary the number of aliases: 1, 2, 4, 5, and 10. This  increases the number of parallel downloads to 2, 4, 8, 10, and 20 respectively.  We fetch 20 smaller-sized images (36 x 36 px) and 20 medium-sized images (116 x  61 px). To our surprise, increasing the number of aliases for loading the  medium-size images (116 x 61px) worsens the response times using four or more  aliases. Increasing the number of aliases by more than two for smaller-sized  images (36 x 36px) doesn’t make much of an impact on the overall response time.  On average, using two aliases is best.&lt;/p&gt; &lt;p style=&quot;color: rgb(255, 255, 255); font-family: verdana;&quot;&gt;One possible contributor for slower response times is the amount of CPU  thrashing on the client caused by increasing the number of parallel downloads.  The more images that are downloaded in parallel, the greater the amount of CPU  thrashing on the client. On my laptop at work, the CPU jumped from 25% usage for  2 parallel downloads to 40% usage for 20 parallel downloads. These values can  vary significantly across users’ computers but is just another factor to  consider before increasing the number of aliases to maximize parallel  downloads.&lt;/p&gt; &lt;p style=&quot;color: rgb(255, 255, 255); font-family: verdana;&quot;&gt;These results are for the case where the domains are already cached in the  browser. In the case where the domains are not cached, the response times get  significantly worse as the number of hostname aliases increases. For web pages  desiring to optimize the experience for first time users, we recommend not to  increase the number of domains. To optimize for the second page view, where the  domains are most likely cached, increasing parallel downloads does improve  response times. The choice depends on which scenario was most typical.&lt;/p&gt; &lt;p style=&quot;color: rgb(255, 255, 255); font-family: verdana;&quot;&gt;Another issue to consider is that DNS lookup times vary significantly across  ISPs and geographic locations. Typically, DNS lookup times for users from non-US  cities are significantly higher than those for users within the US. If a good  percentage of your users are coming from outside the US, the benefits of  increasing parallel downloads is offset by the time to make many DNS  lookups.&lt;/p&gt; &lt;p style=&quot;color: rgb(255, 255, 255);&quot;&gt;&lt;span style=&quot;font-family:verdana;&quot;&gt;Our rule of thumb is to increase the number of parallel downloads by using at  least two, but no more than four hostnames. Once again, this underscores the  number one rule for improving response times: reduce the number of components in  the page.&lt;/span&gt; &lt;/p&gt;</description><link>http://web-performance-research.blogspot.com/2008/05/performance-research-part-4-maximizing.html</link><author>noreply@blogger.com (Sekhar Veernapu)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-2455101440367165155.post-1616427625621288168</guid><pubDate>Mon, 26 May 2008 09:28:00 +0000</pubDate><atom:updated>2008-05-26T02:47:41.706-07:00</atom:updated><title>Performance Research, Part 3: When the Cookie Crumbles</title><description>&lt;p style=&quot;font-family: verdana; color: rgb(255, 255, 255);&quot;&gt;HTTP cookies are used for a variety of reasons such as authentication and  personalization. Information about cookies is exchanged in the HTTP headers  between web servers and browsers. This article discusses the impact of cookies  on the overall user response time.&lt;/p&gt; &lt;h3 style=&quot;font-family: verdana; color: rgb(255, 255, 255);&quot; id=&quot;http-quick-review&quot;&gt;HTTP Quick Review&lt;/h3&gt; &lt;p style=&quot;font-family: verdana; color: rgb(255, 255, 255);&quot;&gt;Cookies originate from web servers when browsers request a page. Here is a  sample HTTP header sent by the web server after a request for  &lt;code&gt;www.example.com&lt;/code&gt;:&lt;/p&gt;&lt;pre  style=&quot;color: rgb(255, 255, 255);font-family:verdana;&quot;&gt;  &lt;span style=&quot;font-weight: bold;&quot;&gt;HTTP/1.1 200 OK&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt; Content-Type: text/html; charset=utf-8&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt; Set-Cookie: C=abcde; path=/; domain=.&lt;/span&gt;&lt;code style=&quot;font-weight: bold;&quot;&gt;example&lt;/code&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;.com&lt;/span&gt;&lt;br /&gt;&lt;/pre&gt; &lt;p style=&quot;font-family: verdana; color: rgb(255, 255, 255);&quot;&gt;The header includes information about the response such as the protocol  version, status code, and content-type. The &lt;code&gt;Set-Cookie&lt;/code&gt; is also  included in the response and in this example the name of the cookie is “C” and  the value of the cookie is “abcde”. Note: The maximum size of a cookie is 5051  bytes in IE 6.0 and 4096 bytes in Firefox 1.5.&lt;/p&gt; &lt;p style=&quot;font-family: verdana; color: rgb(255, 255, 255);&quot;&gt;The browser saves the “C” cookie on the user’s computer and sends it back in  future requests. The “&lt;code&gt;domain=.&lt;/code&gt;&lt;code&gt;example&lt;/code&gt;&lt;code&gt;.com&lt;/code&gt;” specifies that the browser  should include the cookie in future requests within the &lt;code&gt;.&lt;/code&gt;&lt;code&gt;example&lt;/code&gt;&lt;code&gt;.com&lt;/code&gt;  domain and all its sub-domains. For example, if the user then visits  &lt;code&gt;finance.&lt;/code&gt;&lt;code&gt;example&lt;/code&gt;&lt;code&gt;.com&lt;/code&gt;, the browser includes the “C” cookie in the  request. Since an Expires attribute is not included in this example, the cookie  expires at the end of the session.&lt;/p&gt; &lt;p style=&quot;font-family: verdana; color: rgb(255, 255, 255);&quot;&gt;Here is a sample HTTP header for &lt;code&gt;finance.&lt;/code&gt;&lt;code&gt;example&lt;/code&gt;&lt;code&gt;.com&lt;/code&gt; sent by the  browser:&lt;/p&gt;&lt;pre  style=&quot;color: rgb(255, 255, 255);font-family:verdana;&quot;&gt;  &lt;span style=&quot;font-weight: bold;&quot;&gt;GET / HTTP/1.1&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt; Host: finance.&lt;/span&gt;&lt;code style=&quot;font-weight: bold;&quot;&gt;example&lt;/code&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;.com&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt; User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; ...&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt; Cookie: C=abcde;&lt;/span&gt;&lt;br /&gt;&lt;/pre&gt; &lt;p style=&quot;font-family: verdana; color: rgb(255, 255, 255);&quot;&gt;Notice that the “C” cookie, originating from &lt;code&gt;www.&lt;/code&gt;&lt;code&gt;example&lt;/code&gt;&lt;code&gt;.com&lt;/code&gt;, is  also included in the request for &lt;code&gt;finance.&lt;/code&gt;&lt;code&gt;example&lt;/code&gt;&lt;code&gt;.com&lt;/code&gt;.&lt;/p&gt; &lt;h3 style=&quot;font-family: verdana; color: rgb(255, 255, 255);&quot; id=&quot;impact-on-response-time&quot;&gt;Impact of cookies on response time&lt;/h3&gt; &lt;p style=&quot;font-family: verdana; color: rgb(255, 255, 255);&quot; id=&quot;table1&quot;&gt;The performance team at &lt;code&gt;example&lt;/code&gt;! ran an experiment to measure the  impact of retrieving a document with various cookie sizes. The experiment  measured a static HTML document with no elements in the page. The primary  variable in the experiment was the cookie size. We ran the experiment using a  test harness that fetches a set of URLs repeatedly while measuring how long it  takes to load the page on DSL. The results are shown in Table 1.&lt;/p&gt; &lt;div style=&quot;font-family: verdana; color: rgb(255, 255, 255);&quot; class=&quot;figure&quot; id=&quot;response-times-for-various-cookie-sizes-figure&quot;&gt; &lt;table style=&quot;width: 351px; height: 196px;&quot; class=&quot;chart&quot; id=&quot;response-times-for-various-cookie-sizes-table&quot;&gt; &lt;caption&gt;Table 1. Response times for various cookie sizes&lt;/caption&gt; &lt;tbody&gt; &lt;tr&gt; &lt;th&gt;Cookie Size&lt;/th&gt; &lt;th&gt;Median Response Time (Delta)&lt;/th&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;0 bytes&lt;/td&gt; &lt;td&gt;78 ms (&lt;b&gt;0 ms&lt;/b&gt;)&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;500 bytes&lt;/td&gt; &lt;td&gt;79 ms (&lt;b&gt;+1 ms&lt;/b&gt;)&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;1000 bytes&lt;/td&gt; &lt;td&gt;94 ms (&lt;b&gt;+16 ms&lt;/b&gt;)&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;1500 bytes&lt;/td&gt; &lt;td&gt;109 ms (&lt;b&gt;+31 ms&lt;/b&gt;)&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;2000 bytes&lt;/td&gt; &lt;td&gt;125 ms (&lt;b&gt;+47 ms&lt;/b&gt;)&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;2500 bytes&lt;/td&gt; &lt;td&gt;141 ms (&lt;b&gt;+63 ms&lt;/b&gt;)&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;3000 bytes&lt;/td&gt; &lt;td&gt;156 ms (&lt;b&gt;+78 ms&lt;/b&gt;)&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt; &lt;p class=&quot;gloss&quot;&gt;&lt;strong&gt;Note: &lt;/strong&gt;Times are for page loads on DSL (~800  kbps).&lt;/p&gt;&lt;/div&gt; &lt;p style=&quot;font-family: verdana; color: rgb(255, 255, 255);&quot;&gt;These results highlight the importance of keeping the size of cookies as low  as possible to minimize the impact on the user’s response time. A 3000 byte  cookie, or multiple cookies that total 3000 bytes, could add as much as an 80 ms  delay for users on DSL bandwidth speeds. The delay is even worse for users on  dial-up.&lt;/p&gt; &lt;h3 style=&quot;font-family: verdana; color: rgb(255, 255, 255);&quot; id=&quot;how-big-at-yahoo&quot;&gt;How big are users’ cookies set at the .&lt;code&gt;example&lt;/code&gt;.com  domain?&lt;/h3&gt; &lt;p style=&quot;font-family: verdana; color: rgb(255, 255, 255);&quot;&gt;Cookies set at the &lt;code&gt;.&lt;/code&gt;&lt;code&gt;example&lt;/code&gt;&lt;code&gt;.com&lt;/code&gt; domain affect the overall response  time for users visiting web pages across the &lt;code&gt;example&lt;/code&gt;! network. Figure 1 shows the  percentages of &lt;code&gt;example&lt;/code&gt;!’s total page views with various cookie sizes set at the  &lt;code&gt;.&lt;/code&gt;&lt;code&gt;example&lt;/code&gt;&lt;code&gt;.com&lt;/code&gt; domain.&lt;/p&gt; &lt;div style=&quot;font-family: verdana; color: rgb(255, 255, 255);&quot; class=&quot;chart&quot;&gt; &lt;h4 id=&quot;percent-of-views-with-cookie-sizes&quot;&gt;&lt;strong&gt;Figure 1.&lt;/strong&gt; Percentage  of Page Views with Various Cookie Sizes&lt;/h4&gt; &lt;p&gt;&lt;img style=&quot;width: 313px; height: 304px;&quot; id=&quot;cookies&quot; alt=&quot;Figure 1. Percentage of Page Views with Various Cookie Sizes&quot; src=&quot;http://www.yuiblog.com/assets/performance/cookies.gif&quot; /&gt;&lt;/p&gt;&lt;/div&gt; &lt;p style=&quot;font-family: verdana; color: rgb(255, 255, 255);&quot;&gt;About 80% of page views have fewer than 1000 bytes of cookies, which  correlates to about a 5 to 15 ms delay for users on DSL bandwidth speeds. While  the data shows that the majority of page views aren’t impacted by a significant  delay, it also shows that about 2% of page views have over 1500 bytes of cookies  set at the &lt;code&gt;.&lt;/code&gt;&lt;code&gt;example&lt;/code&gt;&lt;code&gt;.com&lt;/code&gt; domain. Although 2% sounds insignificant, at &lt;code&gt;example&lt;/code&gt;! this translates to millions of page views per day, a compelling  motivation for us to investigate this 2% and eliminate unnecessary cookies,  reduce cookie sizes, and set cookies at more granualar domain levels.&lt;/p&gt; &lt;p style=&quot;font-family: verdana; color: rgb(255, 255, 255);&quot;&gt;In an earlier post about browser cache usage, one user made a &lt;a href=&quot;http://yuiblog.com/blog/2007/01/04/performance-research-part-2/#comment-29021&quot;&gt;comment&lt;/a&gt;  about the side-effects of different browsers. Since Internet Explorer and  Firefox have different implementations for the maximum size and number of  cookies supported, we also analyzed the data by browser type and found no  significant difference between the cookie sizes. It would be interesting to  further investigate whether there is a difference in performance across  browsers.&lt;/p&gt; &lt;h3 style=&quot;font-family: verdana; color: rgb(255, 255, 255);&quot; id=&quot;how-big-across-the-web&quot;&gt;Analysis of Cookie Sizes across the Web&lt;/h3&gt; &lt;p style=&quot;font-family: verdana; color: rgb(255, 255, 255);&quot; id=&quot;table2&quot;&gt;To show how &lt;code&gt;example&lt;/code&gt;!’s cookie usage relates to those of other  companies, we analyzed the cookies set by other popular web sites. For this  experiment, we cleared all our cookies and visited only the home pages of these  web sites. Table 2 shows between 60 and 500 bytes of cookie information included  in the HTTP headers.&lt;/p&gt; &lt;div style=&quot;font-family: verdana; color: rgb(255, 255, 255);&quot; class=&quot;figure&quot; id=&quot;total-cookie-sizes-figure&quot;&gt; &lt;table style=&quot;width: 250px; height: 218px;&quot; class=&quot;chart&quot; id=&quot;total-cookie-sizes-chart&quot;&gt; &lt;caption&gt;Table 2. Total Cookie Sizes&lt;/caption&gt; &lt;tbody&gt; &lt;tr&gt; &lt;td&gt;&lt;br /&gt;&lt;/td&gt; &lt;th&gt;Total Cookie Size&lt;/th&gt;&lt;/tr&gt; &lt;tr&gt; &lt;th&gt;&lt;a href=&quot;http://www.amazon.com/&quot;&gt;Amazon&lt;/a&gt;&lt;/th&gt; &lt;td&gt;60 bytes&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;th&gt;&lt;a href=&quot;http://www.google.com/&quot;&gt;Google&lt;/a&gt;&lt;/th&gt; &lt;td&gt;72 bytes&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;th&gt;&lt;a href=&quot;http://www.yahoo.com/&quot;&gt;Yahoo&lt;/a&gt;&lt;/th&gt; &lt;td&gt;122 bytes&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;th&gt;&lt;a href=&quot;http://www.cnn.com/&quot;&gt;CNN&lt;/a&gt;&lt;/th&gt; &lt;td&gt;184 bytes&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;th&gt;&lt;a href=&quot;http://www.youtube.com/&quot;&gt;YouTube&lt;/a&gt;&lt;/th&gt; &lt;td&gt;218 bytes&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;th&gt;&lt;a href=&quot;http://www.msn.com/&quot;&gt;MSN&lt;/a&gt;&lt;/th&gt; &lt;td&gt;268 bytes&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;th&gt;&lt;a href=&quot;http://www.ebay.com/&quot;&gt;eBay&lt;/a&gt;&lt;/th&gt; &lt;td&gt;331 bytes&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;th&gt;&lt;a href=&quot;http://www.myspace.com/&quot;&gt;MySpace&lt;/a&gt;&lt;/th&gt; &lt;td&gt;500 bytes&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt; &lt;p class=&quot;gloss&quot;&gt;&lt;strong&gt;Note: &lt;/strong&gt;We only requested the home page.&lt;/p&gt;&lt;/div&gt; &lt;p style=&quot;font-family: verdana; color: rgb(255, 255, 255);&quot;&gt;The data in Table 2 reflects only cookies set at the top domain levels to  eliminate any cookies that may have been set by ads. The total cookie size for &lt;code&gt;example&lt;/code&gt;! (122 bytes) in Table 2 differs from the cookie sizes indicated in Figure  4 because in this experiment we visited only the home pages of each web site.  The data in Figure 4 reflect real users, many of whom visit multiple &lt;code&gt;example&lt;/code&gt;! web  pages. To illustrate, if &lt;code&gt;tv.&lt;/code&gt;&lt;code&gt;example&lt;/code&gt;&lt;code&gt;.com&lt;/code&gt; and  &lt;code&gt;movies.&lt;/code&gt;&lt;code&gt;example&lt;/code&gt;&lt;code&gt;.com&lt;/code&gt; wanted to share information within a cookie, the  cookie must be set at the &lt;code&gt;.&lt;/code&gt;&lt;code&gt;example&lt;/code&gt;&lt;code&gt;.com&lt;/code&gt; domain. The total cookie size  set at the &lt;code&gt;.&lt;/code&gt;&lt;code&gt;example&lt;/code&gt;&lt;code&gt;.com&lt;/code&gt; domain for a user who visits multiple &lt;code&gt;example&lt;/code&gt;!  sub-domains is typically higher than the total cookie size set for a user who  only visits &lt;code&gt;www.&lt;/code&gt;&lt;code&gt;example&lt;/code&gt;&lt;code&gt;.com&lt;/code&gt;.&lt;/p&gt; &lt;p style=&quot;font-family: verdana; color: rgb(255, 255, 255);&quot;&gt;Setting cookies at the appropriate path and domain is just as important as  the size of the cookie, if not more. A cookie set at the &lt;code&gt;.&lt;/code&gt;&lt;code&gt;example&lt;/code&gt;&lt;code&gt;.com&lt;/code&gt;  domain impacts the response time for every &lt;code&gt;example&lt;/code&gt;! page in the  &lt;code&gt;.&lt;/code&gt;&lt;code&gt;example&lt;/code&gt;&lt;code&gt;.com&lt;/code&gt; domain that a user visits.&lt;/p&gt; &lt;h3 style=&quot;font-family: verdana; color: rgb(255, 255, 255);&quot; id=&quot;takeaways&quot;&gt;Takeaways&lt;/h3&gt; &lt;ul style=&quot;font-family: verdana; color: rgb(255, 255, 255);&quot;&gt;&lt;li&gt;Eliminate unnecessary cookies.  &lt;/li&gt;&lt;li&gt;Keep cookie sizes as low as possible to minimize the impact on the user  response time.  &lt;/li&gt;&lt;li&gt;Be mindful of setting cookies at the appropriate domain level so other  sub-domains are not affected.  &lt;/li&gt;&lt;li&gt;Set an Expires date appropriately. An earlier Expires date or none removes  the cookie sooner, improving the user response time. &lt;/li&gt;&lt;/ul&gt;</description><link>http://web-performance-research.blogspot.com/2008/05/performance-research-part-3-when-cookie.html</link><author>noreply@blogger.com (Sekhar Veernapu)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-2455101440367165155.post-2936166016873312017</guid><pubDate>Mon, 26 May 2008 07:54:00 +0000</pubDate><atom:updated>2008-05-26T02:18:14.639-07:00</atom:updated><title>Performance Research, Part 2: Browser Cache Usage - Exposed!</title><description>&lt;div style=&quot;color: rgb(204, 51, 204); font-weight: bold;&quot;&gt; &lt;div&gt; &lt;p&gt;&lt;/p&gt;&lt;blockquote&gt;&lt;span style=&quot;font-size:180%;&quot;&gt;T&lt;/span&gt;his is the second in a series of articles describing experiments conducted  to learn more about optimizing web page performance. You may be wondering why  you’re reading a performance article on the &lt;span style=&quot;font-size:100%;&quot;&gt;http://web-performance-research.blogspot.com&lt;/span&gt;. It turns out that most of  web page performance is affected by front-end engineering, that is, the user  interface design and development.&lt;/blockquote&gt;&lt;p&gt;&lt;/p&gt; &lt;/div&gt;&lt;/div&gt; &lt;p style=&quot;font-family: verdana; color: rgb(255, 255, 255);&quot;&gt;In an earlier post, I described &lt;a href=&quot;http://web-performance-research.blogspot.com/2008/05/performance-research-part-1-what-8020.html&quot;&gt;What the  80/20 Rule Tells Us about Reducing HTTP Requests&lt;/a&gt;. Since browsers spend 80%  of the time fetching external components including scripts, stylesheets and  images, reducing the number of HTTP requests has the biggest impact on reducing  response time. But shouldn’t everything be saved in the browser’s cache  anyway?&lt;/p&gt; &lt;h3 style=&quot;font-family: verdana; color: rgb(255, 255, 255);&quot;&gt;Why does cache matter?&lt;/h3&gt; &lt;p style=&quot;font-family: verdana; color: rgb(255, 255, 255);&quot;&gt;It’s important to differentiate between end user experiences for an empty  versus a full cache page view. An “empty cache” means the browser bypasses the  disk cache and has to request all the components to load the page. A “full  cache” means all (or at least most) of the components are found in the disk  cache and the corresponding HTTP requests are avoided.&lt;/p&gt; &lt;p style=&quot;font-family: verdana; color: rgb(255, 255, 255);&quot;&gt;The main reason for an empty cache page view is because the user is visiting  the page for the first time and the browser has to download all the components  to load the page. Other reasons include:&lt;/p&gt; &lt;ul style=&quot;font-family: verdana; color: rgb(255, 255, 255);&quot;&gt;&lt;li&gt;The user visited the page previously but cleared the browser cache.  &lt;/li&gt;&lt;li&gt;The browser cache was automatically cleared, based on the browser’s  settings.  &lt;/li&gt;&lt;li&gt;The user reloaded the page in a way that caused the cache to be bypassed.  For example, the browser will bypass the cache if you hold down the  control-shift key while clicking the Refresh button in Internet Explorer.  &lt;/li&gt;&lt;/ul&gt; &lt;p style=&quot;font-family: verdana; color: rgb(255, 255, 255);&quot;&gt;Strategies such as combining scripts, stylesheets, or images reduce the  number of HTTP requests for &lt;i&gt;both&lt;/i&gt; an empty and a full cache page view.  Configuring components to have an Expires header with a date in the future  reduces the number of HTTP requests for only the full cache page view.&lt;/p&gt; &lt;p style=&quot;font-family: verdana; color: rgb(255, 255, 255);&quot;&gt;Previously, we observed where the time is spent when a user requests www.example.com  with an empty cache. When a  user loads the page, the browser downloads approximately 30 components (see  Figure 1). Figure 2 is a graphical view of where the time is spent loading http://www.example.com with a full cache. Each bar  represents a specific component requested by the browser. Since components are  already in the cache on a full cache page view, and the Expires header has a  date in the future, the browser only has to download three components including  the HTML document&lt;/p&gt; &lt;div style=&quot;font-family: verdana; color: rgb(255, 255, 255);&quot;&gt;&lt;img style=&quot;width: 363px; height: 355px;&quot; alt=&quot;Figure 1. Loading http://www.yahoo.com with an empty cache&quot; src=&quot;http://yuiblog.com/assets/performance/pageload-empty.gif&quot; longdesc=&quot;Chart in picture shows linear loading of approximately 30 components required by yahoo.com homepage.&quot; /&gt;  &lt;h4&gt;Figure 1. Loading http://www.example.com with an empty cache&lt;/h4&gt;&lt;/div&gt; &lt;div style=&quot;font-family: verdana; color: rgb(255, 255, 255);&quot;&gt;&lt;img style=&quot;width: 358px; height: 90px;&quot; alt=&quot;Figure 2. Loading http://www.yahoo.com with a full cache&quot; src=&quot;http://yuiblog.com/assets/performance/pageload-full.gif&quot; longdesc=&quot;This chart shows that only 3 components are necessary when the user has the other resources in cache.&quot; /&gt;  &lt;h4&gt;Figure 2. Loading http://www.example.com with a full cache&lt;/h4&gt;&lt;/div&gt; &lt;p style=&quot;font-family: verdana; color: rgb(255, 255, 255);&quot;&gt;Table 1 shows a summary of the total size and number of requests for each  type of component to load &lt;a href=&quot;http://www.yahoo.com/&quot;&gt;http://www.&lt;/a&gt;example&lt;a href=&quot;http://www.yahoo.com/&quot;&gt;.com&lt;/a&gt;. How much does a full cache  benefit the user? Loading the page over my cable modem at home, it took 2.4  seconds with an empty cache and only 0.9 seconds with a full cache. The full  cache page view had 90% fewer HTTP requests and 83% fewer bytes to download than  the empty cache page view.&lt;/p&gt; &lt;div style=&quot;font-family: verdana; color: rgb(255, 255, 255);&quot;&gt; &lt;h4&gt;Table 1. Empty and Full Cache Summary to load http://www.example.com&lt;br /&gt;&lt;/h4&gt; &lt;p&gt;&lt;img style=&quot;width: 335px; height: 157px;&quot; alt=&quot;Table 1. Empty and Full Cache Summary to load http://www.yahoo.com&quot; src=&quot;http://yuiblog.com/assets/performance/empty-full.gif&quot; /&gt;&lt;/p&gt; &lt;p&gt;* Times were measured over cable modem (~2.5 mbps).&lt;/p&gt;&lt;/div&gt;</description><link>http://web-performance-research.blogspot.com/2008/05/performance-research-part-2-browser.html</link><author>noreply@blogger.com (Sekhar Veernapu)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-2455101440367165155.post-6812847909040298870</guid><pubDate>Mon, 26 May 2008 06:41:00 +0000</pubDate><atom:updated>2008-05-26T02:06:49.308-07:00</atom:updated><title>Performance Research, Part 1: What the 80/20 Rule Tells Us about Reducing HTTP Requests</title><description>&lt;p face=&quot;arial&quot;&gt;&lt;/p&gt;&lt;blockquote style=&quot;font-weight: bold; color: rgb(51, 204, 0);&quot;&gt;&lt;span style=&quot;font-size:180%;&quot;&gt;T&lt;/span&gt;hi&lt;span style=&quot;font-size:100%;&quot;&gt;s is the first in a series of articles describing experiments conducted to  learn more about optimizing web page performance. You may be wondering why  you’re reading a performance article on the http://web-performance-research.blogspot.com. It turns out that most of  web page performance is affected by front-end engineering, that is, the user  interface design and development.&lt;/span&gt;&lt;/blockquote&gt;&lt;span style=&quot;;font-family:verdana;font-size:100%;&quot;  &gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;p  style=&quot;color: rgb(51, 102, 255);font-family:arial;&quot;&gt;&lt;span style=&quot;color: rgb(255, 255, 255);font-size:100%;&quot; &gt;I&lt;/span&gt;&lt;span style=&quot;color: rgb(255, 255, 204);font-size:100%;&quot; &gt;t’s no secret that users prefer faster web sites. I work in a dedicated team  focused on quantifying and improving the performance of Yahoo! products  worldwide. As part of our work, we conduct experiments related to web page  performance. We are sharing our findings so that other front-end engineers join  us in accelerating the user experience on the web.&lt;/span&gt;&lt;/p&gt; &lt;h3 style=&quot;color: rgb(255, 255, 204); font-family: verdana;&quot; id=&quot;the-80-20-rule&quot;&gt;The 80/20 Performance Rule:&lt;/h3&gt; &lt;p style=&quot;color: rgb(255, 255, 204); font-family: verdana;&quot; id=&quot;pareto&quot;&gt;Vilfredo Pareto, an economist in the early 1900s, made a famous  observation where 80% of the nation’s wealth belonged to 20% of the population.  This was later generalized into what’s commonly referred to as the Pareto  principle (also known as the 80-20 rule), which states for any phenomenon, 80%  of the consequences come from 20% of the causes. We see this phenomenon in  software engineering where 80% of the time is spent in only 20% of the code.  When we optimize our applications, we know to focus on that 20% of the code.  This same technique should also be applied when optimizing web pages. Most  performance optimization today are made on the parts that generate the HTML  document (apache, C++, databases, etc.), but those parts only contribute to  about 20% of the user’s response time. It’s better to focus on optimizing the  parts that contribute to the other 80%.&lt;/p&gt; &lt;p  style=&quot;color: rgb(255, 255, 255);font-family:arial;&quot; id=&quot;figure1&quot;&gt;&lt;span style=&quot;color: rgb(51, 102, 255);&quot;&gt;&lt;br /&gt;&lt;/span&gt; &lt;/p&gt;&lt;br /&gt;&lt;p style=&quot;color: rgb(255, 255, 204); font-family: verdana;&quot; face=&quot;arial&quot;&gt;&lt;/p&gt;&lt;h4 style=&quot;font-family: verdana; color: rgb(255, 255, 204);&quot; class=&quot;caption&quot;&gt;Figure 1.&lt;br /&gt;&lt;/h4&gt;&lt;br /&gt;&lt;p face=&quot;arial&quot; style=&quot;color: rgb(255, 255, 204); font-family: verdana;&quot;&gt;&lt;img style=&quot;width: 401px; height: 355px;&quot; class=&quot;figure&quot; id=&quot;pageload&quot; alt=&quot;Figure 1. Loading http://www.yahoo.com&quot; src=&quot;http://yuiblog.com/assets/performance/pageload.gif&quot; longdesc=&quot;This image is a chart showing the sequential loading of the 29 components that make up the yahoo.com homepage. The first component is the html itself, and which only takes 0.24 seconds. The remaining 28 items are images, scripts, and stylesheets. The takeaway from the graphic is that nearly all the time is on subsequent requests, not the initial server response.&quot; /&gt;&lt;/p&gt;&lt;br /&gt;&lt;p face=&quot;arial&quot; style=&quot;color: rgb(255, 255, 204); font-family: verdana;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;&lt;p  style=&quot;color: rgb(255, 255, 204);font-family:verdana;&quot;&gt;&lt;span style=&quot;color: rgb(51, 102, 255);&quot;&gt;&lt;span style=&quot;color: rgb(255, 255, 255);&quot;&gt;Using a packet sniffer, we discover what takes place in that other 80%. Figure 1 is a graphical view of where the time is spent loading http://www.yahoo.com with an empty cache. Each bar represents a specific component and is shown in the order started by the browser. The first bar is the time spent for the browser to retrieve just the HTML document. Notice only 10% of the time is spent here for the browser to request the HTML page, and for apache to stitch together the HTML and return the response back to the browser. The other 90% of the time is spent fetching other components in the page including images, scripts and stylesheets. &lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p  style=&quot;color: rgb(255, 255, 204);font-family:verdana;&quot;&gt;&lt;span style=&quot;color: rgb(51, 102, 255);&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;color: rgb(255, 255, 204); font-family: verdana;&quot; id=&quot;table1&quot;&gt;Table 1 shows popular web sites spending between 5% and 38% of the  time downloading the HTML document. The other 62% to 95% of the time is spent  making HTTP requests to fetch all the components in that HTML document (i.e.  images, scripts, and stylesheets). The impact of having many components in the  page is exacerbated by the fact that browsers download only two or four  components in parallel per hostname, depending on the HTTP version of the  response and the user’s browser. Our experience shows that reducing the number  of HTTP requests has the biggest impact on reducing response time and is often  the easiest performance improvement to make.&lt;/p&gt; &lt;div style=&quot;color: rgb(255, 255, 204); font-family: verdana;&quot; class=&quot;figure&quot; id=&quot;loading-popular-web-sites&quot;&gt; &lt;table style=&quot;width: 488px; height: 273px;&quot; class=&quot;chart&quot; id=&quot;time-spent-loading-popular-web-sites&quot;&gt; &lt;caption style=&quot;font-weight: bold;&quot;&gt;Table 1. Time spent loading popular web sites&lt;/caption&gt; &lt;tbody&gt; &lt;tr&gt; &lt;td style=&quot;font-weight: bold;&quot; class=&quot;empty&quot;&gt;&lt;br /&gt;&lt;/td&gt; &lt;th style=&quot;font-weight: bold;&quot;&gt;Time Retrieving&lt;br /&gt;HTML&lt;/th&gt; &lt;th style=&quot;font-weight: bold;&quot;&gt;Time&lt;br /&gt;Elsewhere&lt;/th&gt;&lt;/tr&gt; &lt;tr&gt; &lt;th style=&quot;font-weight: bold;&quot;&gt;Yahoo!&lt;/th&gt; &lt;td style=&quot;font-weight: bold;&quot;&gt;               10%&lt;/td&gt; &lt;td style=&quot;font-weight: bold;&quot;&gt;        90%&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;th style=&quot;font-weight: bold;&quot;&gt;Google&lt;/th&gt; &lt;td style=&quot;font-weight: bold;&quot;&gt;               25%&lt;/td&gt; &lt;td style=&quot;font-weight: bold;&quot;&gt;        75%&lt;/td&gt;&lt;/tr&gt;  &lt;tr&gt; &lt;th style=&quot;font-weight: bold;&quot;&gt;MSN&lt;/th&gt; &lt;td style=&quot;font-weight: bold;&quot;&gt;                 5%&lt;/td&gt; &lt;td style=&quot;font-weight: bold;&quot;&gt;        95%&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;th style=&quot;font-weight: bold;&quot;&gt;ebay&lt;/th&gt; &lt;td style=&quot;font-weight: bold;&quot;&gt;                 5%&lt;/td&gt; &lt;td style=&quot;font-weight: bold;&quot;&gt;        95%&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;th style=&quot;font-weight: bold;&quot;&gt;Amazon&lt;/th&gt; &lt;td style=&quot;font-weight: bold;&quot;&gt;              38%&lt;/td&gt; &lt;td style=&quot;font-weight: bold;&quot;&gt;        62%&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;th style=&quot;font-weight: bold;&quot;&gt;YouTube&lt;/th&gt; &lt;td style=&quot;font-weight: bold;&quot;&gt;                9%&lt;/td&gt; &lt;td style=&quot;font-weight: bold;&quot;&gt;        91%&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;th style=&quot;font-weight: bold;&quot;&gt;CNN&lt;/th&gt; &lt;td style=&quot;font-weight: bold;&quot;&gt;              15%&lt;/td&gt; &lt;td style=&quot;font-weight: bold;&quot;&gt;        85%&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt; &lt;p class=&quot;gloss&quot;&gt;&lt;strong&gt;Note: &lt;/strong&gt;Times are for page loads with an empty  cache over Comcast cable modem (~2.5 mbps).&lt;/p&gt;&lt;/div&gt;&lt;p style=&quot;font-family: arial;&quot;&gt;&lt;span style=&quot;font-size:100%;&quot;&gt;&lt;/span&gt;&lt;/p&gt;&lt;blockquote&gt;&lt;/blockquote&gt;&lt;span style=&quot;font-size:100%;&quot;&gt;&lt;/span&gt;&lt;p&gt;&lt;/p&gt;</description><link>http://web-performance-research.blogspot.com/2008/05/performance-research-part-1-what-8020.html</link><author>noreply@blogger.com (Sekhar Veernapu)</author><thr:total>0</thr:total></item></channel></rss>