ab performace testing with node.js + couchbase
Hello,
I did a performance test using apache's ab tool with couchnode and found something wried.
The test script I used is exactly the example.js in couchnode. https://github.com/couchbase/couchnode
var couchbase = require("couchbase"), http = require("http"); var port = 8080; couchbase.connect(require(__dirname+'/tests/config.json'), function(err, bucket) { if (err) {throw(err)} http.createServer(function(req, resp) { bucket.get("hitcount", function(err, doc, meta) { if (!doc) { doc = {count:0}; } doc.count++; resp.writeHead(200); console.log("hits", doc.count); bucket.set("hitcount", doc, meta, function(err) { resp.end('<p>The server has seen '+doc.count+' hits</p>'); }) }) }).listen(port); console.log("listening on <a href="http://localhost:"" title="http://localhost:"">http://localhost:"</a> + port); })
First, I use 10 concurrency with 10 requests, the result is very nice, about 500 requests per second. But once I add the requests to 100, the node.js seems hanging on without any error, and the ab test can not finish until timeout.
Then I remove the "bucket.set(...)" in example.js but keep "bucket.get(...)", and run the ab test again, 10 concurrency with 100 requests. This time, everything works fine. Even with 100 concurrency and 10000 requests, still works very nice.
Finally, I remove the "bucket.get(...)" and put back "bucket.set(...)", it works very good also.
So, it seems that if the script only make a single get call or single set call, the concurrency can be very well. But once combined get and set, the node will stop working.
I really like to use couchnode in my next project, but I am stuck here right now. What should I do to structure my code to get a good concurrency?
I am not good at c or c++. Any help will be appreciated. Thanks in advance.
Thanks tgrall, that will be very nice.
I've also sent a email to Trond and he may look into this issue later once he get available time slot. :)
I just worry about that if I did something wrong in my test.
Regards,
Xufeng
Running into same issue. Would be great if it was looked into.
hello Enko
Are you using Couchnode 0.0.12?
Regards
tgrall, yes I am.
Two calls are being made on the same request, both running couchbase.connect(..) one with .set one with .view in the callbacks.
I tried a workaround using a static field to keep a bucket ref, in case this is some kind of connection pooling issue. Same result. I am lucky to get .5sec response when bucket.view(..) is preceded by bucket.get(..)/bucket.set(..). Most of the responses time out. Removing get/set gives much better results.
Maybe I am utterly lost when it comes to using couchnode driver, but I am porting an asp.net app that uses similar model (one static couchbase connection per domain) and has no problems with same couchbase instance.
Hello,
As you know the node.js Couchbase SDK is still under development (v0.0.11) I will look with the development team what could be the issue of this.
Regards
Tug
@tgrall