Low resident with memory available

Hi there!

Right now i’m trying to understand an issue on our Couchbase cluster.



^ on this image we can see that the resident is very low, but there are lots of available RAM

Why the resident is 12% only ?

Hello Rui_Oliveira

What you are describing is normal and not usually a concern. If you for example deleted a lot of documents to free-up memory, the resident ratio wouldn’t change automatically. Couchbase Server does not optimistically make documents resident when there is memory quota available, instead, non-resident documents are only made resident when they are used by an application; this is what is known as the working set of documents. Over time as you access your documents, the resident ratio would increase naturally. If for some reason you had a requirement to force the cache to fill to a higher resident ratio, you could restart Couchbase Server on each of your cluster nodes and as part of the warm-up process it would re-populate the items in memory, this process is discouraged though as it does incur a downtime while the items are being loaded from disk.

Thanks,
Ian McCloy (Couchbase, Principal Product Manager)

Assuming there is enough memory is available, is there a way to force documents matching a certain criteria to be brought to memory by firing a N1QL query?

Ian is recommending not to do that. Because the next question will be "What do I do on startup when all these documents are loading into RAM and the cluster has decreased performance for other users?

Anyway… selecting the whole document (i.e SELECT * …) would bring them into memory. But would require reading all the documents to the client. So do something that requires accessing the whole document, but doesn’t require returning it over the network. Something like this should work as long as you don’t have length(doc) in an index.

SELECT sum(length(c)) FROM my_collection c WHERE …

btw - that just returns null (not the length of the stringified json).

1 Like