Feeds

Google advises flushing your website

Lessons in load time

Maximizing your infrastructure through virtualization

Web 2.0 Expo Steve Souders is the sort of person who spends his Saturday afternoons measuring website load-times. "You might watch football games," he says. "I watch websites load."

After founding the Exceptional Performance Group at Yahoo! - an effort to improve website speed from the websurfer's point of view - Souders now does similar work inside the Google Chocolate Factory. And on Thursday afternoon, he trumpeted his newest load-time tricks at Tim 2.0'Reilly's Web 2.0 Expo in downtown San Francisco.

Souder's over-arching philosophy is that the best way to improve load-times is to focus on front-end performance. When the typical webpage loads, he says, between 80 and 90 per cent of the wait time occurs after the html document has already arrived.

"In that html document is a manifest where the web developer has dictated what else should be dictated in what order," he told gathered dev types this afternoon, pointing to some typical load-time stats for iGoogle.

"Only about nine per cent of the time the user waits for the page to load is spent getting that html document. The other 91 per cent is all other activity that's driven by client - other http requests have to be made, CSS has to be parsed and applied, JavaScript has to be executed, etc."

Even with a primed cache, only about 17 per cent of iGoogle's wait time is spent on html.

With his 2007 book High Performance Web Sites, Souders detailed fourteen rules for improving front-end performance - yes, it's a Tim 2.0'Reilly tome - and he's now prepping a second book that lays out a whole new bag of tricks.

One of these is best applied to those websites that belie Souder's Performance Golden Rule: sites like Facebook take an unusually long time delivering html. "A page like Facebook takes a long time to do all the database queries to find all your friends and all their comments and all the feeds and stitch everything together. You might have that page spending 30 to 50 per cent of the overall load time just getting the html document."

With such sites, Souder suggests that developers lean the "flush" function available from most popular web programming languages, including PHP, Perl, Python, and Ruby on Rails. With flush - "autoflush" in Perl and "ios.flush" in Ruby - you can start sending your html before the entire document is queued up.

"You can can get enough of the html to the browser so that the browser can parse it and start downloading other resources even though the rest of the html is still being stitched together on the back-end," Souder said. "What flush does is it says 'Whatever you have queued up, send it down to the browser right now.'"

Souders also has a new-found obsession with simplifying CSS (cascading style sheet) selectors. He urges developers to avoid universal, descendant, and tag-child selectors, while sidestepping qualifiers for ID and class selectors.

And when using CSS, he says, you should avoid the @import rule, a way of creating a style sheet within a document and then importing additional rules. If used incorrectly, as Souder says it so often is, @import is a particular drag when pages are loaded on Internet Explorer, which may delay other scripts and other style sheets and scripts until an @import style sheet is loaded in-full.

You can read all his esoteric CSS advice here (PowerPoint).

According to Googler Steve Souder, Google is the only top-ten web property that has bothered to flush its html early. But he's not one to avoid criticizing his employer. He isn't exactly pleased with the drag that Google Analytics and Google AdSense put on third-party websites across the web. But, apparently, he's "working on it." ®

Bootnote

While at Yahoo!, Souders developed a tool known as YSlow that automatically measures website load-times. You can download it here. ®

Reducing security risks from open source software

More from The Register

next story
HIDDEN packet sniffer spy tech in MILLIONS of iPhones, iPads – expert
Don't panic though – Apple's backdoor is not wide open to all, guru tells us
Do YOU work at Microsoft? Um. Are you SURE about that?
Nokia and marketing types first to get the bullet, says report
Microsoft takes on Chromebook with low-cost Windows laptops
Redmond's chief salesman: We're taking 'hard' decisions
Cheer up, Nokia fans. It can start making mobes again in 18 months
The real winner of the Nokia sale is *drumroll* ... Nokia
EU dons gloves, pokes Google's deals with Android mobe makers
El Reg cops a squint at investigatory letters
Chrome browser has been DRAINING PC batteries for YEARS
Google is only now fixing ancient, energy-sapping bug
Big Blue Apple: IBM to sell iPads, iPhones to enterprises
iOS/2 gear loaded with apps for big biz ... uh oh BlackBerry
prev story

Whitepapers

Seven Steps to Software Security
Seven practical steps you can begin to take today to secure your applications and prevent the damages a successful cyber-attack can cause.
Consolidation: The Foundation for IT Business Transformation
In this whitepaper learn how effective consolidation of IT and business resources can enable multiple, meaningful business benefits.
Designing a Defense for Mobile Applications
Learn about the various considerations for defending mobile applications - from the application architecture itself to the myriad testing technologies.
Build a business case: developing custom apps
Learn how to maximize the value of custom applications by accelerating and simplifying their development.
Consolidation: the foundation for IT and business transformation
In this whitepaper learn how effective consolidation of IT and business resources can enable multiple, meaningful business benefits.