Remove Sync Gateway cache


#1

Greetings,

I have deployed a CB app using the complete CB package: CB Lite 2.0, SG 2.0 and CB Server Community Edition 5.0.1. The app was working fine until we scaled in users, causing more and more traffic and this caused the SG (of which we have 4 with 8GB RAM each balanced with Nginx) started to consume all the RAM causing the system to slow down to a crawl.

We have been tweaking here and there and it looks like the SG is caching too much data, and I want to reduce that, but before I try it out, what are the downsides of reducing cache limits (or even not allowing cache at all) in SG?
In our app users very rarely share documents, and even when it happens, at least 8-12 hours have passed from the creation or last modification of a document.

Any light on this matter would be very appreciated.


#2

Have you tried adjusting the rev_cache_size configuration option?

https://developer.couchbase.com/documentation/mobile/current/guides/sync-gateway/config-properties/index.html#2.0/databases-foo_db-rev_cache_size


#3

That is what I’ve been thinking, I’m going to decrease cache values, do you know what impact this might have?

I.e. the rev_cache_size is 5000 by default, what would happen if I changed it to 500? Would it just cause the system to retrieve from Server more often or slow the whole SG?


#4

Lowering the rev cache size will cause SG to fetch documents from Couchbase server more often, but will allow you to run SG with less memory usage.

Fetching documents that are not in the rev cache will be slightly slower, but it can depend on your data model.
Do lots of users all fetch the same set of documents, or does each user have their own separate documents?


#5

Thanks for your answer.

Each user works with its own documents. Those documents cannot be accesed by other users, until much later in the process (this can go from around 8hrs up to 24hrs)when some specific documents are shared with 1 more user.