summaryrefslogtreecommitdiffstats
path: root/docs/en/ranch
diff options
context:
space:
mode:
authorLoïc Hoguin <[email protected]>2017-06-09 11:44:12 +0200
committerLoïc Hoguin <[email protected]>2017-06-09 11:44:12 +0200
commitf3ab9ef65d948469e864184bcf95114bf8025ad1 (patch)
tree77458e2ece4e95d5e16ae7466ef22750c0edc9ac /docs/en/ranch
parent5a0feb20ace7a923b1101c274ef2ff12fa47a776 (diff)
downloadninenines.eu-f3ab9ef65d948469e864184bcf95114bf8025ad1.tar.gz
ninenines.eu-f3ab9ef65d948469e864184bcf95114bf8025ad1.tar.bz2
ninenines.eu-f3ab9ef65d948469e864184bcf95114bf8025ad1.zip
Release the tale of 2.0 cowboy slides
Diffstat (limited to 'docs/en/ranch')
-rw-r--r--docs/en/ranch/1.3/guide/embedded.asciidoc2
-rw-r--r--docs/en/ranch/1.3/guide/embedded/index.html2
-rw-r--r--docs/en/ranch/1.3/guide/internals.asciidoc2
-rw-r--r--docs/en/ranch/1.3/guide/internals/index.html2
-rw-r--r--docs/en/ranch/1.3/guide/listeners.asciidoc32
-rw-r--r--docs/en/ranch/1.3/guide/listeners/index.html35
-rw-r--r--docs/en/ranch/1.3/guide/protocols.asciidoc2
-rw-r--r--docs/en/ranch/1.3/guide/protocols/index.html2
-rw-r--r--docs/en/ranch/1.3/guide/ssl_auth.asciidoc2
-rw-r--r--docs/en/ranch/1.3/guide/ssl_auth/index.html2
-rw-r--r--docs/en/ranch/1.3/manual/ranch/index.html9
11 files changed, 70 insertions, 22 deletions
diff --git a/docs/en/ranch/1.3/guide/embedded.asciidoc b/docs/en/ranch/1.3/guide/embedded.asciidoc
index 593a8079..55c018b1 100644
--- a/docs/en/ranch/1.3/guide/embedded.asciidoc
+++ b/docs/en/ranch/1.3/guide/embedded.asciidoc
@@ -17,7 +17,7 @@ regardless of the number of listeners you will use. Then you need to
add the child specs for each listener.
Ranch has a convenience function for getting the listeners child specs
-called `ranch:child_spec/6`, that works like `ranch:start_listener/6`,
+called `ranch:child_spec/5`, that works like `ranch:start_listener/5`,
except that it doesn't start anything, it only returns child specs.
As for `ranch_sup`, the child spec is simple enough to not require a
diff --git a/docs/en/ranch/1.3/guide/embedded/index.html b/docs/en/ranch/1.3/guide/embedded/index.html
index 7f4df004..eea4e32b 100644
--- a/docs/en/ranch/1.3/guide/embedded/index.html
+++ b/docs/en/ranch/1.3/guide/embedded/index.html
@@ -82,7 +82,7 @@ First, you need to add <code>ranch_sup</code> to your supervision tree, only onc
regardless of the number of listeners you will use. Then you need to
add the child specs for each listener.</p></div>
<div class="paragraph"><p>Ranch has a convenience function for getting the listeners child specs
-called <code>ranch:child_spec/6</code>, that works like <code>ranch:start_listener/6</code>,
+called <code>ranch:child_spec/5</code>, that works like <code>ranch:start_listener/5</code>,
except that it doesn&#8217;t start anything, it only returns child specs.</p></div>
<div class="paragraph"><p>As for <code>ranch_sup</code>, the child spec is simple enough to not require a
convenience function.</p></div>
diff --git a/docs/en/ranch/1.3/guide/internals.asciidoc b/docs/en/ranch/1.3/guide/internals.asciidoc
index fa63f1d3..c5bde58f 100644
--- a/docs/en/ranch/1.3/guide/internals.asciidoc
+++ b/docs/en/ranch/1.3/guide/internals.asciidoc
@@ -47,7 +47,7 @@ that new process.
=== Number of acceptors
-The second argument to `ranch:start_listener/6` is the number of
+The second argument to `ranch:start_listener/5` is the number of
processes that will be accepting connections. Care should be taken
when choosing this number.
diff --git a/docs/en/ranch/1.3/guide/internals/index.html b/docs/en/ranch/1.3/guide/internals/index.html
index 8af2fe27..7a08d075 100644
--- a/docs/en/ranch/1.3/guide/internals/index.html
+++ b/docs/en/ranch/1.3/guide/internals/index.html
@@ -110,7 +110,7 @@ that new process.</p></div>
<div class="sect1">
<h2 id="_number_of_acceptors">Number of acceptors</h2>
<div class="sectionbody">
-<div class="paragraph"><p>The second argument to <code>ranch:start_listener/6</code> is the number of
+<div class="paragraph"><p>The second argument to <code>ranch:start_listener/5</code> is the number of
processes that will be accepting connections. Care should be taken
when choosing this number.</p></div>
<div class="paragraph"><p>First of all, it should not be confused with the maximum number
diff --git a/docs/en/ranch/1.3/guide/listeners.asciidoc b/docs/en/ranch/1.3/guide/listeners.asciidoc
index 1055b804..97afa223 100644
--- a/docs/en/ranch/1.3/guide/listeners.asciidoc
+++ b/docs/en/ranch/1.3/guide/listeners.asciidoc
@@ -26,7 +26,7 @@ When starting a listener, a number of different settings are required:
Ranch includes both TCP and SSL transport handlers, respectively
`ranch_tcp` and `ranch_ssl`.
-A listener can be started by calling the `ranch:start_listener/6`
+A listener can be started by calling the `ranch:start_listener/5`
function. Before doing so however, you must ensure that the `ranch`
application is started.
@@ -42,7 +42,7 @@ to the `echo_protocol` handler.
.Starting a listener for TCP connections on port 5555
[source,erlang]
-{ok, _} = ranch:start_listener(tcp_echo, 100,
+{ok, _} = ranch:start_listener(tcp_echo,
ranch_tcp, [{port, 5555}],
echo_protocol, []
).
@@ -108,12 +108,12 @@ the port number 0, or if you omit the port number entirely, Ranch will
start listening on a random port.
You can retrieve this port number by calling `ranch:get_port/1`. The
-argument is the name of the listener you gave in `ranch:start_listener/6`.
+argument is the name of the listener you gave in `ranch:start_listener/5`.
.Starting a listener for TCP connections on a random port
[source,erlang]
-{ok, _} = ranch:start_listener(tcp_echo, 100,
+{ok, _} = ranch:start_listener(tcp_echo,
ranch_tcp, [{port, 0}],
echo_protocol, []
).
@@ -159,7 +159,7 @@ connections are handled optimally.
.Customizing the maximum number of concurrent connections
[source,erlang]
-{ok, _} = ranch:start_listener(tcp_echo, 100,
+{ok, _} = ranch:start_listener(tcp_echo,
ranch_tcp, [{port, 5555}, {max_connections, 100}],
echo_protocol, []
).
@@ -169,7 +169,7 @@ You can disable this limit by setting its value to the atom `infinity`.
.Disabling the limit for the number of connections
[source,erlang]
-{ok, _} = ranch:start_listener(tcp_echo, 100,
+{ok, _} = ranch:start_listener(tcp_echo,
ranch_tcp, [{port, 5555}, {max_connections, infinity}],
echo_protocol, []
).
@@ -213,6 +213,24 @@ ranch:set_max_connections(tcp_echo, MaxConns).
The change will occur immediately.
+=== Customizing the number of acceptor processes
+
+By default Ranch will use 10 acceptor processes. Their role is
+to accept connections and spawn a connection process for every
+new connection.
+
+This number can be tweaked to improve performance. A good
+number is typically between 10 or 100 acceptors. You must
+measure to find the best value for your application.
+
+.Specifying a custom number of acceptor processes
+
+[source,erlang]
+{ok, _} = ranch:start_listener(tcp_echo,
+ ranch_tcp, [{port, 5555}, {num_acceptors, 42}],
+ echo_protocol, []
+).
+
=== When running out of file descriptors
Operating systems have limits on the number of sockets
@@ -278,7 +296,7 @@ calling `ranch:get_protocol_options/1`.
[source,erlang]
Opts = ranch:get_protocol_options(tcp_echo).
-=== Obtain information about listeners
+=== Obtaining information about listeners
Ranch provides two functions for retrieving information about the
listeners, for reporting and diagnostic purposes.
diff --git a/docs/en/ranch/1.3/guide/listeners/index.html b/docs/en/ranch/1.3/guide/listeners/index.html
index 49742b06..6cc4d0a1 100644
--- a/docs/en/ranch/1.3/guide/listeners/index.html
+++ b/docs/en/ranch/1.3/guide/listeners/index.html
@@ -105,7 +105,7 @@ A protocol handler and its associated options.
</ul></div>
<div class="paragraph"><p>Ranch includes both TCP and SSL transport handlers, respectively
<code>ranch_tcp</code> and <code>ranch_ssl</code>.</p></div>
-<div class="paragraph"><p>A listener can be started by calling the <code>ranch:start_listener/6</code>
+<div class="paragraph"><p>A listener can be started by calling the <code>ranch:start_listener/5</code>
function. Before doing so however, you must ensure that the <code>ranch</code>
application is started.</p></div>
<div class="listingblock">
@@ -124,7 +124,7 @@ to the <code>echo_protocol</code> handler.</p></div>
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
-<pre><tt>{<span style="color: #FF6600">ok</span>, <span style="color: #990000">_</span>} <span style="color: #990000">=</span> <span style="font-weight: bold"><span style="color: #000000">ranch:start_listener</span></span>(<span style="color: #FF6600">tcp_echo</span>, <span style="color: #993399">100</span>,
+<pre><tt>{<span style="color: #FF6600">ok</span>, <span style="color: #990000">_</span>} <span style="color: #990000">=</span> <span style="font-weight: bold"><span style="color: #000000">ranch:start_listener</span></span>(<span style="color: #FF6600">tcp_echo</span>,
<span style="color: #FF6600">ranch_tcp</span>, [{<span style="color: #FF6600">port</span>, <span style="color: #993399">5555</span>}],
<span style="color: #FF6600">echo_protocol</span>, []
)<span style="color: #990000">.</span></tt></pre></div></div>
@@ -196,14 +196,14 @@ can be overriden at listener startup.</p></div>
the port number 0, or if you omit the port number entirely, Ranch will
start listening on a random port.</p></div>
<div class="paragraph"><p>You can retrieve this port number by calling <code>ranch:get_port/1</code>. The
-argument is the name of the listener you gave in <code>ranch:start_listener/6</code>.</p></div>
+argument is the name of the listener you gave in <code>ranch:start_listener/5</code>.</p></div>
<div class="listingblock">
<div class="title">Starting a listener for TCP connections on a random port</div>
<div class="content"><!-- Generator: GNU source-highlight 3.1.8
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
-<pre><tt>{<span style="color: #FF6600">ok</span>, <span style="color: #990000">_</span>} <span style="color: #990000">=</span> <span style="font-weight: bold"><span style="color: #000000">ranch:start_listener</span></span>(<span style="color: #FF6600">tcp_echo</span>, <span style="color: #993399">100</span>,
+<pre><tt>{<span style="color: #FF6600">ok</span>, <span style="color: #990000">_</span>} <span style="color: #990000">=</span> <span style="font-weight: bold"><span style="color: #000000">ranch:start_listener</span></span>(<span style="color: #FF6600">tcp_echo</span>,
<span style="color: #FF6600">ranch_tcp</span>, [{<span style="color: #FF6600">port</span>, <span style="color: #993399">0</span>}],
<span style="color: #FF6600">echo_protocol</span>, []
)<span style="color: #990000">.</span>
@@ -254,7 +254,7 @@ connections are handled optimally.</p></div>
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
-<pre><tt>{<span style="color: #FF6600">ok</span>, <span style="color: #990000">_</span>} <span style="color: #990000">=</span> <span style="font-weight: bold"><span style="color: #000000">ranch:start_listener</span></span>(<span style="color: #FF6600">tcp_echo</span>, <span style="color: #993399">100</span>,
+<pre><tt>{<span style="color: #FF6600">ok</span>, <span style="color: #990000">_</span>} <span style="color: #990000">=</span> <span style="font-weight: bold"><span style="color: #000000">ranch:start_listener</span></span>(<span style="color: #FF6600">tcp_echo</span>,
<span style="color: #FF6600">ranch_tcp</span>, [{<span style="color: #FF6600">port</span>, <span style="color: #993399">5555</span>}, {<span style="color: #FF6600">max_connections</span>, <span style="color: #993399">100</span>}],
<span style="color: #FF6600">echo_protocol</span>, []
)<span style="color: #990000">.</span></tt></pre></div></div>
@@ -265,7 +265,7 @@ http://www.gnu.org/software/src-highlite -->
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
-<pre><tt>{<span style="color: #FF6600">ok</span>, <span style="color: #990000">_</span>} <span style="color: #990000">=</span> <span style="font-weight: bold"><span style="color: #000000">ranch:start_listener</span></span>(<span style="color: #FF6600">tcp_echo</span>, <span style="color: #993399">100</span>,
+<pre><tt>{<span style="color: #FF6600">ok</span>, <span style="color: #990000">_</span>} <span style="color: #990000">=</span> <span style="font-weight: bold"><span style="color: #000000">ranch:start_listener</span></span>(<span style="color: #FF6600">tcp_echo</span>,
<span style="color: #FF6600">ranch_tcp</span>, [{<span style="color: #FF6600">port</span>, <span style="color: #993399">5555</span>}, {<span style="color: #FF6600">max_connections</span>, <span style="color: #FF6600">infinity</span>}],
<span style="color: #FF6600">echo_protocol</span>, []
)<span style="color: #990000">.</span></tt></pre></div></div>
@@ -308,6 +308,27 @@ http://www.gnu.org/software/src-highlite -->
</div>
</div>
<div class="sect1">
+<h2 id="_customizing_the_number_of_acceptor_processes">Customizing the number of acceptor processes</h2>
+<div class="sectionbody">
+<div class="paragraph"><p>By default Ranch will use 10 acceptor processes. Their role is
+to accept connections and spawn a connection process for every
+new connection.</p></div>
+<div class="paragraph"><p>This number can be tweaked to improve performance. A good
+number is typically between 10 or 100 acceptors. You must
+measure to find the best value for your application.</p></div>
+<div class="listingblock">
+<div class="title">Specifying a custom number of acceptor processes</div>
+<div class="content"><!-- Generator: GNU source-highlight 3.1.8
+by Lorenzo Bettini
+http://www.lorenzobettini.it
+http://www.gnu.org/software/src-highlite -->
+<pre><tt>{<span style="color: #FF6600">ok</span>, <span style="color: #990000">_</span>} <span style="color: #990000">=</span> <span style="font-weight: bold"><span style="color: #000000">ranch:start_listener</span></span>(<span style="color: #FF6600">tcp_echo</span>,
+ <span style="color: #FF6600">ranch_tcp</span>, [{<span style="color: #FF6600">port</span>, <span style="color: #993399">5555</span>}, {<span style="color: #FF6600">num_acceptors</span>, <span style="color: #993399">42</span>}],
+ <span style="color: #FF6600">echo_protocol</span>, []
+)<span style="color: #990000">.</span></tt></pre></div></div>
+</div>
+</div>
+<div class="sect1">
<h2 id="_when_running_out_of_file_descriptors">When running out of file descriptors</h2>
<div class="sectionbody">
<div class="paragraph"><p>Operating systems have limits on the number of sockets
@@ -376,7 +397,7 @@ http://www.gnu.org/software/src-highlite -->
</div>
</div>
<div class="sect1">
-<h2 id="_obtain_information_about_listeners">Obtain information about listeners</h2>
+<h2 id="_obtaining_information_about_listeners">Obtaining information about listeners</h2>
<div class="sectionbody">
<div class="paragraph"><p>Ranch provides two functions for retrieving information about the
listeners, for reporting and diagnostic purposes.</p></div>
diff --git a/docs/en/ranch/1.3/guide/protocols.asciidoc b/docs/en/ranch/1.3/guide/protocols.asciidoc
index 48c74ef5..b9a31f27 100644
--- a/docs/en/ranch/1.3/guide/protocols.asciidoc
+++ b/docs/en/ranch/1.3/guide/protocols.asciidoc
@@ -10,7 +10,7 @@ which defines a single callback, `start_link/4`. This callback is
responsible for spawning a new process for handling the connection.
It receives four arguments: the name of the listener, the socket, the
transport handler being used and the protocol options defined in
-the call to `ranch:start_listener/6`. This callback must
+the call to `ranch:start_listener/5`. This callback must
return `{ok, Pid}`, with `Pid` the pid of the new process.
The newly started process can then freely initialize itself. However,
diff --git a/docs/en/ranch/1.3/guide/protocols/index.html b/docs/en/ranch/1.3/guide/protocols/index.html
index a29a93a8..45e13bf7 100644
--- a/docs/en/ranch/1.3/guide/protocols/index.html
+++ b/docs/en/ranch/1.3/guide/protocols/index.html
@@ -77,7 +77,7 @@ which defines a single callback, <code>start_link/4</code>. This callback is
responsible for spawning a new process for handling the connection.
It receives four arguments: the name of the listener, the socket, the
transport handler being used and the protocol options defined in
-the call to <code>ranch:start_listener/6</code>. This callback must
+the call to <code>ranch:start_listener/5</code>. This callback must
return <code>{ok, Pid}</code>, with <code>Pid</code> the pid of the new process.</p></div>
<div class="paragraph"><p>The newly started process can then freely initialize itself. However,
it must call <code>ranch:accept_ack/1</code> before doing any socket operation.
diff --git a/docs/en/ranch/1.3/guide/ssl_auth.asciidoc b/docs/en/ranch/1.3/guide/ssl_auth.asciidoc
index de0bbaf0..de16107a 100644
--- a/docs/en/ranch/1.3/guide/ssl_auth.asciidoc
+++ b/docs/en/ranch/1.3/guide/ssl_auth.asciidoc
@@ -49,7 +49,7 @@ the listener to enable this behavior.
.Configure a listener for SSL authentication
[source,erlang]
-{ok, _} = ranch:start_listener(my_ssl, 100,
+{ok, _} = ranch:start_listener(my_ssl,
ranch_ssl, [
{port, SSLPort},
{certfile, PathToCertfile},
diff --git a/docs/en/ranch/1.3/guide/ssl_auth/index.html b/docs/en/ranch/1.3/guide/ssl_auth/index.html
index 6262ffa1..b831fbe2 100644
--- a/docs/en/ranch/1.3/guide/ssl_auth/index.html
+++ b/docs/en/ranch/1.3/guide/ssl_auth/index.html
@@ -152,7 +152,7 @@ the listener to enable this behavior.</p></div>
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
-<pre><tt>{<span style="color: #FF6600">ok</span>, <span style="color: #990000">_</span>} <span style="color: #990000">=</span> <span style="font-weight: bold"><span style="color: #000000">ranch:start_listener</span></span>(<span style="color: #FF6600">my_ssl</span>, <span style="color: #993399">100</span>,
+<pre><tt>{<span style="color: #FF6600">ok</span>, <span style="color: #990000">_</span>} <span style="color: #990000">=</span> <span style="font-weight: bold"><span style="color: #000000">ranch:start_listener</span></span>(<span style="color: #FF6600">my_ssl</span>,
<span style="color: #FF6600">ranch_ssl</span>, [
{<span style="color: #FF6600">port</span>, <span style="color: #009900">SSLPort</span>},
{<span style="color: #FF6600">certfile</span>, <span style="color: #009900">PathToCertfile</span>},
diff --git a/docs/en/ranch/1.3/manual/ranch/index.html b/docs/en/ranch/1.3/manual/ranch/index.html
index 5e3914af..5c2f9f3e 100644
--- a/docs/en/ranch/1.3/manual/ranch/index.html
+++ b/docs/en/ranch/1.3/manual/ranch/index.html
@@ -102,6 +102,7 @@ http://www.gnu.org/software/src-highlite -->
<pre><tt><span style="font-weight: bold"><span style="color: #000000">opt</span></span>() <span style="color: #990000">=</span> {<span style="color: #FF6600">ack_timeout</span>, <span style="font-weight: bold"><span style="color: #000000">timeout</span></span>()}
| {<span style="color: #FF6600">connection_type</span>, <span style="color: #FF6600">worker</span> | <span style="color: #FF6600">supervisor</span>}
| {<span style="color: #FF6600">max_connections</span>, <span style="font-weight: bold"><span style="color: #000000">max_conns</span></span>()}
+ | {<span style="color: #FF6600">num_acceptors</span>, <span style="font-weight: bold"><span style="color: #000000">pos_integer</span></span>()}
| {<span style="color: #000080">shutdown</span>, <span style="font-weight: bold"><span style="color: #000000">timeout</span></span>() | <span style="color: #FF6600">brutal_kill</span>}
| {<span style="color: #FF6600">socket</span>, <span style="font-weight: bold"><span style="color: #000000">any</span></span>()}</tt></pre></div></div>
<div class="paragraph"><p>Ranch-specific transport options.</p></div>
@@ -144,6 +145,14 @@ max_connections (1024)
</p>
</dd>
<dt class="hdlist1">
+num_acceptors (10)
+</dt>
+<dd>
+<p>
+ Number of processes that accept connections.
+</p>
+</dd>
+<dt class="hdlist1">
shutdown (5000)
</dt>
<dd>