Showing posts with label Performance. Show all posts
Showing posts with label Performance. Show all posts
Free, online, open-source book on web performance - Book of Speed

Free, online, open-source book on web performance - Book of Speed

Stoyan Stefanov, a web performance expert, Facebook engineer, ex-Yahoo, smush.it creator & YSlow 2.0 architect, has released the draft of Book of Speed for free & public access. Currently 5 of the planned 9 chapters are online.

In his blog post announcing the release, he also mentions another free, online JavaScript resource by Marijn Haverbeke - Eloquent JavaScript


Read More

WebPageTest Tips & Tricks

WebPageTest is a powerful online web performance testing & analysis tool that has been adding a lot of interesting new features.  Their list of test locations to check a page from is growing (currently 17) & now includes Delhi, India. It makes it easy to do "what-if" testing on production pages by showing what performance gains can be achieved by removing ads, widgets, JavaScript. It looks simple on the surface but once you start poking around Advanced Settings & see its analytical review of web pages you test, you'll wonder how it's even free.

I highly recommend this tool to web developers who want to improve performance of the web pages they build.

If you never tried this tool or gone through it superficially, check Patrick Meenan's video to get started and learn directly from the creator of the tool.
Read More

Web Performance Testing - Interpreting a Waterfall Chart

Some native browser Developer tools & external  web performance analysis tools  visualize data that is generated by the series of actions that occur between a user and the server from the time a request is made till it is completely delivered, through HTTP Waterfall charts



Joshua Bixby's Waterfalls 101 article explains in plain-English the parts of the Waterfall chart & how to analyze it.
Read More

Add DOM Monster to your collection of Web Perf Analysis & Optimization tools

If you like web page performance analysis & optimization tools like YSlow, you will love DOM Monster (thanks @souders)

"DOM Monster is a cross-platform, cross-browser bookmarklet that will analyze the DOM & other features of the page you're on, and give you its bill of health."

The good thing about this tool is that you wouldn't have to update it when a new version comes out as it is in the form of a bookmarklet.
DOM Monster suggestions for a ASP.NET Forums page (click to enlarge)
Read More
HOW TO monitor performance and availability status of  public APIs & websites

HOW TO monitor performance and availability status of public APIs & websites

If you use Public APIs (like Bing Search, Google Maps APIs) in your applications, it helps to be aware of performance and availability issues that those services may face.

Thankfully, there are some free tools that monitor popular APIs & websites -
Also see:
How LARGE websites manage performance & scalability
Read More

jQuery on CDN - Usage Stats

Dave Ward has done an informal study on the top 200,000 sites identified by Alexa to find which of those sites use a public jQuery CDN. His findings:
  • 47 of the Alexa top 1,000 include a Google CDN reference.
  • 99 of the Alexa top 2,000 reference jQuery on the Google CDN.
  • 6,953 of the top 200,000 sites include a script reference to some version of jQuery hosted on Google’s CDN.
  • 989 of the Alexa top 200,000 sites reference jQuery UI on the Google CDN.
Dave recommends keeping your site’s CDN reference updated to the latest compatible version of jQuery for more performance gains. This is because popular sites generally upgrade to the latest stable version & sites must reference exactly the same CDN URL in order to obtain the cross-site caching benefit.

Google CDN hosts:

Microsoft Ajax CDN hosts:

(details as of Sep, 2010)

As per the BuiltWith.com website (which tracks technology usage trends), nearly 37% of the top 10,000 sites currently use jQuery in any form (not just from the CDN)


Also see:
jQuery Tips, Tricks, Trivia
Web apps in less than 10 KB
Popular JavaScript apps dissected
Read More
HOW TO make your website mobile-friendly

HOW TO make your website mobile-friendly

Gartner research predicts that by 2013, mobile phones will overtake PCs as the most common Web access device worldwide. Bruce Lawson offers 3 strategies in a Dev Opera article to "mobilise" a web site to work across all devices i.e. not just mobiles but also alternative browsing devices like games consoles (Nintendo Wii, DSi), web-enabled TVs, in-car browsers etc -


