Slashdot Mirror


Optimizing Page Load Times

John Callender writes, "Google engineer Aaron Hopkins has written an interesting analysis of optimizing page load time. Hopkins simulated connections to a web page consisting of many small objects (HTML file, images, external javascript and CSS files, etc.), and looked at how things like browser settings and request size affect perceived performance. Among his findings: For web pages consisting of many small objects, performance often bottlenecks on upload speed, rather than download speed. Also, by spreading static content across four different hostnames, site operators can achieve dramatic improvements in perceived performance."

9 of 186 comments (clear)

  1. HTTP Pipelining by onion2k · · Score: 5, Informative

    If the user were to enable pipelining in his browser (such as setting Firefox's network.http.pipelining in about:config), the number of hostnames we use wouldn't matter, and he'd make even more effective use of his available bandwidth. But we can't control that server-side.

    For those that don't know what that means: http://www.mozilla.org/projects/netlib/http/pipeli ning-faq.html

    I've had it switched on for ages. I sometimes wonder why it's off by default.

    1. Re:HTTP Pipelining by baadger · · Score: 4, Interesting
      This is NOT just Opera fanboyism, but Opera however *does* do pipelining by default (with a safe fallback)

      Opera pipelines by default - and uses heuristics to control the level of pipelining employed depending on the server Opera is connected to
      Reference
  2. HTTP/1.1 Design by keithmo · · Score: 5, Insightful

    From TFA:

    By default, IE allows only two outstanding connections per hostname when talking to HTTP/1.1 servers or eight-ish outstanding connections total. Firefox has similar limits.

    And:

    If your users regularly load a dozen or more uncached or uncachable objects per page load, consider evenly spreading those objects over four hostnames. Due to browser oddness, this usually means your users can have 4x as many outstanding connections to you.

    From RFC 2616, section 8.1.4:

    Clients that use persistent connections SHOULD limit the number of simultaneous connections that they maintain to a given server. A single-user client SHOULD NOT maintain more than 2 connections with any server or proxy.

    It's not a browser quirk, it's specified behavior.

    1. Re:HTTP/1.1 Design by x2A · · Score: 4, Interesting

      The limit's not to do with your connection speed as such - it's to do with being polite and not putting too much drain on the server your downloading from.

      --
      The revolution will not be televised... but it will have a page on Wikipedia
  3. Css and Scripts by Gopal.V · · Score: 5, Informative

    I've done some benchmarks and measurements in the past which will never be made public (I work for Yahoo!). And the most important bits in those have been CSS and Scripts. A lot of performance has been squeezed out of the HTTP layers (akamai, Expires headers), but not enough attention has been paid to the render section of the experience. You could possibly reproduce the benchmarks with a php script which does a sleep() for a few seconds to introduce delays at various points and with a weekend to waste.

    The page does not start rendering till the last CSS stream is completed, which means if your css has @import url() entries, the delay before render increases (until that file is pulled & parsed too). It really pays to have the quickest load for the css data over anything else - because without it, all you'll get it a blank page for a while.

    Scripts marked defer do not always defer and a lot of inline code in <script> tags depend on such scripts that a lot of browsers just pull the scripts as and when they find it. There seems to be just two threads downloading data in parallel (from one hostname), which means a couple of large (but rarely used) scripts in the code will block the rest of the css/image fetches. See flickr's organizr for an example of that in action.

    You should understand that these resources have different priorities in the render land and you should really only venture here after you've optimized the other bits (server and application).

    All said and done, good tutorial by Aaron Hopkins - a lot of us have had to rediscover all that (& more) by ourselves.

  4. Caching of dynamic content by baadger · · Score: 4, Insightful

    This is a good place to start testing the 'cacheability' of your dynamic web pages. Quite frankly it's appauling that even the big common web apps used today like most forum or blog scripts don't generate sensible Last-Modified, Vary, Expires, Cache-Control headers. With most of the metadata you need to generate this stuff stored in the existing database scheme theres just really no excuse for it.

    Abolishment of nasty long query strings into nicer, more memorable URI's is also something we should be seeing more of in "Web 2.0." Use mod_rewrite, you'll feel better for it.

  5. Those tenths of seconds add up by giafly · · Score: 4, Informative

    If a big part of your job involves using a Web-based application, reducing page-load times really helps. My real job is writing one of these applications and getting the caching right is much more important than sexier topics like AJAX. There's some good advice in TFA.

    --
    Reduce, reuse, cycle
  6. Re:Simulation software available? by ggvaidya · · Score: 4, Interesting

    You could try using Sloppy. I've only ever heard about it because its programmer has a very nice page on getting a free Thwarte FreeMail certificate to work with Java WebStart, so this isn't a recommendation or anything. Looks pretty decent, though.

  7. Re:Pipelining by TheThiefMaster · · Score: 4, Informative

    Pipelining is not keep-alive. Keep alive means sending multiple requests down one connection, waiting for the response to the request before sending the next. Pipelining sends all the requests at once without waiting.

    Keep-alive no:
    Open connection
    -Request
    -Response
    Close Connection
    Open connection
    -Request
    -Response
    Close Connection
    -Repeat-

    Keep-alive yes:
    Open connection
    -Request
    -Response
    -Request
    -Response
    -Repeat-
    Close Connection

    Pipe-lining yes:
    Open connection
    -Request
    -Request
    -Repeat-
    -Response
    -Response
    -Repeat-
    Close Connection