aboutsummaryrefslogtreecommitdiffstats
path: root/lib/kernel/src/rpc.erl
diff options
context:
space:
mode:
authorBjörn Gustavsson <[email protected]>2017-02-03 13:27:09 +0100
committerBjörn Gustavsson <[email protected]>2017-02-03 13:31:24 +0100
commit5f7f86be7bc7ec7a1c9b0042ff08254dca063d76 (patch)
treed69acb9beded0e43b760222f90719f260029118b /lib/kernel/src/rpc.erl
parentea530357b27635278ae8a3260e735ea39df5c283 (diff)
downloadotp-5f7f86be7bc7ec7a1c9b0042ff08254dca063d76.tar.gz
otp-5f7f86be7bc7ec7a1c9b0042ff08254dca063d76.tar.bz2
otp-5f7f86be7bc7ec7a1c9b0042ff08254dca063d76.zip
Store messages for 'rex' and 'error_logger' off heap
Performance for processes that receive huge amounts of messages can be increased by storing the incoming messages outside the heap (that avoids copying the message in a garbage collection). Two OTP processes that are known to receive many messages are 'rex' (used by 'rpc') and 'error_logger'.
Diffstat (limited to 'lib/kernel/src/rpc.erl')
-rw-r--r--lib/kernel/src/rpc.erl14
1 files changed, 12 insertions, 2 deletions
diff --git a/lib/kernel/src/rpc.erl b/lib/kernel/src/rpc.erl
index 21bff02214..bd6ea26678 100644
--- a/lib/kernel/src/rpc.erl
+++ b/lib/kernel/src/rpc.erl
@@ -67,17 +67,27 @@
%%------------------------------------------------------------------------
+
+%% The rex server may receive a huge amount of
+%% messages. Make sure that they are stored off heap to
+%% avoid exessive GCs.
+
+-define(SPAWN_OPTS, [{spawn_opt,[{message_queue_data,off_heap}]}]).
+
%% Remote execution and broadcasting facility
-spec start() -> {'ok', pid()} | 'ignore' | {'error', term()}.
start() ->
- gen_server:start({local,?NAME}, ?MODULE, [], []).
+ gen_server:start({local,?NAME}, ?MODULE, [], ?SPAWN_OPTS).
-spec start_link() -> {'ok', pid()} | 'ignore' | {'error', term()}.
start_link() ->
- gen_server:start_link({local,?NAME}, ?MODULE, [], []).
+ %% The rex server process may receive a huge amount of
+ %% messages. Make sure that they are stored off heap to
+ %% avoid exessive GCs.
+ gen_server:start_link({local,?NAME}, ?MODULE, [], ?SPAWN_OPTS).
-spec stop() -> term().