Strategy #1: Code well and do nothing special for mobile - The current crop of advanced mobile browsers are very good at rearranging content without being told how to by a developer...Making a good semi-liquid layout that has a min-width and max-width set in your CSS and em-based typography will work very well across a range of different devices and screen sizes.

Strategy #2: Make a separate mobile site - .. (although) it results in having two sites to user-test, maintain, etc

Strategy #3: Build mobile-aware adaptive sites - hardest to pull-off methodology... (but) future-proof as it tests features rather than sniffing browsers.

There are also numerous mobile web optimization tips in that article -
  • Combine files and reduce requests across the network
  • Put script elements as far down as possible in the source
  • State the dimensions of images in the HTML
  • Opera users can sign up for seven free hours of testing on Perfecto Mobile service that lets you test on real handsets via the Internet

.. and interesting facts -

Smartphones can run full Web browsers such as Opera Mobile or Safari/iPhone, while in the developing world we see much lower-end handsets that don’t have an operating system but, if they can run Java they can use Opera Mini (a thin client for a proxy-based system that compresses pages down to about 10% of their original size before being sent to the handset for rendering — see our comparison of Opera Mobile and Opera Mini)

Also see:
Jason Grigsby’s DOs and DON’Ts of Mobile Strategy
Visual tags: Microsoft Tag vs QR Code
Read More
Web Metrics from a Google Study

Web Metrics from a Google Study

A Google study based on "a sample of several billions of pages" reveals interesting statistics about the size, number of resources and other such metrics of pages on the world wide web.

Highlights:

  • The average web page takes up 320 KB on the wire.
  • Only two-thirds of the compressible material on a page is actually compressed.
  • In 80% of pages, 10 or more resources are loaded from a single host.
  • The most popular sites could eliminate more than 8 HTTP requests per page if they combined all scripts on the same host into one and all stylesheets on the same host into one.

It comes with some caveats. Thanks Annie Sullivan

There are simple tricks & free Web Performance Analysis & Optimization tools to overcome these speed barriers & make the web overall faster


Also see:

Web Security Tutorials from Google & MS
Google Browser Security Handbook

15
Read More

HOW TO reduce the file size of images

Now that Google slightly rewards lighter web-pages (of course relevance of a page matters most) with a better ranking, it helps to trim down the file size of images within it without reducing their quality so that the  page loads faster.

There are numerous ways & tools to reduce the file size but the one that I found most useful is the free image editor Paint.NET's dynamic file resizing feature.

Whenever you save a new image in Paint.NET as a Bitmap, GIF, JPEG or PNG, it shows you a preview of that image alongwith the file size before it actually saves the file & lets you change image settings to modify the file size or quality.

You can also open an existing image within Paint.NET & control image settings from the File > Save As step.

You can not just control file size but also image dimensions easily with the Image > Resize (Ctrl + R) menu option.

Also see:
HOW TO implement online cropping feature for uploaded Images
90
Read More

New features of WebPageTest

WebPageTest.org is a free online version of AOL's open source performance analysis & optimization tool PageTest (which you can deploy on your own server).

The new features of WebPageTest were demo'ed at Velocity 2010 Lightning Demos session.

One distinct feature in PageTest is Visual Performance comparision. A Waterfall chart is what most web performance analysis tools show. With PageTest you can see how your web page actually looked like at small intervals while it was still loading. You can choose between a Film-strip view & Full-motion video to know what your site visitors see when they access a web page on your website.


WebPageTest now offers more test locations, custom bandwidth configuration, browser resource utilization info (CPU & Network bandwidth) and support for HAR (HTTP Archive Specification)

HAR is an open format for archiving & exchange performance results between web performance analysis tools. The current list of tools that support HAR is here.

Related:
HOW TO measure page load times across continents for free
120
Read More
HTTP Traffic Export options in Fiddler

