From d59eef5c737d0b08eb8c16c5316300e863bc935c Mon Sep 17 00:00:00 2001 From: juhlig Date: Wed, 8 May 2019 15:05:27 +0200 Subject: Add the num_conns_sups option This new option allows configuring the number of connection supervisors. The old behavior can be obtained by setting this value to 1. A value larger than num_acceptors will result in some connection supervisors not being used as the acceptors currently only use one connection supervisor. --- doc/src/guide/listeners.asciidoc | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) (limited to 'doc/src/guide') diff --git a/doc/src/guide/listeners.asciidoc b/doc/src/guide/listeners.asciidoc index 4885c6d..e7ecfec 100644 --- a/doc/src/guide/listeners.asciidoc +++ b/doc/src/guide/listeners.asciidoc @@ -182,9 +182,9 @@ socket and that it is operational. === Limiting the number of concurrent connections The `max_connections` transport option allows you to limit the number -of concurrent connections. It defaults to 1024. Its purpose is to -prevent your system from being overloaded and ensuring all the -connections are handled optimally. +of concurrent connections per connection supervisor (see below). +It defaults to 1024. Its purpose is to prevent your system from being +overloaded and ensuring all the connections are handled optimally. .Customizing the maximum number of concurrent connections @@ -261,6 +261,26 @@ measure to find the best value for your application. echo_protocol, [] ). +=== Customizing the number of connection supervisors + +By default Ranch will use one connection supervisor for each +acceptor process (but not vice versa). Their task is to +supervise the connection processes started by an acceptor. +The number of connection supervisors can be tweaked. + +Note that the association between the individual acceptors and +connection supervisors is fixed, meaning that acceptors will +always use the same connection supervisor to start connection +processes. + +.Specifying a custom number of connection supervisors + +[source,erlang] +{ok, _} = ranch:start_listener(tcp_echo, + ranch_tcp, #{socket_opts => [{port, 5555}], num_conns_sups => 42}], + echo_protocol, [] +). + === When running out of file descriptors Operating systems have limits on the number of sockets -- cgit v1.2.3