Maximum number of channels per user


Our webapp requires granular permissions to documents so we develop a quite complicated mapping between documents and channels. The problem is the number of channels for one user can grow quite big (in the thousands). Is it something recommended or do we really need to trim down the number of channels per user?

I am asking because we see a big delay in updating the _/changes on the client side.


Yes, having a large number of channels per user will slow down requesting _changes.

What is the recommended number of channels per user? Right now, we have in the hundred/low thousand.

When serving a _changes request, Sync Gateway needs to identify the changes in each channel available to the user, and interleave the result in sequence order. Obviously that’s something that requires additional processing as the number of channels increases.

The other implication is on the user processing - during authentication, there will be additional overhead to retrieve and parse the set of channels for a given user.

Having said that, there isn’t really a ‘recommended number of channels’ - it’s more about finding the optimal design for your functional and security requirements. “Fewer channels” would be one goal of that design, but obviously needs to be balanced against other requirements.