Google announces Gears: web apps that can run without a net connection

Gears of war: Google is ramping up its attack on desktop apps like Microsoft Office by allowing web apps to run without an internet connection.

Ajax might be the speediest way to deliver applications to your browser but it basically sucks the second you don’t have a stable web connection (think planes trains automobiles and a disturbing number of Australian ISP customers).

Making web applications work effectively offline is the motivation behind Google’s latest technology project Gears which was unveiled at the company’s Developer Day in Sydney (the first of 10 similar events around the world over the next day or so).

Gears is a downloadable browser extension compatible with all the popular browsers on Windows Linux and Mac OS X.

Quite apart from making it possible for mobile workers to ditch their desktop applications enabling offline operation has other benefits as Google engineer Aaron Boodman explained. “If an application can run offline that implies it has local data and that means it can run much faster.”

Getting Gears to work requires a change to the typical Ajax approach which relies on constant (if compact) server communication. While this can induce performance restrictions Boodman said that Google concluded early on that trying to shift to a more PC-native-like approach for building applications wouldn’t be feasible. “We wanted to add just enough to Ajax to make it work offline” he said.

In basic terms Gears works by adding a synchronisation layer and a local database to the Ajax approach. To store data Google has adopted SQLite which runs as a small DLL on local systems. “If you’ve written any database code on the server you can write database code for Gears” Boodman said.

Google has also worked with SQLite’s developers to add full text search to the system. “It wouldn’t be Google if we didn’t have some search in there” Boodman noted. Currently the system can handle millions of documents but a future project (codenamed FTS3) will expand that to tens of millions and add multilingual support.

The other major challenge is ensuring that synchronisation — the bane of every offline/online development project — doesn’t hog too many browser resources. “That synchronisation code really chews up a lot of resources” Boodman said.

To combat that Gears includes WorkerPool which essentially fakes threading for JavaScript by allowing a separate set of code (with its own independent variables) to run alongside the existing application. That could have benefits other than synching. “The WorkerPool should allow a lot of really interesting applications which you couldn’t develop before because the JavaScript would make the browser unresponsive.”

For end users the experience is meant to be transparent. “We want there to be one URL” Boodman said. It should be the same application you always use with no differences.”

Although the Gears software development kit is already available it will probably be a while before Google Docs (or anything else useful) is completely running offline. “This is an early beta release” Boodman said. “It has some rough edges. We know that it will crash occasionally.”

“It’s not meant to be just a Google project” said Google ANZ engineering head Alan Noble. “We hope Gears is just the first step in helping the industry work towards a standard.” Adobe Acrobat Mozilla and Opera have already signed up to the project.

To ensure accessibility Gears code has been released under the New BSD licence which in practice “basically means you can do whatever you want.” Boodman said.

The initial release is largely centred on Firefox although IE is supported for Windows users and a release for Safari should debut soon. “We have code checked in but it’s not quite ready to deploy yet” Boodman said.