简体   繁体   中英

Client-Side timeout couchbase node js

I am trying to send few hundreds (448 to be exact) of small documents (20 KB each) to my Couchbase server which has been setup using couchbase AMI . I used the following code in Node.JS

var couchbase = require('couchbase');
var cluster = new couchbase.Cluster('couchbase://54.xx.xxx.xxx:8091');
var bucket = cluster.openBucket('myBucket', 'password', function(err) {
    if(err){
        console.log("Can't open bucket");
        throw err;
    }
    else {
        console.log("Successfully opened bucket");
    }
});
function addToDatabase(data) {
    var key = some key;
    bucket.upsert(key, data, function(err, result) {
        if (err) {
            return console.log(err);
        }
        console.log(result);

    });
}

It sends about 50 documents successfully and then gives me a timeout error:

{ [CouchbaseError: Client-Side timeout exceeded for operation. Inspect network conditions or increase the timeout]  message: 'Client-Side timeout exceeded for operation. Inspect network conditions or increase the timeout',  code: 23 }

I am using the latest version(2.1.2) of couchnode .

I increased the timeout on bucket connection (bucket.operationTimeout=500*1000). After this change it sends all the documents successfully, but it is not a solution because I would not know what is the best value for operationTimeout. Any suggestion would be appreciated.

It sounds to me like you are resource constrained on your client, like file descriptors (something MacOS is known to have not enough of), RAM, sockets, something. I bet if you were to spin up another AWS instance, you'd see this same code load your data in no time and get the access times you are looking for.

I have the same issue with CouchBase on AWS. I solved it by opening the following ports to anyone:

22 tcp 0.0.0.0/0
4369 tcp 0.0.0.0/0
4984 tcp 0.0.0.0/0
8080 tcp 0.0.0.0/0
8088 tcp 0.0.0.0/0
8091 tcp 0.0.0.0/0
8092 tcp 0.0.0.0/0
11209 tcp 0.0.0.0/0
11210 tcp 0.0.0.0/0
11211 tcp 0.0.0.0/0
11214 tcp 0.0.0.0/0
11215 tcp 0.0.0.0/0
18091 tcp 0.0.0.0/0
18092 tcp 0.0.0.0/0

For more info see: http://docs.couchbase.com/couchbase-manual-2.5/cb-install/#network-ports

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM