mnot’s blog

Design depends largely on constraints.” — Charles Eames

Tuesday, 16 May 2006

Caching Web 2.0

Filed under: Caching Web Web Services

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.

Using JavaScript to extend HTML allows the addition of a few small capabilities to browsers that make a big difference to caching. In particular, I made public three libraries I’ve been working on;

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 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.

What’s Next?

I think the real interesting work is going to come in extending the caching model, to allow things like credential caching, advanced invalidation, and even offline operation. Stay tuned.


Laurens Holst said:

Slides link doesn’t work?

Was at another talk, but I read Mark Nottingham’s notes, very interesting.


Wednesday, May 17 2006 at 1:40 AM

James Stewart said:

Looking forward to seeing the slides, but the PDF link isn’t working for me.

Wednesday, May 17 2006 at 7:51 AM

Arien said:

Try (“papers”, not “papes”).

Wednesday, May 17 2006 at 11:38 AM

Aristotle Pagaltzis said:

Mark: this is basically what Tim Bray has been saying, no?

Thursday, May 25 2006 at 10:40 AM

Mark Birbeck said:


As usual very interesting. What caught my eye was this:

“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.”

I’m with you 100%, and I’ve spotted other posts in the same vein. It will be interesting to see if the tide is turning towards keeping all the Ajax goodness, but with less of the scripty spaghettiness.

I’ve linked to one of the other posts on this subject from my blog, in an item called “Declarative Ajax…Now we’re talking”.

And if anyone is interested in this topic, I’ve also written a few things on how XForms is just such a declarative language, one of which is called “XForms and Ajax Languages”.



Tuesday, July 18 2006 at 7:48 AM

Creative Commons