High CPU usage with moderate load

I am using Couchbase Server on stage environment. Things were working fine until yesterday. But since today I am observing high CPU usage when the load is increased moderately. (PFA)

Couchbase cluster configuration:-

  1. 3 node cluster running (4.5.1-2844 Community Edition (build-2844)) each having m4.2xlarge(8 cores, 32 GB RAM) AWS machines.

  2. Data RAM quota: 25000 MB
    Index RAM quota: 2048MB

  3. It has 9 buckets. And used bucket is having 9 GB RAM (i.e. 3 GB per cluster)

Note:- Since we are using community edition, each node is running Data, Full Text ,Index and query service.

Let me know if I’ve done some misconfiguration or if any optimization required.

Both Views and N1QL queries can be arbitrarily complex (and in general are more resource intensive than Key/Value requests).

As such it’s not unexpected that your resource usage will go up once you start performing View and N1QL queries.

Maybe you can give some more details on the queries you’re doing, to see if anyone here can suggest optimisations to them?

N1ql query is something like

‘select * from bucket where doc=“abc” limit 5’

and for View map function is something like
function (doc, meta) {if(doc.docType=='abc')emit(meta.id, null)}

Followed by reduce _count.

While view returns totalCount, N1QL is for returning results. Since totalCount is less likely to change I’ve chosen View instead of N1ql for this.

Could you post EXPLAIN select * from bucket where doc=“abc” limit 5;

Also you can try the following index.

CREATE INDEX ix1 ON bucket(doc);
SELECT  * FROM bucket WHERE doc="abc" LIMIT 5;