Skip to content

Introduction to Sync Gateway

Chris Anderson edited this page May 2, 2013 · 6 revisions

Couchbase Sync Gateway

Gluing Couchbase Lite (and TouchDB / CouchDB) to Couchbase Server

About

This is an adapter that can allow Couchbase Server 2* to act as a replication endpoint for Couchbase Lite, TouchDB, CouchDB, and other compatible libraries like PouchDB. It does this by running an HTTP listener process that speaks enough of CouchDB's REST API to serve as a passive endpoint of replication, and using a Couchbase bucket as the persistent storage of all the documents.

It also provides a mechanism called channels that makes it feasible to share a database between a large number of users, with each user given access only to a subset of the database. This is a frequent use case for mobile apps, and one that doesn't work very well with CouchDB.

* It can actually run without Couchbase Server, using a simple built-in database called Walrus. This is useful for testing or for very lightweight use. More details below.

Limitations

  • Document IDs longer than about 180 characters will overflow Couchbase's key size limit and cause an HTTP error.
  • Only a subset of the CouchDB REST API is supported: this is intentional. The gateway is not a CouchDB replacement, rather a compatible sync endpoint.
  • Explicit garbage collection is required to free up space, via a REST call to /_vacuum. This is not yet scheduled automatically, so you'll have to call it yourself.
  • Performance is probably not that great. We'll be optimizing more later.

Architecture

The Sync Gateway provides an HTTP front-end for Couchbase Server, that syncs with Couchbase Lite.

Couchbase Mobile Architecture

License

Apache 2 license, like all Couchbase stuff.

Clone this wiki locally