HTTP Traffic Export options in Fiddler

I've been taking notes from Eric Lawrence's recorded presentation at MIX10 on Fiddler for future reference. This is the fourth part, check the earlier three tips if you haven't already read them -
To share HTTP traffic debugging information, Fiddler offers 10 ways to export HTTP traffic -
  1. Copy sessions to the clipboard - right-click & copy headers, URL or entire session info
  2. Store as a plain-text file
  3. Extract binary response bodies
  4. Archive to a database
  5. Export a Visual Studio .WebTest file - Visual Studio Web Test is a Visual Studio Team System feature that allows playback
  6. Write your own - fully scriptable, so you can write your own exporters
  7. Fiddler's native "Session Archive ZIP" (SAZ) format
  8. HTTP Archive JSON (v1.1 & v1.2) - The two HTTP Archive JSON formats (*.har) are supported by a growing list of open-source and commercial tools and web services.
  9. WCAT Load Test Script - Microsoft Web Capacity Analysis Tool (WCAT) can simulate thousands of concurrent users making requests to a single web site or multiple web sites. A script exported from Fiddler can be loaded in WCAT & previously-captured requests can be replayed for functional-testing and load-testing purposes.
  10. Raw Files - this export format allows you to easily dump captured response files to a folder on disk; this allows you to easily collect audio, video, or image files for instance.

The introduction of HTTP Archive spec (*.har) support means than you can run an archive file generated by Fiddler in Firebug or similar tools like HTTPWatch,  and vice versa. As Steve Souders says,

With the adoption of HAR ..., we’re moving to having a record of the page load experience that can be saved and shared, and performance analysis that is consistent regardless of what browser and development environment you work in.

180
Read More

Velocity 2010 Videos & Slides

If you find Web Performance exciting, you shouldn't miss watching the Velocity 2010 videos & slides.

Velocity is an annual Web Performance and Operations conference conducted by O'Reilly Media.

There are a lot of speed tips, suprising facts & interesting thoughts shared by experts. Did you know, seventy five percent of that traffic comes through third-party apps via the Twitter API rather than the Twitter.com web site? Twitter manages 700 million searches & 65 million tweets a day. There are sessions by folks from Facebook and Twitter on how they scale to millions of users.

The list of videos also includes Lightning Demos of Web Performance & Analysis tools like HttpWatch, AOL Pagetest, Speed Tracer, Fiddler, dynaTrace, Firebug, YSlow, and Page Speed by people directly involved with the development of those tools.

Among the few I watched already, I liked Lenny Rachitsky's "The Upside of Downtime: How to Turn a Disaster Into an Opportunity". Taking a contrarian view, he says downtime can be an opportunity to build trust.


Also see:
Free Web Performance Analysis & Optimization tools
180
Read More

FiddlerCap makes HTTP Traffic Capture easier

As a web developer, if you would like to debug HTTP traffic of web pages that your site users are having problem with, you can have the end-users record the traffic details as a Session Archive Zip (.SAZ) file & then send it to you.

Talking about Traffic Import options with Fiddler in his session titled "Advanced Web Debugging with Fiddler" at MIX10, Eric Lawrence highlights a lesser known tool called FiddlerCap. For non-technical folks, FiddlerCap Web Recorder is a lightweight version of Fiddler that's easier to use than Fiddler. The interface is more intuitive with Start Capture, Stop Capture, Save Capture buttons.

IE9 is going to have a Network tab like Firebug under Developer Tools (accessible through the menu or F12 key). The traffic details collected through the IE9 Network tab can be exported in a soon to be standardized format called HAR (or HTTP Archive Specification). The XML version of the HAR format file that is emitted by can be opened within Fiddler for analysis. As more tools start respecting the HAR format, the Web Performance Analysis & Optimization tools will be able to exchange information seamlessly.
180
Read More

Track HTTP traffic in Firefox with FiddlerHook

