CouchDB: Making it Okay to Work Offline
Join the DZone community and get the full member experience.Join For Free
CouchDB is a distributed database system with peer-based replication (as opposed to master-slave or master-master replication). It allows users and servers to access and update the same shared data while being disconnected, and then bi-directionally replicates those changes later. A peer (laptop, server, mobile) can essentially replicate with any other peer in an ad hoc manner. "Phones can sync with a laptop, laptops can sync with a cloud, and phones can sync with a cloud," said Katz. "The ability to move data around seamlessly is one of the key features of CouchDB." CouchDB's replication features are possible because of its schema-less model, as opposed to the relational model. "If you change one side of the schema [in an RDBMS] you can't replicate anymore." In CouchDB each document has its own built-in schema, so there's no impedance mismatch.
The new WebOS feature will replicate data back and forth from a local Palm device to a CouchDB instance in the cloud. Whenever you're online, data will replicate down to the Palm device and synchronize with that data, which then is replicated back up to the cloud and stored. This allows web apps to work while you're offline and then re-sync once the connection returns. Kats says a CRM (Customer Relations Managment) app is a good example. You could store the collective data for a group of salespeople and replicate that data right down to their smartphones so they've got the client information they need. If they're in the bowels of some corporate building where they can't get reception, they can still access the database and make notes that will be synced with the collective database once their connection returns. All of the other salespeople's notes will replicate down to the re-synced phone at that point as well.
This kind of technology is essential to the success of the 'Web as a Platform' and web app usage. When an app such as a planner or a game can still work without an internet connection, it bestows upon web apps another major advantage that native apps enjoy. It also makes things a lot easier for developers who usually have to do a lot of database development in order to harness this functionality; with CouchDB, it's automatic.
Katz says that several other handset makers are also expressing interest in utilizing CouchDB. Right now CouchDB has been ported to Android and Nokia N900 (Maemo), and soon - Palm's WebOS. CouchDB is also a core part of the Ubuntu OS with the Ubuntu One Service. "While other organizations are still adding CouchDB to their technology, Ubuntu is one company that's already out there using CouchDB in production, and it works," said Katz. Could other operating systems follow suit? Canonical is also working on a mobile version of Ubuntu that would also include CouchDB.
CouchDB has proved its mettle quite well in production environments despite the fact that it is still in beta status and hasn't reached version 1.0. All that's left to do before version 1.0 is some polishing of the APIs. Katz says the core storage engine has been solid and reliable for a long time. We can expect a 1.0 release sometime within the next few months.
Opinions expressed by DZone contributors are their own.