Received: by 10.204.145.140 with SMTP id d12mr1517274bkv.6.1349865176094; Wed, 10 Oct 2012 03:32:56 -0700 (PDT) X-BeenThere: erlang-programming@googlegroups.com Received: by 10.205.124.16 with SMTP id gm16ls219885bkc.7.gmail; Wed, 10 Oct 2012 03:32:55 -0700 (PDT) Received: by 10.204.145.140 with SMTP id d12mr1517272bkv.6.1349865175831; Wed, 10 Oct 2012 03:32:55 -0700 (PDT) Received: by 10.204.145.140 with SMTP id d12mr1517271bkv.6.1349865175795; Wed, 10 Oct 2012 03:32:55 -0700 (PDT) Return-Path: Received: from hades.cslab.ericsson.net (hades.cslab.ericsson.net. [192.121.151.104]) by gmr-mx.google.com with ESMTP id 27si110055bks.3.2012.10.10.03.32.55; Wed, 10 Oct 2012 03:32:55 -0700 (PDT) Received-SPF: pass (google.com: domain of erlang-questions-boun...@erlang.org designates 192.121.151.104 as permitted sender) client-ip=192.121.151.104; Authentication-Results: gmr-mx.google.com; spf=pass (google.com: domain of erlang-questions-boun...@erlang.org designates 192.121.151.104 as permitted sender) smtp.mail=erlang-questions-boun...@erlang.org; dkim=neutral (body hash did not verify) header...@gmail.com Received: from hades.cslab.ericsson.net (hades [192.121.151.104]) by hades.cslab.ericsson.net (Postfix) with ESMTP id B74235C125; Wed, 10 Oct 2012 12:32:48 +0200 (CEST) X-Original-To: erlang-questi...@erlang.org Delivered-To: erlang-questi...@erlang.org Received: from mail-oa0-f53.google.com (mail-oa0-f53.google.com [209.85.219.53]) by hades.cslab.ericsson.net (Postfix) with ESMTP id 4B1485C011 for ; Wed, 10 Oct 2012 12:32:46 +0200 (CEST) Received: by mail-oa0-f53.google.com with SMTP id j6so307637oag.40 for ; Wed, 10 Oct 2012 03:32:45 -0700 (PDT) Received: by 10.60.32.241 with SMTP id m17mr5356677oei.50.1349865165542; Wed, 10 Oct 2012 03:32:45 -0700 (PDT) Received: from mail-oa0-f53.google.com (mail-oa0-f53.google.com [209.85.219.53]) by mx.google.com with ESMTPS id b7sm644400oef.12.2012.10.10.03.32.43 (version=SSLv3 cipher=OTHER); Wed, 10 Oct 2012 03:32:44 -0700 (PDT) Received: by mail-oa0-f53.google.com with SMTP id j6so307615oag.40 for ; Wed, 10 Oct 2012 03:32:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=d/yPqoMwiRIRU2AH2qmhLvzplI9yRV8xEOr42RSPlWw=; b=EKAIsNdCaCZzZy3OFPMg4LPz/TTcB6t0rLIZm6mhxSxulELFv3rqC6gDOleh7JdggY 8pFAKSZgM4wycb6m7uSKc25ODNwVvndh7dWkUBCMiNg7cUWRFXQ4Uwzh1Uy6UO0MBdYA NK/qQCyln5rvR5LJ1rCCrEGiwg2307pnl+DX8jGHwNPPTE3bPSC3egXVJS9WXJjhGdVH DlHIr8VaY1GnPl32EbR1Z3rwG9jAf9mMF+os5lOjJ6d6fHM0dLlvrB+pigqPXDRrpdhS CUNeZIZ4AZwIBNgVNP2rYPyW2S/w8Fcr8rQTiaCK6SGEZlW9VqMi4q/cIeCu4Fhz0CoM keig== d=google.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:x-gm-message-state; bh=d/yPqoMwiRIRU2AH2qmhLvzplI9yRV8xEOr42RSPlWw=; b=KzjalicVCw9MgGCG1VzT7/448XqO1EeoATKMszf4zQmb7qLlQsZzTv5is+lkJjQJsj 03qpAp1CDj7VoRIjWIcy4vTx7Mhtmv4bd9G+Awvdz3+tI3j59/iaegfhLSlCILkS3pCL z6YrO5rzW9/UnmbB9d5u+nKfEdV6mtINkE4lQVsyFWk+aGltVmJ/+xd7i7MAdSpnTUdD Kx76MYfnPpEb7RdWby5wXSJcHkhCFELNDi5kjWiYLUAEAxkJQLrHri8lvpEvgX8hfQDN pXx3PXmT1o+dw9mpDxUD/FaKUUPegwQyfI7gQxnE3kI400jGZa8bxauusNNlic30WO2n wUTQ== MIME-Version: 1.0 Received: by 10.60.8.71 with SMTP id p7mr18837471oea.56.1349865163091; Wed, 10 Oct 2012 03:32:43 -0700 (PDT) Received: by 10.182.64.198 with HTTP; Wed, 10 Oct 2012 03:32:42 -0700 (PDT) In-Reply-To: <50753381.1050...@ninenines.eu> References: <50753381.1050...@ninenines.eu> Date: Wed, 10 Oct 2012 06:32:42 -0400 Message-ID: From: AD To: =?ISO-8859-1?Q?Lo=EFc_Hoguin?= X-Gm-Message-State: ALoCoQkLkxn1PDf2gpTw2+xkCRIvSARgOHSg7y2tF81FRLZTc/sAE5HZl2LhioML1FV3fByEFZD5 Cc: erlang-questi...@erlang.org Subject: Re: [erlang-questions] Cowboy , Concurrency , Tuning X-BeenThere: erlang-questi...@erlang.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: General Erlang/OTP discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: multipart/mixed; boundary="===============4164778154857667200==" Errors-To: erlang-questions-boun...@erlang.org Sender: erlang-questions-boun...@erlang.org --===============4164778154857667200== Content-Type: multipart/alternative; boundary=e89a8ff1c5548a705b04cbb1f9e7 --e89a8ff1c5548a705b04cbb1f9e7 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Thanks Loic. Any reason why websocket connections are not counted ? is there a separate pool for max_connections for websockets? On Wed, Oct 10, 2012 at 4:36 AM, Lo=C3=AFc Hoguin wrot= e: > On 10/10/2012 04:02 AM, AD wrote: > >> hello, >> > > Hey, > > > I currently have a SockJS websocket implementation sitting on top of >> cowboy. We have been going through some tuning/concurrency testing and >> we have improved our results drastically by increasing >> >> ERL_MAX_PORTS to 64000 >> +P parameter to a very high number , around 128000 >> Kernel tuning >> >> With this config on a medium VM we have been able to successfully get >> to around 60,000 connections, up from 4096 so we are headed in the right >> direction :-) >> > > 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 result= s. > > > MY next question is with Cowboy tuning. I notice that the default >> max_connections parameter on the TCP transport is 1024 if not set, but I >> am not hitting this issue. What is the right way to tune NBAcceptor >> pool and the the max_connections setting for the acceptor ? >> > > 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 com= e > at once, how many cores you have, how many concurrent connections you > expect, and so on. > > Right now my start_listener is simply >> >> cowboy:start_listener(my_http_**listener, 200, >> cowboy_tcp_transport, [{port, ?COWBOY_HTTP_PORT}], >> cowboy_http_protocol, [{dispatch, Routes}] >> ). >> >> but i have seen some examples with >> >> cowboy:start_listener(my_http_**listener, 200, >> cowboy_tcp_transport, [{port, ?COWBOY_HTTP_PORT}, >> */{max_connections, infinity}/* ], >> cowboy_http_protocol, [{dispatch, Routes}] >> ). >> > > 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 l= et > it at the default value. > > Websocket connections are not counted in that number. All HTTP connection= s > 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). > > -- > Lo=C4=8Fc Hoguin > Erlang Cowboy > Nine Nines > http://ninenines.eu > --e89a8ff1c5548a705b04cbb1f9e7 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Thanks Loic. =C2=A0Any reason why websocket connections are not counted ? = =C2=A0is there a separate pool for max_connections for websockets?

<= div class=3D"gmail_quote">On Wed, Oct 10, 2012 at 4:36 AM, Lo=C3=AFc Hoguin= <es...@ninenines.eu> wrote:
On 10/10/2012 04:02 AM, AD wrote:
hello,

Hey,


=C2=A0 I currently have a SockJS websocket implementation sitting on top of=
cowboy. =C2=A0We have been going through some tuning/concurrency testing an= d
we have improved our results drastically by increasing

ERL_MAX_PORTS to 64000
+P parameter to a very high number , around 128000
Kernel tuning

=C2=A0 With this config on a medium VM we have been able to successfully ge= t
to around 60,000 connections, up from 4096 so we are headed in the right direction :-)

Well then with the above configuration you're at about the maximum conc= urrent connections you can get. If you increase ERL_MAX_PORTS and +P even m= ore Cowboy shouldn't have any trouble giving you even better results.

=C2=A0 MY next question is with Cowboy tuning. =C2=A0I notice that the defa= ult
max_connections parameter on the TCP transport is 1024 if not set, but I am not hitting this issue. =C2=A0What is the right way to tune NBAcceptor pool and the the max_connections setting for the acceptor ?

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 connection= s come at once, how many cores you have, how many concurrent connections yo= u expect, and so on.

=C2=A0 Right now my start_listener is simply

cowboy:start_listener(my_http_listener, 200,
=C2=A0 =C2=A0 =C2=A0 cowboy_tcp_transport, [{port, ?COWBOY_HTTP_PORT}],
=C2=A0 =C2=A0 =C2=A0 cowboy_http_protocol, [{dispatch, Routes}]
=C2=A0 =C2=A0 =C2=A0).

but i have seen some examples with

cowboy:start_listener(my_http_listener, 200,
=C2=A0 =C2=A0 =C2=A0 cowboy_tcp_transport, [{port, ?COWBOY_HTTP_PORT},
<= /div> */{max_connections, infinity}/* ],
=C2=A0 =C2=A0 =C2=A0 cowboy_http_protocol, [{dispatch, Routes}]
=C2=A0 =C2=A0 =C2=A0).

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.

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 remo= ve the connection from the count (varies depending on your version).

--
Lo=C4=8Fc Hoguin
Erlang Cowboy
Nine Nines
http://ninenines.eu

--e89a8ff1c5548a705b04cbb1f9e7-- --===============4164778154857667200== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ erlang-questions mailing list erlang-questi...@erlang.org http://erlang.org/mailman/listinfo/erlang-questions --===============4164778154857667200==--