[erlang-questions] Cowboy vs Misultin

Andy W. Song wsongcn@REDACTED
Tue May 31 10:26:59 CEST 2011


1400+2 WebSocket packet size is OK. Packet rate stays the same. CPU usage
goes up from 24% to 37%.

CPU usage proportion to packet size is not a good sign. handle_data()
function will traverse the list to find 255, which is low efficient. Can it
be improved?

Regards
Andy

On Tue, May 31, 2011 at 4:08 PM, Andy W. Song <wsongcn@REDACTED> wrote:

> I guess Misultin's handle_data function has some problem if TCP packets are
> large, perhaps larger than ethernet MTU.
>
> If I use 1536+2 WebSocket packet size, I got follow error form Misultin(I
> fill up char 'M' with my packet):
>
> http process <0.515.0> has died with reason: {function_clause,
>                                               [{misultin_websocket,
>                                                 handle_data,
>
> ["MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM",
>
>  [],#Port<0.1012>,<0.516.0>,
>                                                  http,true,<0.40.0>]},
>
>  {misultin_websocket,connect,4},
>
>  {misultin_http,handle_data,9}]}, removing from references of open
> connections
>
> On Tue, May 31, 2011 at 2:18 PM, Andy W. Song <wsongcn@REDACTED> wrote:
>
>> I installed R14B03.
>>
>> I'm disappointed with my Erlang WebSocket client's performance.  So I
>> wrote a C version using libev, code attached.
>> Usage:
>> ./new A B C
>> A/B/C have the same meaning of Erlang client.
>>
>> Here is the result with my new client:
>>
>> misultin_websocket_binary_example(file attached, no change to rest of
>> Misultin)
>> start 519M
>> 3.5G
>> CPU,  with 550 Kbyte/s traffic about 23%.
>>
>> misultin_websocket_example
>> start 519M
>> 3.5G
>> CPU, with 550 Kbyte/s traffic about 25%.
>>
>> Packet size is 512 bytes, client sends packets, server echo.
>>
>> Cowboy can't pass my test this time. Connections start dropping from 20K,
>> don't know why.
>>
>> Regards
>> Andy
>>
>> On Mon, May 30, 2011 at 10:20 PM, Roberto Ostinelli <roberto@REDACTED>wrote:
>>
>>> 2011/5/30 Andy W. Song <wsongcn@REDACTED>
>>>
>>>> Version 14.a-dfsg-3 is what comes with Debian stable. It's on my company
>>>> machine which now doesn't have internet access anymore.
>>>>
>>>> Debian splits Erlang to a bunch of small packages. I may download a
>>>> single Erlang/OTP package and install manually later on.
>>>>
>>>> Thanks
>>>> Andy
>>>>
>>>
>>> misultin has just been updated in the master branch [0.8-dev] to support
>>> binary mode.
>>>
>>> i would be very interested if you could redo your tests using the binary
>>> example for websockets:
>>>
>>> https://github.com/ostinelli/misultin/blob/master/examples/misultin_websocket_binary_example.erl
>>>
>>> let's see if loic hit the spot :)
>>>
>>> r.
>>>
>>
>>
>>
>> --
>> ---------------------------------------------------------------
>> 有志者,事竟成,破釜沉舟,百二秦关终属楚
>> 苦心人,天不负,卧薪尝胆,三千越甲可吞吴
>>
>>
>
>
> --
> ---------------------------------------------------------------
> 有志者,事竟成,破釜沉舟,百二秦关终属楚
> 苦心人,天不负,卧薪尝胆,三千越甲可吞吴
>
>


-- 
---------------------------------------------------------------
有志者,事竟成,破釜沉舟,百二秦关终属楚
苦心人,天不负,卧薪尝胆,三千越甲可吞吴
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20110531/f2aff649/attachment.htm>


More information about the erlang-questions mailing list