aboutsummaryrefslogtreecommitdiffstats
path: root/doc/src/guide/listeners.asciidoc
diff options
context:
space:
mode:
authorjuhlig <[email protected]>2019-05-08 15:05:27 +0200
committerLoïc Hoguin <[email protected]>2019-05-08 16:38:47 +0200
commitd59eef5c737d0b08eb8c16c5316300e863bc935c (patch)
treebe6ab3327717f847677484edf027af9e21266045 /doc/src/guide/listeners.asciidoc
parentaa64151149e947145728a1f1339c689f1100720e (diff)
downloadranch-d59eef5c737d0b08eb8c16c5316300e863bc935c.tar.gz
ranch-d59eef5c737d0b08eb8c16c5316300e863bc935c.tar.bz2
ranch-d59eef5c737d0b08eb8c16c5316300e863bc935c.zip
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.
Diffstat (limited to 'doc/src/guide/listeners.asciidoc')
-rw-r--r--doc/src/guide/listeners.asciidoc26
1 files changed, 23 insertions, 3 deletions
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