daveisbest.org

Disk 8 · c. 2005–06 · age early 20s

No Reload

Bedbookers, about 2005. A hotel-booking site in the glossy years, when every button had a reflection and everything was in beta. There were three of us developers and no designer. I was the lead and the sysadmin, I even ran the pay-per-click, and the search was mine.

Play this memory

Every search on the site went off to the server and came back as a whole new page. White flash, wait, start again. Most of the web worked like that.

So I wired it up differently. The page asked the server for just the results, using XMLHttpRequest, and dropped them in exactly where the old ones had been. No white flash, no reload. The technique had only just got a name: Ajax was christened in 2005.

Underneath it was a whole framework I'd written myself, doing much the same job as Prototype and jQuery, at much the same time. Prototype appeared in February 2005 and jQuery was announced in January 2006. Prototype and jQuery got names. Mine just got on with it.

Then somebody searched for the whole of Majorca, for a week in August, and the page just sat there. Behind it, our .NET server was asking Hotelbeds, our supplier, for every hotel on the island in one go, and waiting. There was nothing wrong with the server, and as the sysadmin I'd have known. Twelve seconds is a long time to look at an hourglass.

The fix was my own design. Split the search into chunks, send the chunks to the supplier on parallel threads, and stream each lot of hotels into the page the moment it comes back. The first hotels arrived in a couple of seconds, and the rest turned up as they landed.

Most of the market was still reloading the whole page. Our results arrived as they came in. Something even the big players didn't do.

A glossy white office from the mid-2000s: three desks in a pod, a whiteboard of boxes and arrows, a server rack and a lime-green beta poster.A whiteboard sketch of a hotel search: browser, XMLHttpRequest and a .NET server, with No reload! underlined in green marker.

How this one was made