CSAIL Publications and Digital Archive header
bullet Research Abstracts Home bullet CSAIL Digital Archive bullet Research Activities bullet CSAIL Home bullet

link to publications.csail.mit.edu link to www.csail.mit.edu horizontal line


Research Abstracts - 2007
horizontal line

horizontal line

vertical line
vertical line

MapJAX: Data Structure Abstractions for Asynchronous Web Applications

Daniel S. Myers, Jennifer N. Carlisle, James A. Cowling & Barbara H. Liskov


Recent months have shown an explosive growth in rich, interactive content on the World Wide Web --- a phenomenon termed Web 2.0. Central to this growth is a communication technique known as AJAX: Asynchronous Javascript and XML [1]. Before AJAX, web applications were forced to fetch an entire new page from the server in order to display any new data. By contrast, AJAX allows Javascript programs to send asynchronous requests to the server without reloading the page or blocking the user interface. This has permitted the development of a new class of highly-responsive, desktop-like applications on the web. The current AJAX programming model has two important shortcomings, however. First, AJAX requires that web clients request content from web servers using HTTP with an associated callback, which forces programmers to use an awkward continuation-passing programming style and thread program state through a series of callback functions. While various toolkits elevate the level of abstraction to that of an RPC, none has eliminated the use of continuations and callbacks. Additionally, a programmer using AJAX must develop his or her own techniques for avoiding delays associated with fetching content from the server. These delays can be reduced by prefetching content before it is needed, and by sending requests in parallel, rather than one-at-a-time. Neither AJAX nor current tools built on top of it provide direct support for these approaches, forcing programmers to needlessly reimplement these techniques in each application.

System Design

The MapJAX system is a data-centric model for building rich, interactive AJAX applications that resolves these problems. MapJAX presents application programmers with a shared memory abstraction between the client and server. It provides the illusion of shared logical data structures that appear to the programmer as ordinary objects that can be accessed through normal (synchronous) Javascript method calls. This natural object-oriented style hides the underlying complexity of continuations and callback functions. Instead, the code that causes a fetch of data from the server can be thought of a running in its own thread; the thread blocks when the call is being processed and then continues running when the server response arrives. The MapJAX approach thus allows users to create programs with the mental model to which they have grown accustomed: threads and objects. Additionally, MapJAX provides programmers with a number of data-transfer performance optimizations, including fetching data items in parallel, prefetching data speculatively, and canceling requests for data. Finally, it also provides a novel type of local lock that allows a thread to reserve the lock in advance of acquiring it, which can yield considerable performance benefits.

Results and Current Status

MapJAX is implemented as an extension to the Javascript language and is compiled to standard Javascript, which minimizes the need for programmer retraining or the deployment of new software. Experiments with a prototype of the system have shown MapJAX to decrease the development complexity of prototypical interactive web applications, (including mapping and email applications), and to provide substantial performance benefits, up to a factor of ten in some cases. Figure 1 shows an example of the decrease in application latency that MapJAX can enable. A mapping application similar to Google Maps was constructed using both MapJAX and non-MapJAX implementations, and user traces were generated by having subjects perform a navigation task (scrolling from MIT to the intersection of MA-24 and I-93 south of the city). The user traces were replayed using both implementations of the application, with realistic Internet latencies, and various degrees of MapJAX prefetching were used (the prefetching policy fetched all map cells within a k-length square every time a tile was accessed). When sufficient bandwidth was available to support prefetching, response times were dramatically decreased. A paper on the system has been accepted for publication in the 2007 USENIX Annual Technical Conference [2].

Figure 1. Average latency of data access generated by a user trace on a mapping application similar to Google Maps. Bars compare MapJAX and non-MapJAX implementations of the application under varying bandwidth constraints and with various levels of MapJAX-driven data prefetching. Bars labeled "prefetch k" correspond to prefetching all map cells within a k-length square on each data access.


[1] Jesse Garrett. AJAX: A New Approach to Web Applications. http://www.adaptivepath.com/publications/essays/archives/000385.php. February 2005.

[2] Daniel S. Myers, Jennifer N. Carlisle, James A. Cowling, and Barbara H. Liskov. MapJAX: Data Structure Abstractions for Asynchronous Web Applications. USENIX Annual Technical Conference. To appear. Santa Clara, CA USA, June 2007.


vertical line
vertical line
horizontal line

MIT logo Computer Science and Artificial Intelligence Laboratory (CSAIL)
The Stata Center, Building 32 - 32 Vassar Street - Cambridge, MA 02139 - USA
tel:+1-617-253-0073 - publications@csail.mit.edu