I can roughly feel it after about 15K~20K. <br><br><div class="gmail_quote">On Wed, Jun 22, 2011 at 11:24 PM, Loïc Hoguin <span dir="ltr"><<a href="mailto:essen@dev-extend.eu">essen@dev-extend.eu</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">Odd.<br>
<br>
I'll try to run the client you wrote to reproduce whenever I receive the<br>
hardware I'm waiting for. Not sure what could do this though. Do you<br>
have an idea of what's the number of connections before it starts<br>
slowing down?<br>
<div class="im"><br>
On 06/22/2011 05:08 PM, Andy W. Song wrote:<br>
</div><div class="im">> Thanks for the link. I removed the send_interval call and retested but<br>
> it didn't make much of a difference. It still takes about 7 and half<br>
> minutes to create 100K connections. During creation I can see several<br>
> time outs from client side. And the creation speed gets slower when the<br>
> number of connections gets higher. Although the average CPU usage<br>
> doesn't change much.<br>
><br>
> After creation, with 1.5MB/s traffic, the CPU usage is still about the<br>
> same as before which is 30%.<br>
><br>
> Cheers.<br>
> Andy<br>
><br>
> On Wed, Jun 22, 2011 at 10:34 PM, Loïc Hoguin <<a href="mailto:essen@dev-extend.eu">essen@dev-extend.eu</a><br>
</div><div class="im">> <mailto:<a href="mailto:essen@dev-extend.eu">essen@dev-extend.eu</a>>> wrote:<br>
><br>
> Memory usage sounds a bit high for cowboy_http_req:compact. But maybe<br>
> not. Good point though it's already in the examples just like hibernate.<br>
> My bad.<br>
><br>
> On the other hand if you have a timer per connection it's definitely not<br>
> going to scale, timers are very slow so having 100k timers isn't going<br>
> to work well. Remove the send_interval and it should work a lot better.<br>
><br>
> For future reference:<br>
> <a href="http://www.erlang.org/doc/efficiency_guide/commoncaveats.html#id58959" target="_blank">http://www.erlang.org/doc/efficiency_guide/commoncaveats.html#id58959</a><br>
><br>
> Waiting for yet another comparison, have fun. :)<br>
><br>
> On 06/22/2011 04:27 PM, Andy W. Song wrote:<br>
> > I actually didn't patch. I want to keep my change as small as<br>
> possible.<br>
> > I will remove that send_interval and test it again. Sorry I didn't pay<br>
> > much attention about this.<br>
> ><br>
> > BTW, how can you tell I used or did not use<br>
> cowboy_http_req:compact? And<br>
> > I see hibernate is already the default behavior, isn't it?<br>
> ><br>
> > Thanks<br>
> > Andy<br>
> ><br>
> > On Wed, Jun 22, 2011 at 10:06 PM, Loïc Hoguin <<a href="mailto:essen@dev-extend.eu">essen@dev-extend.eu</a><br>
> <mailto:<a href="mailto:essen@dev-extend.eu">essen@dev-extend.eu</a>><br>
</div><div><div></div><div class="h5">> > <mailto:<a href="mailto:essen@dev-extend.eu">essen@dev-extend.eu</a> <mailto:<a href="mailto:essen@dev-extend.eu">essen@dev-extend.eu</a>>>> wrote:<br>
> ><br>
> > Hello,<br>
> ><br>
> > Did you fix the many issues in your cowboy application code I<br>
> reported<br>
> > in my previous emails? I see you removed the receive after from<br>
> > misultin, did you remove it from cowboy too? You could very<br>
> well just be<br>
> > measuring Erlang's timer modules bad performance there.<br>
> ><br>
> > Also I see you're not using cowboy_http_req:compact and the<br>
> hibernate<br>
> > option for cowboy that is doing it properly (unlike your patch).<br>
> ><br>
> > And again, you should probably come to IRC and ask for advice<br>
> from the<br>
> > other people benchmarking it.<br>
> ><br>
> > Cheers.<br>
> ><br>
> > On 06/22/2011 03:14 PM, Andy W. Song wrote:<br>
> > > OK, the competition comes again. I finally wrote a client that<br>
> > performs<br>
> > > decently. It's here<br>
> > <<a href="https://github.com/awsong/Golang-WebSocket-Client" target="_blank">https://github.com/awsong/Golang-WebSocket-Client</a>>.<br>
> > ><br>
> > > I tested my previous Cowboy first( I changed send_interval from<br>
> > 1000 to<br>
> > > 900000 of line 64 of src/websocket_handler.erl in<br>
> cowboy_examples ).<br>
> > > Here is the version:<br>
> > > *Cowboy_examples*: 343d002 Initial commit with a default and<br>
> websocket<br>
> > > handler.<br>
> > > *Cowboy*: 5d69825 Add a max_connections transport option,<br>
> Mon May 9<br>
> > > 22:01:31 2011<br>
> > ><br>
> > > The command line I use on the client is "./conn -c 10000 -n<br>
> 10". It'll<br>
> > > create 100K connections, 10K per IP to the server. It takes<br>
> about<br>
> > 7 and<br>
> > > half minutes to finish creating these connections. During the<br>
> > creation,<br>
> > > server CPU usage is about 110%(dual core), client cpu usage is<br>
> > under 20%.<br>
> > ><br>
> > > Server memory usage(Cowboy residence memory) :<br>
> > > Right after Cowboy starts: 525M<br>
> > > After 100K connection established: 1842M<br>
> > > After 5M packets passed: 2824M<br>
> > > After 9M packets passed: 3231M<br>
> > > After 87.7 M packets passed, 5746M<br>
> > > [{total,<a href="tel:4155518040" value="+14155518040">4155518040</a> <tel:<a href="tel:4155518040" value="+14155518040">4155518040</a>> <tel:<a href="tel:4155518040" value="+14155518040">4155518040</a><br>
</div></div>> <tel:<a href="tel:4155518040" value="+14155518040">4155518040</a>>> <tel:<a href="tel:4155518040" value="+14155518040">4155518040</a> <tel:<a href="tel:4155518040" value="+14155518040">4155518040</a>><br>
> > <tel:<a href="tel:4155518040" value="+14155518040">4155518040</a> <tel:<a href="tel:4155518040" value="+14155518040">4155518040</a>>>>},<br>
<div><div></div><div class="h5">> > > {processes,1701318856},<br>
> > > {processes_used,1701299096},<br>
> > > {system,2454199184},<br>
> > > {atom,497457},<br>
> > > {atom_used,482279},<br>
> > > {binary,1787851232},<br>
> > > {code,4041219},<br>
> > > {ets,41231176}]<br>
> > > There seems a memory leak. If I don't stop, the memory usage<br>
> will keep<br>
> > > going higher. 40% CPU, 1.5 MB/s traffic.<br>
> > ><br>
> > > *Latest Cowboy and Cowboy_examples* (same send_interval<br>
> change). It<br>
> > > takes about 7 and half minutes to finish creating 100K<br>
> connections.<br>
> > > During the creation, server CPU usage is about 110%(dual<br>
> core), client<br>
> > > cpu usage is under 20%. After 158.9M packets passed, 1464M<br>
> residence<br>
> > > memory used, 30% CPU, 1.5 MB/s traffic, .<br>
> > ><br>
> > > *Latest Misultin* from github, with patch (see attachment):<br>
> > > It takes about 45s to finish creating 100K connections, during<br>
> > creation<br>
> > > cpu usage is 120%. After creation, residence memory usage is<br>
> > 2684M. And<br>
> > > it goes down slowly to 1416M after 40M packets are passed, cpu<br>
> > usage is<br>
> > > about 50%<br>
> > ><br>
> > > Another thing worth to note is that when I hit CTRL-C on the<br>
> client<br>
> > > side, misultin will quickly destroy the connections and<br>
> release memory<br>
> > > and go back to normal. But Cowboy will consume almost all<br>
> the cpu time<br>
> > > and stay there for a long time (I didn't have the patience<br>
> to measure<br>
> > > how long, so just hit ctrl-c to quick erlang).<br>
> > ><br>
> > > Cheers<br>
> > > Andy<br>
> > ><br>
> > ><br>
> > > On Wed, Jun 1, 2011 at 8:26 PM, Andy W. Song<br>
> <<a href="mailto:wsongcn@gmail.com">wsongcn@gmail.com</a> <mailto:<a href="mailto:wsongcn@gmail.com">wsongcn@gmail.com</a>><br>
> > <mailto:<a href="mailto:wsongcn@gmail.com">wsongcn@gmail.com</a> <mailto:<a href="mailto:wsongcn@gmail.com">wsongcn@gmail.com</a>>><br>
> > > <mailto:<a href="mailto:wsongcn@gmail.com">wsongcn@gmail.com</a> <mailto:<a href="mailto:wsongcn@gmail.com">wsongcn@gmail.com</a>><br>
> <mailto:<a href="mailto:wsongcn@gmail.com">wsongcn@gmail.com</a> <mailto:<a href="mailto:wsongcn@gmail.com">wsongcn@gmail.com</a>>>>> wrote:<br>
> > ><br>
> > > BTW, the latest version uses less memory too, about 3.2G<br>
> for 200K<br>
> > > connections.<br>
> > ><br>
> > ><br>
> > > On Wed, Jun 1, 2011 at 8:23 PM, Andy W. Song<br>
> > <<a href="mailto:wsongcn@gmail.com">wsongcn@gmail.com</a> <mailto:<a href="mailto:wsongcn@gmail.com">wsongcn@gmail.com</a>><br>
> <mailto:<a href="mailto:wsongcn@gmail.com">wsongcn@gmail.com</a> <mailto:<a href="mailto:wsongcn@gmail.com">wsongcn@gmail.com</a>>><br>
> > > <mailto:<a href="mailto:wsongcn@gmail.com">wsongcn@gmail.com</a> <mailto:<a href="mailto:wsongcn@gmail.com">wsongcn@gmail.com</a>><br>
> <mailto:<a href="mailto:wsongcn@gmail.com">wsongcn@gmail.com</a> <mailto:<a href="mailto:wsongcn@gmail.com">wsongcn@gmail.com</a>>>>> wrote:<br>
> > ><br>
> > > Missed one attachment.<br>
> > ><br>
> > ><br>
> > > On Wed, Jun 1, 2011 at 8:21 PM, Andy W. Song<br>
> > <<a href="mailto:wsongcn@gmail.com">wsongcn@gmail.com</a> <mailto:<a href="mailto:wsongcn@gmail.com">wsongcn@gmail.com</a>><br>
> <mailto:<a href="mailto:wsongcn@gmail.com">wsongcn@gmail.com</a> <mailto:<a href="mailto:wsongcn@gmail.com">wsongcn@gmail.com</a>>><br>
> > > <mailto:<a href="mailto:wsongcn@gmail.com">wsongcn@gmail.com</a> <mailto:<a href="mailto:wsongcn@gmail.com">wsongcn@gmail.com</a>><br>
> <mailto:<a href="mailto:wsongcn@gmail.com">wsongcn@gmail.com</a> <mailto:<a href="mailto:wsongcn@gmail.com">wsongcn@gmail.com</a>>>>> wrote:<br>
> > ><br>
> > > I tested out the latest Misultin with this<br>
> change, CPU<br>
> > usage<br>
> > > is about 2 to 3 percent lower.<br>
> > ><br>
> > > With the attached Misultin package, I can still<br>
> reproduce<br>
> > > the large packet problem.<br>
> > ><br>
> > > With latest version, Misultin doesn't report any<br>
> > error. But<br>
> > > it doesn't reply to the client either. Seems it<br>
> just drops<br>
> > > the packet. Another attached file is the tcpdump<br>
> result.<br>
> > ><br>
> > > I will try Mochiweb later just to compare.<br>
> > ><br>
> > ><br>
> > > On Wed, Jun 1, 2011 at 12:09 AM, Roberto Ostinelli<br>
> > > <<a href="mailto:roberto@widetag.com">roberto@widetag.com</a><br>
> <mailto:<a href="mailto:roberto@widetag.com">roberto@widetag.com</a>> <mailto:<a href="mailto:roberto@widetag.com">roberto@widetag.com</a><br>
> <mailto:<a href="mailto:roberto@widetag.com">roberto@widetag.com</a>>><br>
> > <mailto:<a href="mailto:roberto@widetag.com">roberto@widetag.com</a> <mailto:<a href="mailto:roberto@widetag.com">roberto@widetag.com</a>><br>
> <mailto:<a href="mailto:roberto@widetag.com">roberto@widetag.com</a> <mailto:<a href="mailto:roberto@widetag.com">roberto@widetag.com</a>>>>> wrote:<br>
> > ><br>
> > ><br>
> > > On May 31, 2011, at 12:54 PM, Andy W. Song<br>
> wrote:<br>
> > ><br>
> > >> Would you mind testing it using my C<br>
> client? Search<br>
> > >> "->len" and give<br>
> > >> it a value between 1500 and 2000, hopefully<br>
> > you'll see<br>
> > >> the result I<br>
> > >> saw.<br>
> > >><br>
> > >> Regards<br>
> > >> Andy<br>
> > ><br>
> > > Hi Andy,<br>
> > ><br>
> > > will do that.<br>
> > ><br>
> > > Meanwhile, I've added an undocumented option,<br>
> > > {ws_no_header, true} so that headers are not<br>
> > duplicated<br>
> > > in the record and should use less memory.<br>
> plus, I've<br>
> > > optimized binary code for websockets.<br>
> > ><br>
> > > can you please retry the test so we have a<br>
> matter of<br>
> > > comparison?<br>
> > ><br>
> > > the only thing you need to change is to add this<br>
> > option<br>
> > > in misultin initialization, i.e.:<br>
> > ><br>
> > > % start misultin http server<br>
> > > start(Port) -><br>
> > > misultin:start_link([<br>
> > > *{ws_no_header, true},*<br>
> > > {port, Port}, {loop, fun(Req) -><br>
> handle_http(Req,<br>
> > Port)<br>
> > > end},<br>
> > > {ws_loop, fun(Ws) -> handle_websocket(Ws) end},<br>
> > > {ws_autoexit, false}<br>
> > > ]).<br>
> > ><br>
> > > please let me know...<br>
> > ><br>
> > > r.<br>
> > ><br>
> > ><br>
> > ><br>
> > ><br>
> > > --<br>
> > ><br>
> > ---------------------------------------------------------------<br>
> > > 有志者,事竟成,破釜沉舟,百二秦关终属楚<br>
> > > 苦心人,天不负,卧薪尝胆,三千越甲可吞吴<br>
> > ><br>
> > ><br>
> > ><br>
> > ><br>
> > > --<br>
> > ><br>
> > ---------------------------------------------------------------<br>
> > > 有志者,事竟成,破釜沉舟,百二秦关终属楚<br>
> > > 苦心人,天不负,卧薪尝胆,三千越甲可吞吴<br>
> > ><br>
> > ><br>
> > ><br>
> > ><br>
> > > --<br>
> > ><br>
> ---------------------------------------------------------------<br>
> > > 有志者,事竟成,破釜沉舟,百二秦关终属楚<br>
> > > 苦心人,天不负,卧薪尝胆,三千越甲可吞吴<br>
> > ><br>
> > ><br>
> > ><br>
> > ><br>
> > > --<br>
> > > ---------------------------------------------------------------<br>
> > > 有志者,事竟成,破釜沉舟,百二秦关终属楚<br>
> > > 苦心人,天不负,卧薪尝胆,三千越甲可吞吴<br>
> > ><br>
> > ><br>
> > ><br>
> > > _______________________________________________<br>
> > > erlang-questions mailing list<br>
> > > <a href="mailto:erlang-questions@erlang.org">erlang-questions@erlang.org</a><br>
> <mailto:<a href="mailto:erlang-questions@erlang.org">erlang-questions@erlang.org</a>><br>
> <mailto:<a href="mailto:erlang-questions@erlang.org">erlang-questions@erlang.org</a><br>
> <mailto:<a href="mailto:erlang-questions@erlang.org">erlang-questions@erlang.org</a>>><br>
> > > <a href="http://erlang.org/mailman/listinfo/erlang-questions" target="_blank">http://erlang.org/mailman/listinfo/erlang-questions</a><br>
> ><br>
> ><br>
> > --<br>
> > Loïc Hoguin<br>
> > Dev:Extend<br>
> ><br>
> ><br>
> ><br>
> ><br>
> > --<br>
> > ---------------------------------------------------------------<br>
> > 有志者,事竟成,破釜沉舟,百二秦关终属楚<br>
> > 苦心人,天不负,卧薪尝胆,三千越甲可吞吴<br>
> ><br>
><br>
><br>
> --<br>
> Loïc Hoguin<br>
> Dev:Extend<br>
><br>
><br>
><br>
><br>
> --<br>
> ---------------------------------------------------------------<br>
> 有志者,事竟成,破釜沉舟,百二秦关终属楚<br>
> 苦心人,天不负,卧薪尝胆,三千越甲可吞吴<br>
><br>
<br>
<br>
</div></div><font color="#888888">--<br>
Loïc Hoguin<br>
Dev:Extend<br>
</font></blockquote></div><br><br clear="all"><br>-- <br><div>---------------------------------------------------------------</div><div>有志者,事竟成,破釜沉舟,百二秦关终属楚</div><div>苦心人,天不负,卧薪尝胆,三千越甲可吞吴</div><br>