Ajax is a good thing, right? Well, not always.
A financial company had a content based intranet and the implementer decided that absolutely everything should be done using Ajax. The home page had about a dozen portlets on it. Some were personalized but most simply displayed non personalized content which did not change often, perhaps hourly at best. Some content even changed less than once a day. The fundamental problem with this approach is that an Ajax request incurs at least a 1/10 of a second overhead in simply establishing an HTTP connection. Given that a browser typically can only handle 4 simultaneous HTTP requests, all these request fire off synchronously, plus they also incur an heavy load on client side processing. As a result of all this, page load times were about 15 seconds in single user scenarios. Under load, page load times rose to over 30 seconds.
Choosing a Global Software Development Partner to Accelerate Your Digital Strategy
To be successful and outpace the competition, you need a software development partner that excels in exactly the type of digital projects you are now faced with accelerating, and in the most cost effective and optimized way possible.
What Should Have Happened
Any portlet which simply serves content should never be implemented with Ajax. This is especially true if the content is shared across multiple users and can be cached. Cached portlet content can be retrieved in milliseconds where retrieving the same content (even if cached) with an Ajax based approach will take over 1/10th of a second. If you multiply this times the number of portlets on your page times the number of page hits, it is easy to see the magnitude of extended wait time Ajax introduces into the portal. After converting a majority of the portlets on this customer’s home page to not use Ajax, the page load times were reduced to less than 4 seconds under load. The figure below shows the typical lifecycle for an Ajax call on a portal page.
Ajax of course is extremely powerful and can create great user experiences; however, it must be used in appropriate situations. Here are a few guidelines for when using Ajax is appropriate in portal.
- A portlet will take longer than a second to render
- The content of the portlet is not common between users
- Portlet takes longer than a second to render
- Content may change often and is minimally cacheable
- A portlet will likely be interacted with
- In place refreshes save entire page refreshes
- Better user experience
- Better performance
- When a portlet connects to a system which may be unreliable
- Prevents portal from hanging if system fails
- Lets user interact with remainder of portal
One other word of advice about Ajax. When web pages are assembled vial client side aggregation, the information which is rendered with Ajax typically cannot be indexed by search engine crawlers such as Google. So, if you have a public site and you want it searchable, it is imperative to evaluate how Ajax is used.
- Where’s My Homepage?!?
- The Business Asked for It
- Methodology for Methodology’s Sake
- The Never Ending Strategy
- I Built It But Now I Can’t Support It
- We Can Get Big ROI From a Portal
- Is Best of Breed Always Best?
- When Developers Can’t Develop
- When Not to Use a Portal
Join us this month on Wed, June 29th for our Perficient Perspectives webinar in which we explore the 12 Things You Shouldn’t Do on a Portal Project in depth. More Info / Register