August 2017
« May    



Recent Posts


asp .net asp .net membership browsers computer crash Guy Burstein javascript link-o-rama LINQ office 2007 optimization outlook 2007 performance ScottGu SQL Server t-sql web servers workarounds xmlhttprequest

« ASP .NET Membership: Where’s the UserID? | Main | SQL Server 2005’s Pivot…PIVOT, PIVVOOOOT – Ross Gellar, Friends »

Vroom, vrooom…. aka Making Pages Load Faster

By juliana | May 7, 2008

Optimizing Page Load Time []
Best Practicies for Speeding up your Web Site [Yahoo]

Interesting stuff, some excerpts for own reference below the more tag.

Hopkins (from first link) suggests trying:

Try some of the following:

  • Turn on HTTP keepalives for external objects. Otherwise you add an
    extra round-trip to do another TCP three-way handshake for every HTTP request. If you are worried about hitting global server connection limits, set the keepalive timeout to something short, like 5-10 seconds. Also look into serving your static content from a different webserver than your dynamic content. Having thousands of connections open to a stripped down static file webserver can happen in like 10 megs of RAM total, whereas your main webserver might easily eat 10 megs of RAM per connection.
  • Load fewer external objects. Due to request overhead, one bigger file just loads faster than two smaller ones half its size. Figure out how to globally reference the same one or two javascript files and one or two external stylesheets instead of many; if you have more, try preprocessing them when you publish them. If your UI uses dozens of tiny GIFs all over the place, consider switching to a much cleaner CSS-based design which probably won’t need so many images. Or load all of your common UI images in one request using a technique called “CSS sprites“.
  • If your users regularly load a dozen or more uncached or uncacheable objects per page, consider evenly spreading those objects over four hostnames. This usually means your users can have 4x as many outstanding connections to you. Without HTTP pipelining, this results in their average request latency dropping to about 1/4 of what it was before.When you generate a page, evenly spreading your images over four hostnames is most easily done with a hash function, like MD5. Rather than having all <img> tags load objects from, create four hostnames (e.g.,,, and use two bits from an MD5 of the image path to choose which of the four hosts you reference in the<img> tag. Make sure all pages consistently reference the same hostname for the same image URL, or you’ll end up defeating caching.

    Beware that each additional hostname adds the overhead of an extra DNS lookup and an extra TCP three-way handshake. If your users have pipelining enabled or a given page loads fewer than around a dozen objects, they will see no benefit from the increased concurrency and the site may actually load more slowly. The benefits only become apparent on pages with larger numbers of objects. Be sure to measure the difference seen by your users if you implement this.

  • Possibly the best thing you can do to speed up pages for repeat visitors is to allow static images, stylesheets, and javascript to be unconditionally cached by the browser. This won’t help the first page load for a new user, but can substantially speed up subsequent ones.Set an Expires header on everything you can, with a date days or even months into the
    future. This tells the browser it is okay to not revalidate on every request, which can add latency of at least one round-trip per object per page load for no reason.

    Instead of relying on the browser to revalidate its cache, if you change an object, change its URL. One simple way to do this for static objects if you have staged pushes is to have the push process create a new directory named by the build number, and teach your site to always reference objects out of the current build’s base URL. (Instead of <img
    src=””> you’d use

    <img src=””>. When you do another build next week, all references change to <img src=””>.) This also nicely solves problems with browsers sometimes caching things longer than they should — since the URL changed, they think it is a completely different object.

    If you conditionally gzip HTML, javascript, or CSS, you probably want to add a “Cache-Control: private” if you set an Expires header. This will prevent problems with
    caching by proxies that won’t understand that your gzipped content can’t be served to everyone. (The Vary header was designed to do this more elegantly, but you can’t use it because of IE brokenness.)

    For anything where you always serve the exact same content when given the same URL (e.g. static images), add “Cache-Control: public” to give proxies explicit permission to cache the result and serve it to different users. If a caching proxy local to the user has the content, it is likely to have much less latency than you; why not let it serve your static objects if it has them?

    Avoid the use of query params in image URLs, etc. At least the Squid cache refuses to cache any URL containing a question mark by default. I’ve heard rumors that other things
    won’t cache those URLs at all, but I don’t have more information.

  • On pages where your users are often sent the exact same content over and over, such as your home page or RSS feeds, implementing conditional GETs can substantially improve response time and save server load and bandwidth in cases where the page hasn’t changed.When serving a static files (including HTML) off of disk, most webservers will generate Last-Modified and/or ETag reply headers for you and make use of the corresponding If-Modified-Since and/or If-None-Match mechanisms on requests. But as soon as you add server-side includes, dynamic templating, or have code generating your content as it is served, you are usually on your own to implement these.

    The idea is pretty simple: When you generate a page, you give the browser a little extra information about exactly what was on the page you sent. When the browser asks for the same page again, it gives you this information back. If it matches what you were going to send, you know that the browser already has a copy and send a much smaller 304 (Not Modified) reply instead of the contents of the page again. And if you are clever about
    what information you include in an ETag, you can usually skip the most expensive database queries that would’ve gone into generating the page.

  • Minimize HTTP request size. Often cookies are set domain-wide, which means they are also unnecessarily sent by the browser with every image request from within that domain. What might’ve been a 400 byte request for an image could easily turn into 1000 bytes or more once you add the cookie headers. If you have a lot of uncached or uncacheable objects per page and big, domain-wide cookies, consider using a separate domain to host static content, and be sure to never set any cookies in it.
  • Minimize HTTP response size by enabling gzip compression for HTML and XML for browsers that support it. For example, the 17k document you are reading takes 90ms of the full downstream bandwidth of a user on 1.5Mbit DSL. Or it will take 37ms when compressed to 6.8k. That’s 53ms off of the full page load time for a simple change. If your HTML is bigger and more redundant, you’ll see an even greater improvement.If you are brave, you could also try to figure out which set of browsers will handle compressed Javascript properly. (Hint: IE4 through IE6 asks for its javascript compressed, then breaks badly if you send it that way.) Or look into Javascript obfuscators that strip out whitespace, comments, etc and usually get it down to 1/3 to 1/2 its original size.
  • Consider locating your small objects (or a mirror or cache of them) closer to your users in terms of network latency. For larger sites with a global reach, either use a commercial Content Delivery Network, or add a colo within 50ms of 80% of your users and use one of the many available methods for routing user requests to your colo nearest them.
  • Regularly use your site from a realistic net connection. Convincing the web developers on my project to use a “slow proxy” that simulates bad DSL in New Zealand (768Kbit down, 128Kbit up, 250ms RTT, 1% packet loss) rather than the gig ethernet a few milliseconds from the servers in the U.S. was a huge win. We found and fixed a number of
    usability and functional problems very quickly.

    To implement the slow proxy, I used the netem and HTB kernel modules available in the Linux 2.6 kernel, both of which are set up with the tc command line tool. These offer the most accurate simulation I could find, but are definitely not for the faint of heart. I’ve not used them, but supposedly Tamper Data for Firefox, Fiddler for Windows, and Charles for OSX can all rate-limit and are probably easier to set up, but they may not simulate latency properly.

  • Use Firebug for Firefox from a realistic net connection to see a graphical timeline of what it is doing during a page load. This shows where Firefox has to wait for one HTTP request to complete before starting the next one and how page load time increases with each object loaded. YSlow extends Firebug to offer tips on how to improve your site’s performance.The Safari team offers a tip on a hidden feature in their browser that offers some timing data too.

    Or if you are familiar with the HTTP protocol and TCP/IP at the packet level, you can watch what is going on using tcpdump, ngrep, or ethereal. These tools are indispensable
    for all sorts of network debugging.

  • Try benchmarking common pages on your site from a local network with ab, which
    comes with the Apache webserver. If your server is taking longer than 5 or 10 milliseconds to generate a page, you should make sure you have a good understanding of where it is spending its time.

    If your latencies are high and your webserver process (or CGI if you are using that) is eating a lot of CPU during this test, it is often a result of using a scripting language that needs to recompile your scripts with every request. Software like eAccelerator
    for PHP, mod_perl for perl, mod_python for python, etc can cache your scripts in a compiled state, dramatically speeding up your site. Beyond that, look at finding a profiler for your language that can tell you where you are spending your CPU. If you improve that, your pages will load faster and you’ll be able to handle more traffic with fewer machines.

    If your site relies on doing a lot of database work or some other time-consuming task to generate the page, consider adding server-side caching of the slow operation. Most people start with writing a cache to local memory or local disk, but that starts to fall down if you expand to more than a few web server machines. Look into using memcached, which essentially creates an extremely fast shared cache that’s the combined size of the spare RAM you give it off of all of your machines. It has clients available in most common languages.

  • (Optional) Petition browser vendors to turn on HTTP pipelining by default on new browsers. Doing so will remove some of the need for these tricks and make much of the web feel much faster for the average user. (Firefox has this disabled supposedly because some proxies, some load balancers, and some versions of IIS choke on pipelined requests. But Opera has found sufficient workarounds to enable pipelining by default. Why can’t other browsers do similarly?)
Click on pen to Use a Highlighter on this page

Topics: Uncategorized | 34 Comments »

34 Responses to “Vroom, vrooom…. aka Making Pages Load Faster”

  1. Rosalie Says:
    February 1st, 2014 at 5:08 am

    May I simply say what a relief to discover someone that really knows what they
    are discussing online. You actually realize how to bring a problem to light and make it important.
    A lot more people really need to read this and understand this side of your
    story. I can’t believe you aren’t more popular given that you
    definitely have the gift.

  2. car tips road trip Says:
    February 1st, 2014 at 8:52 am

    This piece of writing presents clear idea in favor of the new
    viewers of blogging, that genuinely how to do blogging.

  3. Grace Says:
    March 2nd, 2014 at 1:25 am

    I got this web page from my pal who told me about this web site and now this time I am browsing this web page and reading very
    informative articles or reviews at this

    Visit my web site – Free Instagram Followers, Grace,

  4. office 2013 Activation Toolkit Says:
    March 22nd, 2014 at 4:13 am

    Thanks in support of sharing such a fastidiious thinking, post is nice, thats
    why i have read it completely

  5. Pearlene Says:
    April 7th, 2014 at 6:12 am

    Hi there to every body, it’s my first pay a quick visit of this web site; this blog contains awesome and
    actually excellent material in support of readers.

  6. Allterraintires4U Says:
    April 7th, 2014 at 1:53 pm

    Hurrah! After all I got a website from where I know how to really take valuable facts concerning mmy study and knowledge.

  7. forex home security system affiliate program Says:
    May 8th, 2014 at 2:47 am

    This is confirmed to be true on the Forexbody channel that is live right now
    on livestream. These are the basic things that a robot needs to be good in.

    These new generation tools are commonly referred to as “forex trading robots”.

  8. affiliate marketing Says:
    June 20th, 2014 at 2:31 pm

    This article gives clear idea for the new people of blogging, that
    truly how to do blogging.

  9. forex security system affiliate program Says:
    July 11th, 2014 at 2:10 pm

    Online trading software is one of the wonders and joys of modern technology.
    There were plenty of signs out there that trouble could be on the horizon in the housing sector.

    However, it is also an extremely volatile market that if you don’t have the right tools, chances are you won’t be successful in making a lot of profit.

  10. forex forum audio Says:
    July 13th, 2014 at 8:51 pm

    There is no such thing as too much Forex knowledge.
    Then again, there are some out there that are not so simple
    and straightforward. On the internet we can also
    find the guidelines about how to use a forum and it a very convenient
    way for a fresher to learn it.

  11. medical billing and coding job description salary Says:
    July 14th, 2014 at 6:17 pm

    I’m truly enjoying the design and layout of
    your website. It’s a very easy on the eyes which makes
    it much more pleasant for me to come here and visit more often. Did you hire out a designer to create your theme?
    Great work!

    my web-site medical billing and coding job description salary

  12. personalized stemless wine glasses no minimum Says:
    July 15th, 2014 at 4:39 pm

    I read this post completely about the comparison of latest and earlier technologies, it’s remarkable article.

    Feel free to surf to my blog :: personalized stemless wine glasses no minimum

  13. Thao Says:
    September 8th, 2014 at 10:34 am

    I got this website from my friend who told me regarding
    this site and at the moment this time I am visiting this web site and reading very informative
    posts at this time.

    Here is my web page Thao

  14. sites like chatroulette and omegle omegle alternative Says:
    October 18th, 2014 at 1:49 am

    Even so several consumers require to complain in purchase
    to guarantee no one is focused unfairly. The website sets up randomly-created webcam conversations.
    You can also re-connect with your previous high school adore.

  15. Says:
    December 1st, 2014 at 5:35 pm

    Online Jobs really is a legit company in which you’ll find legitimate occupations that
    are not post -screened for the contacts – plus a great deal of reward content that teaches you how to make use of the process.
    Appropriately, the very first thing to note about Legit Jobs is what the concept implies.
    People who arrive at Legit Online Jobs are most likely trying to find jobs”.

  16. the simpsons tapped out cheat android Says:
    March 2nd, 2015 at 8:42 pm

    They are an iOS or Android device, it has become the most popular
    games, action, a power supply since the game play
    of digital games from the US than there are thousands of
    different choices. The partnership between two cars in race will come at
    an instant. The first two games, PS4 and Xbox One, but requirement and work

  17. charcoal grill blower Says:
    March 3rd, 2015 at 2:20 am

    This post offers clear idea for the new visitors
    of blogging, that in fact how to do blogging
    and site-building.

  18. best dental insurance in ny Says:
    March 3rd, 2015 at 12:08 pm

    Thanks for every other informative website.

    Where else may just I am getting that kind of info written in such an ideal manner?

    I’ve a venture that I’m just now working on, and I have been at
    the look out for such information.

  19. chicago plumber Dayton Oh Says:
    March 5th, 2015 at 6:46 am

    If you would like to obtain much from this piece of writing then you have to apply such strategies
    to your won weblog.

  20. plumbers course Dayton Oh Says:
    March 5th, 2015 at 6:47 am

    Admiring the time and effort you put into your website and in depth information you offer.
    It’s great to come across a blog every once in a while that isn’t the same unwanted rehashed material.
    Great read! I’ve bookmarked your site and I’m adding your RSS feeds to my
    Google account.

  21. plumber san francisco Dayton Oh Says:
    March 5th, 2015 at 6:55 am

    Definitely believe that that you said. Your favourite reason seemed to be on the net the simplest thing to remember of.
    I say to you, I definitely get annoyed whilst
    other folks consider concerns that they just don’t
    understand about. You managed to hit the nail upon the highest and also outlined out
    the entire thing without having side-effects , folks could take a signal.
    Will probably be back to get more. Thank you

  22. ipas2 system Says:
    March 9th, 2015 at 5:18 pm

    Hi it’s me, I am also visiting this web page daily,
    this website is really pleasant and the visitors are
    truly sharing pleasant thoughts.

  23. marietta tree service Says:
    March 9th, 2015 at 6:22 pm

    Yes! Finally something about tree removal service marietta

  24. Dolphin Cruiser Says:
    March 10th, 2015 at 10:22 am

    Hello! Would you mind if I share your blog with my myspace group?
    There’s a lot of people that I think would really appreciate your content.
    Please let me know. Many thanks

  25. Angelo Says:
    March 19th, 2015 at 6:18 am

    I aam going to put it doen so any individual can have an understanding of the significance of the post
    exdercise eating plan. you see joggers with grimaces oon their
    faces; een walkers seem to be unpleasantly completing a task.

    By increasing your fitness level through normal exercise, you will definitely make more likely your personal self-sufficiency in a
    doomsday scenario.

  26. bike Says:
    April 30th, 2015 at 3:06 pm

    Hi there to every single one, it’s truly a nice for me to go to see this site, it consists
    of helpful Information.

  27. Antonio Says:
    June 18th, 2015 at 10:51 pm

    Hi there, yup this article is really pleasant and I have learned lot of things from it regarding blogging.


  28. maquinas De hosteleria Says:
    November 2nd, 2015 at 5:08 pm

    Plancha vitrificada con fogon de un acero inoxidable muy resistente y de una gran calidad.

  29. hoteles en benidorm baratos en levante Says:
    December 21st, 2015 at 8:36 pm

    Vuelos ida/vuelta que puedes configurar desde la página
    web de Edreams con la opción multidestino” en las que indicas por
    donde entrar y por donde salir. Tree House , situado en el Refugio Nacional de
    Vida Silvestre Gandoca-Manzanillo de Sin embargo al examinar todos los meses, lo más económico que encuentro es del 2 al 16 de septiembre por 477€.

    My blog – hoteles en benidorm baratos en levante

  30. rustic western bridal shower invitations Says:
    August 17th, 2016 at 2:06 am

    We need to attend diligently to the state of our soul, and to deal fervently and effectively with God about it.

  31. Says:
    August 18th, 2016 at 6:20 pm

    Asking questions are truly fastidious thing
    if you are not understanding anything fully, however this post provides pleasant understanding yet.

  32. Michal Kroeker Says:
    August 23rd, 2016 at 12:56 am

    After examine a number of of the blog posts in your web site now, and I really like your way of blogging. I bookmarked it to my bookmark website list and can be checking again soon. Pls try my website as properly and let me know what you think.

  33. Frauen Osteuropa Says:
    September 7th, 2016 at 10:10 pm

    I have read several good stuff here. Definitely price bookmarking
    for revisiting. I wonder how so much effort you put to make this sort
    of wonderful informative web site.

  34. Says:
    June 21st, 2017 at 5:39 pm

    Thanks for finally talking about > Vroom, vrooom….
    aka Making Pages Load Faster | two geeks… < Liked it!