[erlang-questions] Cowboy vs Misultin

Tobias tobias.rodaebel@REDACTED
Tue May 31 11:01:30 CEST 2011


Hi Andy,

I'm kind of fresh to Erlang and wrote a standalone Web Socket server as a learning project. Just out of curiosity, would you mind to run your tests against my implementation just to get an idea if I'm on the right track?

https://github.com/rodaebel/ewsd

$ cd ewsd;
$ make
$ bin/ewsd

The default handler just echoes incoming Web Socket messages.

Thanks in advance,
Tobias

On May 31, 2011, at 10:26 AM, Andy W. Song wrote:

> 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,
>                                                 ["MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM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,
>                                                  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. 
> 
> 
> 
> -- 
> ---------------------------------------------------------------
> 有志者,事竟成,破釜沉舟,百二秦关终属楚
> 苦心人,天不负,卧薪尝胆,三千越甲可吞吴
> 
> 
> 
> 
> -- 
> ---------------------------------------------------------------
> 有志者,事竟成,破釜沉舟,百二秦关终属楚
> 苦心人,天不负,卧薪尝胆,三千越甲可吞吴
> 
> 
> 
> 
> -- 
> ---------------------------------------------------------------
> 有志者,事竟成,破釜沉舟,百二秦关终属楚
> 苦心人,天不负,卧薪尝胆,三千越甲可吞吴
> 
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://erlang.org/mailman/listinfo/erlang-questions

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20110531/9ee65861/attachment.htm>


More information about the erlang-questions mailing list