From 3ce2865d84f16acd395768eb4f02edc03a3f47ab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Hoguin?= Date: Tue, 1 Nov 2011 15:53:51 +0100 Subject: Set the cowboy_listener process priority to high See comment added with it for more information. --- src/cowboy_listener.erl | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/cowboy_listener.erl b/src/cowboy_listener.erl index 8b656ba..c19d079 100644 --- a/src/cowboy_listener.erl +++ b/src/cowboy_listener.erl @@ -30,9 +30,15 @@ %% API. %% @private +%% +%% We set the process priority to high because cowboy_listener is the central +%% gen_server in Cowboy and is used to manage all the incoming connections. +%% Setting the process priority to high ensures the connection-related code +%% will always be executed when a connection needs it, allowing Cowboy to +%% scale far beyond what it would with a normal priority. -spec start_link() -> {ok, pid()}. start_link() -> - gen_server:start_link(?MODULE, [], []). + gen_server:start_link(?MODULE, [], [{spawn_opt, [{priority, high}]}]). %% @private -spec stop(pid()) -> stopped. -- cgit v1.2.3