Eric Lawrence, the creator of Fiddler (his side project since 8 years) & an Internet Explorer Program Manager at MS, presented an interesting session titled "Advanced Web Debugging with Fiddler" at MIX10. I have gone through the half-hour breezy presentation and also downloaded it (.WMV version is 68.2MB) so that I can watch it again to digest & try out the many tips discussed in it. I plan to blog about the tips that Eric shared in his presentation with my own observations, starting with this one. I agree with him when he says "people are using Fiddler in a shallow way" as I'm one among them (having started using it on & off since 2005). Although the documentation is pretty good, I guess there should be more ways of creating awareness. I found that Fiddler now has a dedicated blog on MSDN & a Discussion Group.

While current versions of Internet Explorer, Google Chrome, Apple Safari, and Opera all automatically use Fiddler when Fiddler is configured to capture HTTP traffic, Firefox is the only browser which does not use the System Proxy settings by default. So you can manually configure Firefox to point at Fiddler or better still, take advantage of the FiddlerHook Firefox add-on that lets you toggle Fiddler use with Firefox.

When you install Fiddler, FiddlerHook add-on gets installed as well. When I installed the latest version of Fiddler (v 2.2.9.4 beta) on a PC with Vista & Firefox 3.0, I did not see FiddlerHook in the menu under Tools or in the Firefox Add-ons/Extensions list. I suspected this could have been because I had already opened Firefox while installing Fiddler. I also wondered about what Firefox versions this Extension works on. My suspicion was confirmed when I re-installed Fiddler without having Firefox open and bingo...the Extension appears! Eric mentions in his talk that FiddlerHook works on Firefox 3.0 & above.


Whenever you need to debug HTTP traffic in Firefox, you can adjust your FiddlerHook preferences in the status bar or from the Tools > Monitor with Fiddler menu option. For easier access, you can add the "Launch Fiddler" button to your toolbar by right-clicking the Firefox toolbar, choosing Customize & dragging the Fiddler icon in the dialog box that appears to a preferred position in the toolbar.


Also see:
Web Performance Analysis & Optimization tools
180
Read More
Building blazing fast Web pages

Building blazing fast Web pages

Everyone loves fast loading pages but building such pages requires care & implementing best practices. Some best practices only provide minor benefits but when put together the performance gain is significant.

Steve Souders, the author of "High Performance Web Sites", who champions the cause of building faster Web pages & thereby a better Web, shares 3 new tricks to speed up loading web pages -
  • Specify a Character Set at the very top of your HTML document - Browsers take a performance hit of varying severity when you fail to specify it. A META tag specifying the charset should ideally be the first element inside the HEAD tag.
  • Minify HTML
  • Minimize HTTP Request Size - If the total size of the request headers exceed one packet (~1500 bytes), a roundtrip is required just to submit the request thereby hurting performance.
These "rules" are now part of Google's YSlow clone, Page Speed 1.6 Beta Firefox plugin

Also see:
What is "domain sharding"
HOW TO improve the front-end performance of a website
Read More
Learning Resources for Building High Performance Websites

Learning Resources for Building High Performance Websites

I have high regard for Steve Souders & Peter-Paul Koch. Their knowledge and contributions to the Web Development community are exemplary. Steve is the man behind YSlow, a nifty tool that analyzes web pages and tells you why they're slow based on the rules for high performance web sites.

Steve recently finished teaching a course on High Performance Web Sites at Stanford. He has graciously shared the material from the class on the class web site & also interesting guest lectures. All these resources are great fodder for web developers.

As part of their course, the students studied popular websites to identify performance issues in them. Their findings confirm that websites that follow Performance best practices have a high YSlow Grade and load the fastest. Craigslist.org (YSlow Grade:96) & Windows Live (YSlow Grade:94) top their charts while Fox News Channel (YSlow Grade:24) & ESPN (YSlow Grade:28) are at the bottom.

