I have just about 3K json documents in bucket and each document size is about 1KB only.
Following are CB and machine details.
Couchbase - 4.0.0-4047 Enterprise Edition (Single server)
Total allocated RAM - 600MB
InUse - 254MB
Querying against view takes approx 180millisec. I think this is still high considering very few documents are present in bucket. Using Stale=False and it’s development view.
If i run parallel requests to view the response time degrades a lot.
5 parallel calls = avg response time is ~230 millisec
10 parallel calls = avg response time is ~450 millisec
Please suggest if i need to modify any settings. Also is there any url/doc etc which discusses performance tuning as whole.
No documents are getting updated/created/deleted when I’m requesting view.
I tried using N1QL too but it was much worse than view when parallel queries are made. I did create covering index.
function (doc, meta) {
var currDate = new Date();
currDate.setHours(0,0,0,0);
if(doc.feeId){
if(doc.expirationDate == null || (new Date(doc.expirationDate)) >= currDate){
emit(doc.propertyCode, meta.id);
}
}
}
I dont see much improvement by using stale=true. Following is java code snippet
ViewResult result = testBucket.query(ViewQuery.from("tax_fees", "by_taxes").development(true).stale(Stale.TRUE).key("PHXME"));
How to allocate more disk space . Can i do it without re-creating the bucket ? Don’t see any option for it when i ‘edit’ the bucket. I just see RAM allocation only.
Unrelated to your performance issue, but you shouldn’t use Dates in your map function. Your map function should be pure - i.e. it should always give the same output regardless of when it is run, given a specific input.
If you want to perform operations with dates, you probably want to emit() a date, and then perform the comparison as part of your query.
The reason for this is that the map() function can be applied to documents at different times - i.e. the view could be regenerated (and map function run) when you haven’t modified your document, for example during rebalance.