Google Gears - Review I

May 31, 2007, at Google Developers Day ( GDD07) Google announced Gears – a small AJAX framework that “enable offline functionalities for online applications”. Despite the shyness of publicly declared goals, many believe that Gears is a long expected first step in Google strategy to take on Microsoft dominance. I mostly agree with this point, but believe that Gears is more then just frontal attack on MS Office – I think that Gears may open a new interesting direction for mobile applications and distributed commuting ( see “speculations” section) .

At the moment,   Google Gears (http://gears.google.com/)  described as an early “BETA”, but judging by mailing list reports, it is in very early stages of development. Accordingly to private talks with Google engineers, this project was in the stealth mode until recently – even “Gears” name had been approved just a few days prior to announcement.

Google Gears is 100% open source project – main project page is at http://code.google.com/apis/gears/.

Source code is accessible via SVN at http://google-gears.googlecode.com/svn/trunk/gears/

Google Announcement.

Accordingly to Andy Palay, a member of the Gears development team, the main intension for Gears development is to allow offline use of online [Google] applications, such as Webmail, Calendar, RSS reader and even Notepad. The main point made: while we are “almost always online”, even 1% of network unavailability may hurt, especially if it happens in the most critical time. Also, it was interesting to note that performance was mentioned as one of the major problems for online applications usability . As an example, Andy mention importance to eliminate two way network delay, but technical description of Gears shows Google intension  to look into distributed computing as well ( by offloading heavy tasks to the user computer, instead of performing them on the server). Specifically, a (yet primitive) multi-tasking support is implemented by  WorkerPool component.

 Andy described a current version of the Gears as an initial step only and invited developers to participate in this open project. Synchronization of the local data with centralized server was named as immediate area of interest for this project. Another immediate community efforts is a “standardization” – it seems that Google wish to standardize Gears API to be part of future web browsers implementation ( current Gears is implemented as “browser extensions” to achieve the same goals) . Adobe, Mozilla Foundation (FireFox) and Opera are mentioned as a current partners in standardization process.

Adobe representative demonstrated a small cute demo of Apollo-based application with integrated Gears capabilities – running application from the web and then taking it offline as a standalone..(Note: looks like Google Gears vision is in a good fit with Adobe Apollo )

In addition to few small Gears-based demos, a “real” application had been shown. Google Reader (http://reader.google.com ) is a popular RSS reader application. Until recently, it required an online connection, but now, thanks to integration with Gears, you can go “offline” , download up to 2000 items and use Google Reader while offline.

 In private conversation, Andy Palay confirmed that Reader is a first ( and so far – only) real application running on the top of the Gears platform . At present, Reader functionality is not yet “exactly” as envisioned by Gears team for future releases – today you have explicitly switch between offline and online modes and wait until synchronization completion. Gears team vision is that future applications will automatically synchronize itself with centralized resource whenever reliable connection established. The one of the Gear concepts ( accordingly to Andy) is to make user experience completely same regardless of connectivity at every given moment ( for those applications where it is possible).

Brad Neuberg from SitePen discussed Dojo Offline (watch it at http://youtube.com/watch?v=JgXn0rMRr9g ). Dojo (http://dojotoolkit.org/) is a popular JavaScript library for development of the AJAX applications and websites. Dojo Offline (http://dojotoolkit.org/offline ) is a toolkit extension that enables web applications to work offline. Dojo Offline consist from JavaScript library to be integrated/used by AJAX application and small run time module that implement HTTP proxy and other modules. Beta version of Dojo Offline had been released April 2007. However, due Google Gears announcement, Dojo Offline team decided to replace original run-time module with Gears’ one ( these efforts are sponsored by Google).

 

Technical Details

Three components

Google Gears consist of three components/modules:
  • LocalServer
  • Database
  • WorkerPool
 Those components are implemented as “browser extension” and , using service “factory” component, be instantiated in the JavaScript (AJAX) applicatio
 

LocalServer is a very basic web cache engine. Using so-called “manifest”, it has to be explicitly instructed what static components (files) are belong to the given application. Once in while, LocalServer will check if server has an updated copy and will bring updates. All updates will happens atomically, to avoid mis-synchronization between various parts of application. A few important points to note: (a) application is always uses files from LocalServer store (current or updated) (b) LocalServer is not able to serve dynamic files – current design doesn’t consider ability to run “server-side” scripts (c)ALL browser traffic is going via LocalServer ( that opens some potential security issues) .

Database – offline application needs an ability to preserve data locally. Instead of building flat file system, Gears team decided to go after SQL managed storage. Database component build on top of lightweight SQLite (http://www.sqlite.org/) database engine.

WorkerPool – is a special component to run JavaScript in background, independently from main (browser-initiated) thread. This module can be used by AJAX application to run some time-intensive operation, such as encryption, computation, etc. Inclusion of such component into the first Gears release demonstrate Google intension to go after a real, “heavy” offline application ( it is interesting to note that “performance limitations” of online applications was mentioned as one of the reasons for Gears development)    

Open issues

  • So far Google Gears provides only a few new, but basic functions needed for offline application development. Certainly, Gears run-time will need to incorporate more general purpose objects.
  • Certainly security is a biggest open question for Google Gears. So far security issue addressed by significant ( I would say – draconian) restrictions on the run-time functionalities. I expect that developers will need to find a better trade off between security and functionality.
  • Local/centralized data synchronization- so far this issue left to application developer . As this functionality will repeat itself in many application, it is a natural candidate to be added to the run-time module
  • Porting AJAX application to the Gears may be not so trivial task – sometimes a full redesign may be necessary. Lack of server-side capabilities may require reimplementation of many server functions.
  • “Stolen laptop” issues – quite often security-sensitive applications build in client-server manner to avoid storing important information on the local disks. Gears approach breaks this assumption. Probably some kind of “encrypted” storage solution has to be offered.