Tuesday, 16 May 2006
Caching Web 2.0
I just finished my XTech presentation, “ Web 2.0 on Speed”. here are the slides [pdf]; I’m going to try to s5 them soon. There isn’t much new in this talk; it’s just a synthesis of a few different observations;
1. Static Web servers are fast.
You might say ‘duh’, but people often overlook the obvious; with event-looped Web servers like lighttpd (see c10k for more information), you can get 2-3 orders of magnitude more requests/second over LAMP and similar applications.
2. Web Caches can help distribute applications.
Because they’re easier to deploy as reverse proxies, and on virtually every browser. However, many developers fear them, because they can’t control them, or don’t trust how they’ll behave. This can be addressed by quantifying their behaviour and by educating users on how to control them (e.g., cache-control: private).
3. A little bit of AJAX spice goes a long way.
- hinclude.js allows you to compose dynamic pages within browsers. We wanted to do it this way when we did ESI, AJAX makes it possible now. See also Micah’s paper [pdf] quantifying the benefits of this approach.
- URL Templating
- url_template.js allows you to interpolate variables into URLs, making it possible to load personalisation data from a separate file and use that to customise the page presentation. I expect that this will expand to incorporate other functions like looping, conditionals, etc. based on loaded preferences in time.
- JSON Form Submission
- json_form.js sniffs for HTML forms with an enctype of “application/json” and sends the form data as JSON rather than url-encoding it. N.B.; Safari and Opera will not support PUTting forms, and I haven’t debugged it on IE yet; it will be fixed and documented ASAP.
As I said in my talk, I’m not necessarily pushing these as libraries that should be standardised upon (although I’ve been using HInclude on almost every page of mnot.net with no complaints for the past three months). What I would like to see is for common JS functions like this to be sifted out and standardised as declarative markup, so that they’re more semantically transparent, and less of a security issue.