Blue Sky On Mars

Thoughts on Building Software Products

When to use XMLHttpRequest and when to use IFrame

by Kevin Dangoor

Joel Webber dissects maps.google.com in Mapping Google. He spent a good deal of time getting into what all is being done by Google Maps. Here’s an interesting takeaway:

I mentioned before that there was some advantage to be had by using a hidden IFrame over making direct XMLHttp requests. One of these is that the IFrame’s state affects the back button. So every time you do a search, it creates a new history entry. This creates an excellent user experience, because pressing the back button always takes you back to the last major action you performed (and the forward button works just as well).

This leads to a good rule of thumb. If you’re updating the page with new or updated information, you most likely don’t want a history event. So, use XMLHttpRequest. On the other hand, if you’re working in resposne to a user request, it would often be better to use the IFrame approach in order to preserve back button behavior.

memcached: high-performance in-memory caching

by Kevin Dangoor

memcached: a distributed memory object caching system has APIs in Perl, Python, PHP, Ruby, C and Java and is designed for websites that have heavy database-intensive, mostly-read pages. The interesting thing here is that memcached does not exist through some theoretical “what if?” premature optimization. It was created by the LiveJournal folks who were dealing with 20 million dynamic page views per day. Other high-traffic sites like Slashdot and WikiPedia are users.

(Discovered via Titus Brown.

Update (4/8): memcached has been forked, apparently to fix some bugs. The new project is called Tummy.