aboutsummaryrefslogtreecommitdiffstats
path: root/src/cowboy_acceptors_sup.erl
diff options
context:
space:
mode:
authorLoïc Hoguin <[email protected]>2012-01-30 08:09:33 +0100
committerLoïc Hoguin <[email protected]>2012-01-30 08:09:33 +0100
commit830cfc002e992126a2c605594f25d40a5a193968 (patch)
treea07bb8c0850b39e9ca93660659b1714025ea8ccc /src/cowboy_acceptors_sup.erl
parentbb08cf85e38f02d5785b2a23c38d3b4c8020989c (diff)
downloadcowboy-830cfc002e992126a2c605594f25d40a5a193968.tar.gz
cowboy-830cfc002e992126a2c605594f25d40a5a193968.tar.bz2
cowboy-830cfc002e992126a2c605594f25d40a5a193968.zip
Move max_connections check directly inside cowboy_listener
This is a big change in the internal cowboy API. This should not have any impact on existing applications as only the acceptor is expected to use these API calls. The function cowboy_listener:wait/3 has been removed. max_connections checking now occurs directly in cowboy_listener:add_connection/3. If the pool is full and the acceptor has to wait, then it doesn't return, waiting for a free space to be available. To accomodate these changes, it is now cowboy_listener that will inform the new connection that it is ready by sending {shoot, self()}. This should be a great improvement to the latency of responses as there is one less message to wait for before the request process can do its work. Overall the performance under heavy load should also be improved as we greatly reduce the number of messages sent between the acceptor and the listener process.
Diffstat (limited to 'src/cowboy_acceptors_sup.erl')
-rw-r--r--src/cowboy_acceptors_sup.erl3
1 files changed, 1 insertions, 2 deletions
diff --git a/src/cowboy_acceptors_sup.erl b/src/cowboy_acceptors_sup.erl
index 17849a6..625028c 100644
--- a/src/cowboy_acceptors_sup.erl
+++ b/src/cowboy_acceptors_sup.erl
@@ -34,10 +34,9 @@ start_link(NbAcceptors, Transport, TransOpts,
init([NbAcceptors, Transport, TransOpts,
Protocol, ProtoOpts, ListenerPid, ReqsPid]) ->
{ok, LSocket} = Transport:listen(TransOpts),
- MaxConns = proplists:get_value(max_connections, TransOpts, 1024),
Procs = [{{acceptor, self(), N}, {cowboy_acceptor, start_link, [
LSocket, Transport, Protocol, ProtoOpts,
- MaxConns, ListenerPid, ReqsPid
+ ListenerPid, ReqsPid
]}, permanent, brutal_kill, worker, []}
|| N <- lists:seq(1, NbAcceptors)],
{ok, {{one_for_one, 10, 10}, Procs}}.