N1QL performance is very poor

var http = require(“http”);
var Path = require(‘path’);
var Hapi = require(“hapi”);
var couchbase = require(‘couchbase’);
var myCluster = new couchbase.Cluster(‘couchbase://10.130.18.96:8091’);
var myBucket2 = myCluster.openBucket(‘adInfo’);
var myBucket3 = myCluster.openBucket(‘campInfo’);
var myQuery = couchbase.N1qlQuery;
var jsonData = {“Subject”: “Report a problem”, “Text”: “The worst updation” };
var myQuery = couchbase.N1qlQuery;
var getAll= null;
var response_from_first_filter = null;
var appName =“xyz”;
var Response=null;
var getAll = null;
var http = require(“http”);
var couchbase = require(‘couchbase’);
var myQuery=couchbase.N1qlQuery;
var responseFromFirstFilter = [];
var applicationName =“xyz”;
var responseFromDeepFilter = [];
var responseFromRankFilter = [];
var j=0;
var price=0;
var priceWeight = 1;
var rank = 0;
var moment = require(‘moment’);
var currentDate = moment().format(‘YYYY-MM-DD’);
var currentTime = moment().format(‘HH:mm’);
var genderFromForm= “male”;
var responseFromAdInfo = null;
var responseFromcampInfo = null;
var server = new Hapi.Server();
server.connection({ port: 8889 });
//Homepage
server.route({
method: ‘GET’,
path: ‘/’,
handler:
function (request, reply) {
reply.view(‘index’);
}
});

//Retreive all documents through N1QL
server.route({
method: ‘GET’,
path: ‘/retreive’,
handler:
function(request,reply){

  getAll = myQuery.fromString('SELECT * FROM campInfo USE INDEX(appName USING GSI) WHERE appName= "'+applicationName+'"');
 myBucket3.query(getAll, function(err, resp) {
    if (err) {
       console.log('Error', err);
    }
    // responseFromcampInfo=resp;

reply(resp);
});
}
});

//Starting the server
server.start(function () {
console.log(‘Server running at:’, server.info.uri);
});

I am using a simple getrequest using N1QL from couchbase server and the performance is very poor when the number of requests and connections increase.
What could be the problem? And are there any advantage of using views over N1QL?
I have tried using get
AB shows 5000 ms around with 10000 -n and 250 -c

Hi @ArbaazDossani, need a few details to help out;

  • the version you are using
  • data size and scale details, #items, size of documents and selectivity of appname
  • explain output
  • HW details and topology
    thanks
    -cihan

Hi @cihangirb
Thanks for the Quick reply
First we tried on 4.0.0 Beta with N1QL
We were working on 6 documents only
and getting the response time 15 sec

Then we tried with Couchbase 3 using views
we are working on 10,000 documents(expecting it 10 fold in future)
Tried 3000 requests and got 1.9sec response time

We are working on 40 core machine and 192GB RAM

thanks
-Arbaaz

Can I get an explain output? and sample data if you can provide that? I am at cihan@couchbase.com.

I’d not recommend looking at performance before we are done with development but if you want to see a more recent build, Please email me and I can provide a fresher build to help move you to a more recent version. We are still tuning performance on the product and that will continue to the end I am sure so the final version may present a different result altogether.
thanks
-cihan