[erlang-questions] Cowboy vs Misultin

Andy W. Song <>
Mon May 30 02:05:30 CEST 2011


I cloned Misultin from GitHub, the latest commit is:
commit 1ab74e3ae1d6c41f8486f798e6ff43b011e2fd97
Author: Roberto Ostinelli <>
Date:   Sat Apr 23 17:33:13 2011 -0700

    removed unnecessary code.

Both Cowboy and Cowboy examples are cloned from GitHub. The last commit to
Cowboy is:
commit 5d698250b228229001ca9966a390bf1545fcd0b0
Author: Loïc Hoguin <>
Date:   Mon May 9 22:01:31 2011 +0200

My change is attached.

Configuration:
Machine 1: run Cowboy or Misultin, ip address 30.0.1.1
Machine 2: run client code, ip address 30.0.1.X, X=2~50, config it by "for
((x=2; x<50; x++)); do ip addr add 30.0.1.$x/24 dev eth0; done"

My machine info(Both machines are identical VMware VMs):
Debian GNU/Linux 6.0.1 (squeeze)
2.6.32-5-amd64
Erlang R14A (erts-5.8).

A little more about Misultin, when it's running, each Websocket connect maps
to two processes:
<0.632.0>             erlang:apply/2                         343       50
 0
                      erlang:hibernate/3                       0
<0.633.0>             erlang:apply/2                          18     1410
 0
                      erlang:hibernate/3                       0
The second one is the one with TCP link.

Thanks
Andy

On Sun, May 29, 2011 at 10:38 PM, Roberto Ostinelli <>wrote:

> 2011/5/29 Andy W. Song <>
>
> Hi,
>>
>> I want to build a C1000K test and see how Erlang performs.
>>
>> Here is the start: Cowboy vs Misultin on WebSocket.
>> Both of them support WebSocket out of box. I use code examples from here<https://github.com/extend/cowboy_examples> and
>> here <https://github.com/ostinelli/misultin/wiki/ExamplesPage>. Both are
>> very simple echo servers. I added erlang:hibernate/3 call into to both
>> Cowboy and Misultin's WebSocket handler loop to save memory.
>>
>> The client code is attached which I modified from this one<https://github.com/MiCHiLU/erlang_websocket>.
>> It's a quick hack with a fixed request and doesn't really do the handshake.
>> run the client by 'sample_client:start(A,B,C)'.
>> A - number of local IP address you want to use.
>> B - number of connections per IP
>> C - base port number per IP.
>> I started with A=20, B=10000 because I don't have that much of memory.
>>
>> What I found:
>> 1. with 200K connections, my client's Erlang instance takes about 2.2G
>> residence memory, about the same for Cowboy and 3.8G for Misultin.
>> 2. When number of connections is higher than 30K, Cowboy's CPU usage is
>> going up and I start to see gen_tcp:connect times out. Misultin's CPU usage
>> is pretty consistent and doesn't cause client time out.
>>
>
>
> please provide complete code to reproduce these tests, environment
> specifications, and configuration settings. i don't see why misultin's
> memory usage should have this much difference and would like to understand
> better. i'm currently keeping two distinct ets tables for open tcp
> connections and open websocket ones, so that could be a spot but is
> currently the only one which i can think of.
>
> very good to see that misultin is being CPU consistent all the way through
> and not timing out on new connections.
>
> r.
>



-- 
---------------------------------------------------------------
有志者,事竟成,破釜沉舟,百二秦关终属楚
苦心人,天不负,卧薪尝胆,三千越甲可吞吴
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20110530/ccfb90ea/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: misultin.diff
Type: text/x-patch
Size: 4947 bytes
Desc: not available
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20110530/ccfb90ea/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: cowboy.diff
Type: text/x-patch
Size: 3501 bytes
Desc: not available
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20110530/ccfb90ea/attachment-0001.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: cowboy_examples.diff
Type: text/x-patch
Size: 1699 bytes
Desc: not available
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20110530/ccfb90ea/attachment-0002.bin>


More information about the erlang-questions mailing list