Questions about Sync Gateway Views

Hi,

I have a few questions about how/when views build and our accessed by the sync gateway.
(_design/sync_gateway, _design/sync_housekeeping)

First off, I noticed if we bring up a new gateway for testing, it’ll cause both entire view categories to build (_design/sync_gateway, _design/sync_housekeeping)

Is their any other time I should be cautious of that might cause the view to build.

Further, when the views are building it causes all replication to stop (because the views can’t access the data).
I’m wondering if there would be a way to separate views between gateways (so each gateway would use their own set of views, and they would only need to build the views they’re accessing)

So I’d like to know when/why (_design/sync_gateway, _design/sync_housekeeping) build, if there is any strategy for deploying new sync gateways without bringing replication down.

Any thoughts on this would be appreciated.

Thanks

Is their any other time I should be cautious of that might cause the view to build.

Views are constantly built (indexed), but the most concentrated view indexing happens when:

  • Sync Gateway is brought up for the first time on a bucket with a large amount of existing data that is imported into Sync Gateway in bulk, which creates a lot of view indexing.

  • Sync Gateway is upgraded with new views, which force them to be re-indexed.

I’m wondering if there would be a way to separate views between gateways (so each gateway would use their own set of views, and they would only need to build the views they’re accessing)

Not really, because all Sync Gateways in a horizontal tier use the same Couchbase Server cluster, and it’s Couchbase Server that is responsible for the views.

if there is any strategy for deploying new sync gateways without bringing replication down.

Yes, there is work in progress related to that which will be in the upcoming Sync Gateway 2.0 release. More details here: https://github.com/couchbase/sync_gateway/pull/3201

Some minor clarifications after doing more research.

  1. Bringing up a new sync gateway won’t cause the views to be rebuilt/reindexed unless that new SG is changing the view definitions

  2. If you’re bringing up a new version of SG for testing purposes, you shouldn’t be pointing that at your production bucket (if there are still older versions attempting to use that bucket)

Thanks for the replies @traun

Bringing up a new sync gateway won’t cause the views to be rebuilt/reindexed unless that new SG is changing the view definitions_

In what scenario would bringing up a new gateway cause the view definitions to change? I have seen this happen multiple times, even though the new SG is using the same version as the old SG.

Thanks again