[erlang-questions] Avoiding a bottleneck (nitrogen+yaws, app logic, couchbeam+couchdb)
Jeremy Raymond
jeraymond@REDACTED
Mon Dec 14 21:16:11 CET 2009
Hello,
In your design of the requester, does the requester timeout
while waiting for the db if it doesn't receive a timely response or do you
handle db errors another way?
Thanks,
Jeremy
On Mon, Dec 14, 2009 at 2:21 PM, Vasilij Savin <vasilij.savin@REDACTED>wrote:
> Greetings,
>
> We expect proper response and do not return PID back. Command looks like
> this
> RequesterPID ! {response, ResponseData}
>
> where ResponseData is record sent.
>
> Regards,
> Vasilij Savin
>
>
>
> On Mon, Dec 14, 2009 at 8:13 PM, Jeremy Raymond <jeraymond@REDACTED>wrote:
>
>> Hi,
>>
>> Thanks I didn't think of this, but it seems reasonable. In your db
>> interface did you return the PID of the worker back to the calling interface
>> so it would know who to expect the response back from or just accept any
>> response back of the correct type?
>>
>>
>> Thanks,
>>
>> Jeremy
>>
>>
>> On Sun, Dec 13, 2009 at 7:24 PM, Vasilij Savin <vasilij.savin@REDACTED>wrote:
>>
>>> Greetings,
>>>
>>> I can tell you about the solution we used in similar situation. It does
>>> not mean it is optimal, but it was the best we came up with.
>>>
>>> Each gen_server call to db interface will generate a separate handler
>>> thread that will work with couchDB directly. You will need to pass both PID
>>> and NodeID though. Then your client will have to wait for message from that
>>> server thread using standard messaging or if it is gen_server itself - using
>>> handle_info.
>>>
>>> This way interface between DB and frontend hopefully will not be
>>> bottleneck, or at least should scale as each request will be handled by
>>> separate thread.
>>>
>>> I would like to ask others to give opinion on this solution.
>>>
>>> Regards,
>>> Vasilij Savin
>>>
>>
>>
>
More information about the erlang-questions
mailing list