· Naughties
· · 2006
· · · April
· · · · 19 (1 entry)

The Cost of AJAX · James Gover­nor re­lays a ques­tion that sounds im­por­tant but I think is ac­tive­ly dan­ger­ous: do AJAX apps present more of a server-side load? The ques­tion is dan­ger­ous be­cause it’s mean­ing­less and unan­swer­able. Your typ­i­cal Web page will, in the pro­cess of load­ing, call back to the serv­er for a bunch of stylesheets and graph­ics and scripts and so on: for ex­am­ple, this on­go­ing page calls out to three dif­fer­ent graph­ic­s, one stylesheet, and one JavaScript file. It al­so has one “AJAXy” XMLHttpRe­quest cal­l. From the server’s point of view, those are all just re­quests to deref­er­ence one URI or an­oth­er. In the case of on­go­ing, the AJAX re­quest is for a stat­ic file less than 200 bytes in size (i.e. cheap­). On the oth­er hand, it could have been for some­thing that re­quired a com­plex out­er join on two ten-million-row ta­bles (i.e. very ex­pen­sive). And one of the virtues of the Web Ar­chi­tec­ture is that it hides those dif­fer­ences, the “U” in URI stands for “Uniform”, it’s a Uni­form in­ter­face to a re­source on the Web that could be, well, any­thing. So say­ing “AJAX is expensive” (or that it’s cheap) is like say­ing “A moun­tain bike is slow­er than a bat­tle tank” (or that it’s faster). The truth de­pends on what you’re do­ing with it. In the case of web sites, it de­pends on how many fetch­es you do and where you have to go to get the da­ta to sat­is­fy them. on­go­ing is a pret­ty quick web site, even though it runs on a fair­ly mod­est server, but that has noth­ing to do with AJAX-or-not; it’s be­cause of the par­tic­u­lar way I’ve set up the Web re­sources that make the pages here. I’ve ar­gued else­where that AJAX can be a per­for­mance win, system-wide; but that ar­gu­ment too is con­tin­gent on con­tex­t, lots of con­tex­t.
author · Dad · software · colophon · rights
Random image, linked to its containing fragment

By .

I am an employee
of Amazon.com, but
the opinions expressed here
are my own, and no other party
necessarily agrees with them.

A full disclosure of my
professional interests is
on the author page.