Jul 11, 2012

Single Page Applications: Fat Client - Slim App

I have been working on Single Page Applications (SPA) for some time now. These applications have not just changed the user interface design, they have also changed the server architecture; server becomes lean and client picks up extra weight. 
Single Page Application provides rich, fast and interactive user interface, they emulate a desktop application in look/feel and server interaction. These applications do not require a page load between user interactions, UI components of the page are loaded up front and the user sees the page instantly. The browser continues to load the page while making multiple asynchronous server calls to gather page data. With these concurrent asynchronous severs calls; the overall page load is faster too. 

Traditional web applications follow a request-based model where the server responds to a request by selecting, generating & delivering the next view. The server gathers all the data needed to display the next page and hands it to the UI.
In SPA, UI has the responsibility of selecting, generating and delivering the next view. It makes fine-grained service call to gather data needed to respond to user events.

In traditional web application, server managed the client state through HTTPSession or state-full session beans. In SPA, this responsibility moved to UI, user’s state is maintained browser-side.

Now, that the server no longer manages state or performs view control, it just provides data-feeds to UI in response to the user events. The server is a simple stateless web service application. Such applications have a simple cluster configuration; there is no overhead of session replication or sticky session.
In my case, I did not go completely stateless; I had a state aware Application Tier in front of the stateless services tier. This tier is a Spring MVC web application, which interacts with UI/ExtJS and proxies’ service calls to the domain services (Apache CXF).  It is deployed in the VMware cluster with sticky session and domain services are deployed in a simple cluster.
These stateless web service applications have a low memory footprint which helps in simplifying the JVM configuration.

SPA store page data in browser and UI makes service calls to get delta data. As the data is already in browser the number of service calls are less. Also, the service calls are fine grained, so the network bandwidth consumption is low. 

Single Page Applications make server architecture simple and lean. However because of chatty UI-service interactions, SPA requires certain server configurations that were not needed in the traditional web application. I plan to write about it in my next blog. 

1 comment:

  1. Business Intelligence Analyst
    SQIAR (http://www.sqiar.com/services/bi-strategy/) is a leading Business Intelligence company.Sqiar Provide business intelligence Services Which help the company to present Information in Meaningful form.