incubator-couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Joran Greef <jo...@sexbyfood.com>
Subject Concurrent Requests From Multiple Clients For The Same Resource
Date Mon, 18 May 2009 12:22:49 GMT
Hi everyone,

I opened up several Rhino shells this morning and ran the following  
code from each of them at the same time:

var test = function () {
     for (var index = 0; index < 40; index++) {
         var start = new Date().getTime(), options = {output:"",  
err:""};
         runCommand("curl", "http://127.0.0.1:5984/tables/_all_docs?include_docs=true 
", options);
         print((new Date().getTime() - start) + "ms");
     }
};
test();

It causes each Rhino shell to make 40 requests to Couch and for each  
displays the time taken to complete the request. I gave the first  
shell a head start, then started test() in another and so on, until 4  
shells were making requests concurrently.

The first couple requests in the first shell took 500ms on average to  
retrieve 527kb. But I was surprised to see that as each of the other  
shells started kicking in and making requests, the average response  
time doubled accordingly and grew from +/-500ms to +/-1000ms to  
+/-1500ms to +/-2000ms for all 4 shells as if Couch was queueing the  
concurrent requests and handling them in serial.

Couch stats reported an average of 400ms response time (excluding  
Mochiweb) for the duration of the test. Could it be that while Couch  
can handle concurrent requests in parallel, Mochiweb cannot and blocks?

Thanks,

Joran Greef

Mime
View raw message