Google Gears - 4th hour working with Gears

By Kevin Pirkl (Intel) (19 posts) on October 4, 2007 at 2:05 pm

In memory of my friend Steve T - The wandering electron!

OK so here it is, after a bit of mulling around I finally found a good use for Google Gears! (I would find about a thousand more but they keep me locked up in my cube with a stack of ToDo items.)

Use Case for a web application distance problem: There are times that a person wants to write a web application that works in distant geographies like from China to the USA and still maintain excellent performance. Consider a Content Management System (CMS) administration tool that spans multiple geographies.

Here are a couple approaches (I sure there are a million more)

  1. One approach would be to place the CMS administration tool in one place have all geographies work there. Nightly copies of data would be delivered to a Content Delivery Network (CDN) hosting a web front end like the Akamai network. A slight variation on that theme might be to generate static files derived from the CMS tool delivered to the CDN for even faster performance.
    :-)
  2. Another more distributed approach might be to place server racks in multiple geographies across the world and then create nightly data synchronization routines to bring data back to a central server for final distribution back to servers (insane from an administrative standpoint.) Each geography would own and maintain it's own information and a copy of all other geographies data. Administration tool would run fast for sure and the delivery vehicle in each geography would be faster. The trade off here is that system application maintenance would be pain in the a$$. Imagine having to make a single change and distributing that change to 14 locations not to mention the cost of updating the data synchronization routines.

Google Gears to the rescue - Application performance gripes in this case scenario can be boiled down to the parts of such a system. What are some internal pieces we might see in such an application approach with ISN.

There are more but I am most concerned with the slowest parts of this style of application and why single point delivery is a problem. Out of all the above aside from distance based latency large and complex pages and the biggest problem. Take for instance a nice RTF editor like FCKEditor. Put this tool on a single web page and deliver it from the USA to China and see how long it takes. There are about 10-15 subfiles that comprise the FCKEditor experience (just a very rough estimate.) FCKEditor files are pretty static and using Gears Local Server Module API give an excellent resource cache for all of these files. Using the Gears LocalServer class container to create a ManagedResourceStore that contains these 10-15 controlled by a simple manifest file means mighty groovy goodness! If fact the time it will take me to write up this blog post will be much longer than it took me to code the solution to the problem.

I ran into a couple hangups here with some version problems with Gears sample code and the main download page. I had this same problem the first time around on my own development box but have sorted it out. If you happened to install Gears from the main link http://gears.google.com/ then you should just uninstall it and go to this "Gears .2 release" link instead. From my experience it appears that they might have updated the sample code to work with the new release and it is not compatible with the older version. I installed from the first link on clean server boxes for in Russia and China for testing the performance boost and both had the same issue which was solved by re-installing from the .2 release.  Update (Oct 15 2007)  Addition - I get something here at least why my code seems to have some issues. My problem here with Gears versions is that I’ve been working from the Beta site install version code or .2 versus the main site downloader. http://code.google.com/apis/gears/install.html versus http://code.google.com/p/google-gears/downloads/list. I’m just not sure all about it but it appears that the sample code has been updated to use the second link or version .2. KP

One other problem that I can across is that I wanted to add a little bit of code to call openStore(string name, [string requiredCookie]) to check to see if the store existed so I could enable/disable buttons on the screen for a clean user experience but the calls to openStore always returned null for me even though I can see that it is working correctly. Not sure what I might have done wrong on that end but I will take a better look at the code tomorrow.

The RTF editor was the biggest hindrance to the geographic distribution of this application and Gears solves that problem. It's worth noting that some other changes like HTML reduction via style sheets and dropping viewstate from the ASP.Net pages has made a big difference in overall search performance as well but those are often issues dealt with in a second go around with the code. What I like about all this is that the page that took 15 seconds to load in China now takes about three.

So in three hours of play and one hour of coding I have all the code up and working in production and a viable future implementation change that will end up saving thousands of dollars in application maintenance costs (and developer headaches later.)

I just want to say Google Gears Rocks! For more resources check and watch the Gears API Blog

Kevin Pirkl

Categories: Intel® Software Network 2.0

Comments (2) Comments RSS Feed

By Riselocal.Com » About on October 4th, 2007 at 10:05 pm
links from Technoratiunknown wrote an interesting post today onGoogle Gears - 4th hour working with GearsHere’s a quick excerpt OK so here it is, after a bit of mulling around I finally found a good use for Google Gears! (I would find about a thousand more but they keep me locked up in my cube with a stack of ToDo items.) Use Case for a web application

By ramana on July 18th, 2008 at 12:11 am
Hello,

my self venkata ramana iam trying to use GoogleGears since 2 weeks ,but still iam not able to connect my appllication to the google gears.please can u tell me how to keep connections for our applications.

otherwise please can you give one small application that runs with google gears.

waiting for ur reply.....


What do you think?

Name (required)

Email (required; will not be displayed on this page)

Your URL (optional)

Comments (required)