You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@couchdb.apache.org by Vlad GURDIGA <gu...@gmail.com> on 2009/11/16 12:40:58 UTC
inner mechanics question
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!
Re: inner mechanics question
Posted by Adam Kocoloski <ko...@apache.org>.
On Nov 16, 2009, at 7:18 AM, Vlad GURDIGA wrote:
> On Mon, Nov 16, 2009 at 1:45 PM, Adam Kocoloski <ko...@apache.org> wrote:
>> 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.
>
> Thanks a lot for the quick answer, Adam.
>
> This sounds like Apache's StartServers* right? Is there a way to
> configure the pool size?
>
> * http://httpd.apache.org/docs/2.2/mod/mpm_common.html#startservers
In fact there is no way to configure the pool size, which is a bit of a problem. A malicious user could cause a very large number of processes to be spawned. There's a comment in the source about adding a process limit, not sure if a JIRA ticket is around too. Best,
Adam
Re: inner mechanics question
Posted by Vlad GURDIGA <gu...@gmail.com>.
On Mon, Nov 16, 2009 at 1:45 PM, Adam Kocoloski <ko...@apache.org> wrote:
> 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.
Thanks a lot for the quick answer, Adam.
This sounds like Apache's StartServers* right? Is there a way to
configure the pool size?
* http://httpd.apache.org/docs/2.2/mod/mpm_common.html#startservers
> 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
Re: inner mechanics question
Posted by Adam Kocoloski <ko...@apache.org>.
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