Hi Couchbase Support,
I am using couchbase server 4.5. We are facing huge performance degradation after application is under load. Couchbase N1QL query (using GSI) degrades with time under constant load.
System Configuration:
Server : AWS C4.X.large
Quad Core 2.9 GHz processor, RAM 8 GB.
Couchbase Server configuration
Data Ram Quota: 5000 MB
Index Ram Quota : 1000MB
Full Text RAM : 256 ( we are not using full text search)
We have around 1.3 million documents.
cbq> explain SELECT meta().id, * FROM cms
WHERE _type = “Product” AND _active = TRUE AND status = “ONLINE” AND -_createdAt < 0 LIMIT 1000 OFFSET 92000;
{
“requestID”: “c96069c1-d603-4664-9a0d-da851950e693”,
“signature”: “json”,
“results”: [
{
“plan”: {
"#operator": “Sequence”,
"~children": [
{
"#operator": “Sequence”,
"~children": [
{
"#operator": “IndexScan”,
“index”: “prod_status_createdAt_idx”,
“index_id”: “717499adf6dda570”,
“keyspace”: “cms”,
“limit”: “(92000 + 1000)”,
“namespace”: “default”,
“spans”: [
{
“Range”: {
“High”: [
"“Product”",
“true”,
"“ONLINE”",
“0”
],
“Inclusion”: 0,
“Low”: [
"“Product”",
“true”,
"“ONLINE”",
“null”
]
}
}
],
“using”: “gsi”
},
{
"#operator": “Parallel”,
"~child": {
"#operator": “Sequence”,
"~children": [
{
"#operator": “Fetch”,
“keyspace”: “cms”,
“namespace”: “default”
},
{
"#operator": “Filter”,
“condition”: “(((((cms
._type
) = “Product”) and ((cms
._active
) = true)) and ((cms
.status
) = “ONLINE”)) and ((-(cms
._createdAt
)) \u003c 0))”
},
{
"#operator": “InitialProject”,
“result_terms”: [
{
“expr”: “(meta(cms
).id
)”
},
{
“expr”: “self”,
“star”: true
}
]
},
{
"#operator": “FinalProject”
}
]
}
}
]
},
{
"#operator": “Offset”,
“expr”: “92000”
},
{
"#operator": “Limit”,
“expr”: “1000”
}
]
},
“text”: “SELECT meta().id, * FROM cms
WHERE _type = “Product” AND _active = TRUE AND status = “ONLINE” AND -_createdAt \u003c 0 LIMIT 1000 OFFSET 92000”
}
],
“status”: “success”,
“metrics”: {
“elapsedTime”: “41.561253ms”,
“executionTime”: “41.525795ms”,
“resultCount”: 1,
“resultSize”: 3991
}
}
index : CREATE INDEX prod_status_createdAt_idx
ON cms
(_type
,_active
,status
,(-_createdAt
)) WHERE ((_type
= “Product”) and (_active
= true));
Scenario
Applying load on a server with 30 threads, all calling an API that consequently hits the above query.
But post 60 odd requests, all APIs start throwing timeout exception.
Error in logs below:
19:53:01 [http-nio-8110-exec-56] INFO ib.cms.dao.CouchbaseDao - Executing Query: SELECT meta().id, * FROM cms
WHERE _type = “Product” AND _active = TRUE AND status = “ONLINE” AND -_createdAt < 0 LIMIT 1000 OFFSET 164000
19:53:08 [http-nio-8110-exec-87] ERROR ib.cms.api.controller.ApiExceptionHandler - java.util.concurrent.TimeoutException
java.lang.RuntimeException: java.util.concurrent.TimeoutException
at com.couchbase.client.java.util.Blocking.blockForSingle(Blocking.java:75)
at com.couchbase.client.java.CouchbaseBucket.query(CouchbaseBucket.java:656)
at com.couchbase.client.java.CouchbaseBucket.query(CouchbaseBucket.java:647)
at com.couchbase.client.java.CouchbaseBucket.query(CouchbaseBucket.java:577)
at ib.cms.dao.CouchbaseDao.execute(CouchbaseDao.java:413)
This was produced while doing PT of our application. Please ask if any other detail you need.
We are planning to go live this month. Please help us how we can upgrade the performance.
If we fail to meet 5-10 through (with an avg of 100ms response time) put for such query we wouldn’t be able to go live.