Thanks Loic.  Any reason why websocket connections are not counted ?  is there a separate pool for max_connections for websockets?<br><br><div class="gmail_quote">On Wed, Oct 10, 2012 at 4:36 AM, Loïc Hoguin <span dir="ltr"><<a href="mailto:essen@ninenines.eu" target="_blank">essen@ninenines.eu</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On 10/10/2012 04:02 AM, AD wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
hello,<br>
</blockquote>
<br>
Hey,<div class="im"><br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
  I currently have a SockJS websocket implementation sitting on top of<br>
cowboy.  We have been going through some tuning/concurrency testing and<br>
we have improved our results drastically by increasing<br>
<br>
ERL_MAX_PORTS to 64000<br>
+P parameter to a very high number , around 128000<br>
Kernel tuning<br>
<br>
  With this config on a medium VM we have been able to successfully get<br>
to around 60,000 connections, up from 4096 so we are headed in the right<br>
direction :-)<br>
</blockquote>
<br></div>
Well then with the above configuration you're at about the maximum concurrent connections you can get. If you increase ERL_MAX_PORTS and +P even more Cowboy shouldn't have any trouble giving you even better results.<div class="im">
<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
  MY next question is with Cowboy tuning.  I notice that the default<br>
max_connections parameter on the TCP transport is 1024 if not set, but I<br>
am not hitting this issue.  What is the right way to tune NBAcceptor<br>
pool and the the max_connections setting for the acceptor ?<br>
</blockquote>
<br></div>
NBAcceptor shouldn't be too low but shouldn't be too high either. I found 100 to be a good values but it really depends on how many connections come at once, how many cores you have, how many concurrent connections you expect, and so on.<br>

<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">
  Right now my start_listener is simply<br>
<br>
cowboy:start_listener(my_http_<u></u>listener, 200,<br>
      cowboy_tcp_transport, [{port, ?COWBOY_HTTP_PORT}],<br>
      cowboy_http_protocol, [{dispatch, Routes}]<br>
     ).<br>
<br>
but i have seen some examples with<br>
<br>
cowboy:start_listener(my_http_<u></u>listener, 200,<br>
      cowboy_tcp_transport, [{port, ?COWBOY_HTTP_PORT},<br></div>
*/{max_connections, infinity}/* ],<br>
      cowboy_http_protocol, [{dispatch, Routes}]<br>
     ).<br>
</blockquote>
<br>
If you're using Cowboy 0.6.1 or below and looking for performance, you should set max_connections to infinity. If you're using master, you can let it at the default value.<br>
<br>
Websocket connections are not counted in that number. All HTTP connections are though, so you might want to look at cowboy_listener to see how to remove the connection from the count (varies depending on your version).<span class="HOEnZb"><font color="#888888"><br>

<br>
-- <br>
Loďc Hoguin<br>
Erlang Cowboy<br>
Nine Nines<br>
<a href="http://ninenines.eu" target="_blank">http://ninenines.eu</a><br>
</font></span></blockquote></div><br>