Couchbase
  • Why NoSQL?
  • Couchbase Server
  • Download
  • Resources
  • Careers
Home | Forums | SDKs | SDKs

ab performace testing with node.js + couchbase

6 replies [Last post]
  • Login or register to post comments
Wed, 01/16/2013 - 03:27
fengxufeng
Offline
Joined: 01/16/2013
Groups: None

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.

Top
  • Login or register to post comments
Thu, 01/17/2013 - 01:51
tgrall
Offline
Joined: 09/05/2012
Groups: None

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

Top
  • Login or register to post comments
Thu, 01/17/2013 - 02:35
fengxufeng
Offline
Joined: 01/16/2013
Groups: None

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

Top
  • Login or register to post comments
Tue, 06/04/2013 - 09:00
enko
Offline
Joined: 05/28/2013
Groups: None

Running into same issue. Would be great if it was looked into.

Top
  • Login or register to post comments
Tue, 06/04/2013 - 09:23
tgrall
Offline
Joined: 09/05/2012
Groups: None

hello Enko

Are you using Couchnode 0.0.12?

Regards

__________________

Tug
@tgrall

Top
  • Login or register to post comments
Tue, 06/04/2013 - 11:39
enko
Offline
Joined: 05/28/2013
Groups: None

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.

Top
  • Login or register to post comments
Tue, 06/04/2013 - 20:07
enko
Offline
Joined: 05/28/2013
Groups: None

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.

Top
  • Login or register to post comments
  • Login or register to post comments
  • Login
  • Register

Company

  • About Us
  • Leadership
  • Customers
  • Partners
  • Contact Us

Product

  • Couchbase Server
  • Couchbase SDKs
  • Use Cases
  • Documentation
  • Forums

Open Source

  • Couchbase Project
  • Couchbase vs. CouchDB

Commercial

  • Subscriptions & Support
  • Training & Services

News

  • Blog
  • Newsletter
  • Press Releases
  • Buzz

Follow Us

    
  • Customer Login
  • Terms of Service
  • Privacy Policy
  • Trademark Policy
  • Site Map

© 2013 COUCHBASE All rights reserved.

Sign in to Couchbase Community

close
  • Create new account
  • Request new password
You are logging into the Forums, Wiki and Issue Tracker