Welcome!

Open Source Authors: Bob Gourley, Maureen O'Gara, Adrian Bridgwater, John Cowan, Hovhannes Avoyan

Related Topics: AJAX & REA

AJAX & REA: Article

New W AJAX Design Pattern

Design Pattern Supposed to Reduce the Loading Time of Web Applications

Wael Chatila, on his website www.waelchatila.com, speaks about a new design pattern that he and partner Will Glass call the “W AJAX Pattern”. Wael says that the design pattern was discovered while they were discussing the loading time of a web application they were working on.

Apparently, the web app front basically consists of a Google Map plus a form. The user could search for an address/place or, interactively on the map, select a boundary area for the search. When the search is submitted to the webserver, the webserver sends off an additional request to a 3rd party geodata server for the purpose of retrieving geocoding data plus demographical data. The problem is that this request to the 3rd party geocoding provider takes some time. The end result would be a wait for about 7 seconds between the time the search was submitted and the end resulting page showed up.

Wael included the following picture to depicts the scenario.



1. User submits a search request with HTTP POST
2. A blocking request to the geodata server is issued
4. Geodata retrieved and results are sent back to the browser
5. Data received by browser
6. Browser finished processing and rendering the data and page fully displayed.

Wael says that a way to reduce the response time is to utilize some AJAX. He goes on to describe the idea. When the search request arrives at the webserver, a new thread associated with the http session is spawned with the task to asynchronously do the 3rd party geodata request. Control is immediately returned back to the browser with no geodata. The browser, upon getting the no geocode data immediately sends of an AJAX request (asynchronous by nature) while it continues to render the web page with images, the Google Map, tables etc. This rendering takes some time to happen and by the time the rendering is done the AJAX request has landed at the webserver and is doing a blocking wait for the spawned geodata server request. When the 3rd party request is done, data is very quickly returned back to the browser (once again one of the natures of AJAX) and the rendered page is updated using DHTML. All in all reducing loading time, but more importantly reducing perceived responsiveness for the user.

More Stories By RIA News Desk

Ever since Google popularized a smarter, more responsive and interactive Web experience by using AJAX (Asynchronous JavaScript + XML) for its Google Maps & Gmail applications, SYS-CON's RIA News Desk has been covering every aspect of Rich Internet Applications and those creating and deploying them. If you have breaking RIA news, please send it to RIA@sys-con.com to share your product and company news coverage with AJAXWorld readers.

Comments (0)

Share your thoughts on this story.

Add your comment
You must be signed in to add a comment. Sign-in | Register

In accordance with our Comment Policy, we encourage comments that are on topic, relevant and to-the-point. We will remove comments that include profanity, personal attacks, racial slurs, threats of violence, or other inappropriate material that violates our Terms and Conditions, and will block users who make repeated violations. We ask all readers to expect diversity of opinion and to treat one another with dignity and respect.