On Nov 16, 2009, at 6:40 AM, Vlad GURDIGA wrote:

> Hello!
> 
> Again, I'm not sure whether it's a couchdb-dev@ or couchdb-user@ question.
> 
> I wonder how _shows, _lists, _updates (and maybe others?) couch-side
> code is executed. Is there a single couchjs loaded on couch start and
> it is fed all the functions that are called thought URLs or there is a
> separate couchjs launched for every function?
> 
> Just want to understand what's going on with my code...
> 
> Thank you!

Hi Vlad, the reality is in between those two cases.  CouchDB keeps a pool of 
couchjs processes running.  When one of these processes finishes executing a 
task it does not terminate, but rather returns to an idle state and waits for 
the next command from Couch.  When a _show/_list/_update call comes in, CouchDB 
grabs an idle couchjs, or spawns one if necessary.  It loads the code that it 
wants executed and sends in the input data, then waits for a response.  Best,

Adam

Reply via email to