The Q&A from the Midterm Exam & Final Exam are good brain teasers. Sample this -
How many connections per hostname is suggested in the HTTP spec? Do the five most popular browsers follow this recommendation?
2
no, Firefox 3, IE8, Safari 3.1+, Opera 9.60, and Chrome all support 4 or more. IE6 & 7 are still 2.

What are the two request headers that can be used to determine if a cached resource is valid (i.e., used as part of a Conditional GET request)? If the resource is valid, what status code does the web server return?
If-Modified-Since, If-None-Match
304 Not Modified ("304" and "Not Modified" are also valid answers)

Name three potential drawbacks to using a CDN, and a way to mitigate these drawbacks.
your performance can be affected by your competitors, you don't have direct control, if the CDN's performance degrades so does yours
you can use two CDNs to hedge your bets

Name two browsers (including major version #) that support parallel script loading?
IE8, Safari 4 are the biggies. Also Android 1, iPhone 2, Konqueror 4, Opera 9, and some Blackberries.

How much does gzip compression typically reduce transfer sizes?
70%

Which trigger busy indicators?
script in iframe
script DOM element
script defer
document.write script tag

What's the benefit of splitting resource downloads across multiple domains? In general, how many domains should you shard across?
You can get more parallel downloads by splitting resources across multiple domains. The ideal number of domains is 2-4.

List two pros and two cons of using iframes.
pros:
embedding content from another web site
sandboxing 3rd party JavaScript
asynchronous loading of external scripts

cons:
most expensive DOM element
blocks parent's onload

List the seven types of CSS selectors and give an example of each.
ID: #navbar {}
class: .navbar {}
type: A {}
descendant: UL LI {}
child: UL > LI {}
adjacent sibling: UL + P {}
universal: [color: red] {}

Also see:
HOW TO improve the front-end performance of a website - II
Read More
Geek Talk

Geek Talk

If you love geek talk, check out Scott Hanselman's podcasts. The PDF transcripts for it are also available. He picks an unusual but interesting technical topic each time & discusses them with experts. The conversations are engaging and generate a lot of insightful thoughts to ponder about.

I liked a recent episode where Richard Campbell and Scott shared war stories about scaling large websites.

Excerpts:
I'm consistently surprised at how many sites don't have a geographic failover.

So, what is the difference between a performance problem and a scale problem?
Well, I think most people see scaling problems manifest as perceived performance problems.

When someone tries to start aggressively caching, whether that be output cache or formally caching from a business perspective, there's this Cartesian product that happens.

I like the idea of being able to attribute something or mark something and have it handled because this is a common pattern and anytime something is a common pattern, I expect the best practice to be embodied within the library.

..if you start thinking about performance early on, you always get accused of being a premature optimizer.

dasBlog is an interesting application because we don't have a database.....Everything in dasBlog is stored in XML.

You know, what I like to do is I turn it (ViewState) off completely and then turn it on.

While, Microsoft, now that I'm starting to understand what they think about, they have to make that distinction between speed of development versus the expectation of the developer. They wanted ASP.NET to just be one of those things where I can drag a button onto a page and it works.

One of my favorite defaults and I've talked about this in sessions all the time that people a) don't know about, but b) when you really think about it realize it's a good default, but seems totally non-sensical is ASP.NET's default worker process restart is 23 hours. That's the default setting for a cold install of IIS. Every 23 hours, restart the worker process.

The MSDN "Geek Speak" Webcast series is another good resource.
Read More
Which is better - EXISTS check or SELECT COUNT(*) ?

Which is better - EXISTS check or SELECT COUNT(*) ?

A nice explanation from a detailed article in SQLMag -
Using the T-SQL EXISTS keyword to perform an existence check is almost always faster than using COUNT(*). EXISTS can stop as soon as the logical test proves true, but COUNT(*) must count every row, even after it knows one row has passed the test.

I like collecting tips like these to supplement the numerous tips, tricks & checklists in the (freely downloadable) Patterns & Practices guide "Improving .NET Application Performance and Scalability". I wish they upgraded this .NET bible to include the advances that have happened since the guide was published in 2004.
Read More