[erlang-questions] my socket can't handle the load

Pablo Platt pablo.platt@REDACTED
Sat Jun 5 17:36:32 CEST 2010


That was the problem. 
Dmitry and Per you were both right.

Thanks




________________________________
From: Per Hedeland <per@REDACTED>
To: pablo.platt@REDACTED
Cc: erlang-questions@REDACTED
Sent: Sat, June 5, 2010 1:31:58 PM
Subject: Re: [erlang-questions] my socket can't handle the load

Pablo Platt <pablo.platt@REDACTED> wrote:
>
>I was able to identify exactly when the issue happens.
>As long as only one request at a time is sent to the driver it works fine:
>request1, response1, request2, response2...
>
>If the client sends several requests as fast as it can without waiting for a response it breaks.
>debug messages show the following:
>request1, request2, response1, request3, response2, Error timeout for request3, response3

I think the problem is just that while your handle_info() callback tries
to handle incomplete responses and additional data (and presumably you
have some framing to allow you to do that), you never process more than
one response per handle_info() invocation. I.e. what is happening here
is most likely that the complete response3 arrives concatenated onto
response2, but you don't process it - I believe you will find response3
sitting in State#state.resp. The fix is then (of course) to keep
processing the data you received until there are no more complete
responses. (I'm assuming that you can't make use of some variant of the
nice 'packet' option, see inet:setopts/2.)

--Per Hedeland

________________________________________________________________
erlang-questions (at) erlang.org mailing list.
See http://www.erlang.org/faq.html
To unsubscribe; mailto:erlang-questions-unsubscribe@REDACTED


      


More information about the erlang-questions mailing list