[erlang-questions] Cowboy vs Misultin

Loïc Hoguin essen@REDACTED
Sun May 29 16:26:34 CEST 2011


Hello,

Main author of cowboy here. I've been assisting other people in
performing websocket tests, and so far all the results have been very
similar.

> I added erlang:hibernate/3 call into to both Cowboy
> and Misultin's WebSocket handler loop to save memory.

Good point, we were planning to add a hibernate option as a handler
return value like gen_server and friends are doing.

> 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.

That's good to know. I wasn't expecting such a difference so it's a good
surprise. :)

> 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.

CPU usage in cowboy's websockets isn't that great yet. That's partly
because we haven't performed any optimization of the websocket code yet.
Friday we were talking about it and I've identified a couple things to
try to improve it. We were planning to test on monday.

If you want you can try them out. Everything is in
cowboy_http_websocket. There is:

* L139: binary:match is probably too expensive to simply find byte 255.
* L176: we are constructing a new binary that copies the message to send
because of the prepending. We should instead use an iolist():
    Transport:send(Socket, [0, Data, 255]).

That's it for now without actually testing. The second one is probably
the main culprit.

We'll be looking more into it tomorrow, you can find us on #erlounge or
#erlang on freenode to follow advancement.

Thanks.

-- 
Loïc Hoguin
Dev:Extend



More information about the erlang-questions mailing list