Indexes versus Views


      Using Indexes to minimize system downtime in Sync Gateway
      Explains the switch from System Views to GSI


      Sync Gateway uses GSI and N1QL to perform a variety of internal operations, including authentication and replication. Prior to Sync Gateway 2.1, it used system Views instead.

      One of the key advantages GSI is that it supports index replicas, which enables Sync Gateway to reduce the downtime — say, during a server upgrade, re-balance or failover — from several hours to a few seconds. It also improves overall query performance.

      Note that this only impacts system views. Users can continue to define views through the Sync Gateway Admin REST API.


      This capability is enabled by default and is supported by two properties in the configuration file which can be adjusted:

      Use of GSI requires Couchbase Server 5.5, with at least one node running the Index Service. Users wanting to run Sync Gateway 2.1 with an older version of Couchbase Server will need to continue to use views, by setting the use_views property.

      Sync Gateway requires the Index Service to be running on at least two Couchbase Server nodes (required for index replica). However, users can run with a single Index Service node by setting Sync Gateway’s num_index_replicas property to zero. Doing so, may result in increased downtime in the event of an index node failure.