Improving RIA / JavaScript startup performance in latest deployment - build #70

On Monday April 13th, 2009, we deployed build #69 of the Sun Software Library.  This blog entry details the additions we've made.  If you've been following this blog, you know that the Sun Software Library engineering team does a great job of deploying a new build every two weeks, but the blog entries typically trail the deployment a bit.  That's completely because the writer of this blog is a slacker.  No other excuse can be made.  All sorts of gimmicks were tried, apparently to no avail.

This release completes, for now, all of our startup performance improvements associated with our RIA.  As you know, the Sun Software Library user interface is written in JavaScript, and accesses the data in the library using Restful Web Services.  Our Web UI currently has:

  • 12,000 lines of JavaScript code written by us, in 17 different files
  • 2,000 lines of CSS code (I guess you can call CSS code, right?), in 4 different files
  • Oodles of images
  • Many 3rd party libraries (for example, we rely heavily on the Ext JS toolkit for web UI components)

When we initially deployed the application many many months ago, the browser had to download each and every one of these components separately, requiring approximately 20 seconds to load the entire application, and that was on a fast Internet link in relative network proximity to the web site.  Performance from distant parts of the world was atrocious, and that's putting it mildly.  We made things a bit better by building an "index.jsp" home page that loaded relatively quickly (e.g. approximately 8-10 seconds), then transitioned to the "app.jsp" main page (which took approximately 20 more seconds to load).

So we looked for tools to help us improve performance.  After all, we're not the only ones in the world writing RIA's in JavaScript.  But amazingly, we didn't find any tools that fit our way of doing work:  we're LAZY, and we're HUMAN!  Being lazy means we abhor labor intensive, manual processes since they are typically very error prone, whereas being human means we like using tools.  Since we couldn't find the right tools, we went about integrating/building various components.  We'll include details in a future blog entry.

So where are we today?

  • A single "app.jsp" page that contains our entire application.
  • A single CSS invocation,  which is automatically generated with a unique file name containing a timestamp, so it can be cached by the browser but also updated in real time.
  • Two JavaScript invocations, one for Ext JS and one for our entire application, each of which have unique file names similar to above.
  • Most of our images are integrated in to a Sprite, automatically generated.  The only remaining images that are distinct come from the 3rd party libraries we are using.
  • All of our content has a "far future cache expiration date".  A browser with a primed cache only requires 8.3 KBytes of new content to render the application (that's the web services call to retrieve the "most viewed" and "recently updated" entries).

Net net, our entire application loads in approximately 2.5 seconds.  And since it is JavaScript based - once the application has started - only web services calls are made to retrieve data to display.  While there is still some work to do to improve performance even more, we're pretty satisfied with where we are.  The only caveat to the home page load time is that the logos for the various entries are not (yet) cached by our service, we retrieve logos from the 3rd party sites on each invocation.  This makes our page load time dependent on services other than our own.  We measured the page load time w/remote logo loading turned off, using yslow.

 So what else is new? 

Sun Software Library Home Page

Our home page now links to three key Sun organizations that we work with daily:

  • Sun Developer Network: Becoming an Sun Developer Network (SDN) member makes you part of a vibrant worldwide community of developers, and gives you access to cool stuff and exclusive offers.
  • Sun Partner Advantage program: The Sun Partner Advantage Program connects Independent Software Vendors (ISVs) to free or deeply discounted offerings as well as sales relationships, so they can deliver solutions/services to an expanded market.
  • Project Kenai: Sun's new foundation for its connected developer experience of tomorrow.  Freely host your open source projects and code as well as find and collaborate with developers of like mind and passion on this site.

Also, we fixed numerous bugs..  Nothing new here, we are always fixing bugs.

As always, feedback (either positive, constructive, or what the weather is like where you) is always welcomed!

Comments:

Except that since the software icons are loaded from various sites, one of which was lagging quite a bit, the rendering of the page just stalled for tens of seconds. Wouldn't it be possible to automatically fetch those logos and composite them into a single CSS spriteable local image?

Posted by Mikael Gueck on April 21, 2009 at 04:53 AM EDT #

Hi Mikael -

This is absolutely doable. From day one, we struggled with what to do with Icons, there were several options, each with its own issues that I list below:

- Allow a user to upload an icon to the library, the issue then comes one of maintainability, it makes it harder for the user to update their icons (it's yet one more piece of data to maintain).

- Cache an icon on the library, retrieving it initially from a URL specified by the user (similar to what you are suggesting). The issue then is how often do we check the cache and refresh?

- Allow the user to specify a URL for the icon itself, for maximum flexibility for the user. This is what we ended up doing, but it is far from perfect. In addition to the performance issues, this also mixes https loaded components (our stuff) and http loaded components (the remote logos). This causes IE to put up a warning message on our home page.

We'll be revisiting this issue.

Posted by Arieh Shamash on April 24, 2009 at 08:54 AM EDT #

This is a good struggle.
I was listen about this from my friend and when I use this one personally

I found it very impressing

Posted by Kashif's Blog on July 03, 2009 at 06:36 PM EDT #

Post a Comment:
  • HTML Syntax: NOT allowed
About

Welcome to the Sun Software Library blog, where you will find interesting updates and tidbits about using the Sun Software Library.

Search

Categories
Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today