diff options
author | Michael Klishin <michael@clojurewerkz.org> | 2021-12-26 03:19:33 +0300 |
---|---|---|
committer | Michael Klishin <michael@clojurewerkz.org> | 2021-12-26 04:32:00 +0300 |
commit | dfa730b7370664ae40011cf83a911be018523c73 (patch) | |
tree | a743ecb4730886d98cda5d11bfee6177492935d9 | |
parent | 202f881601128e729d1d98184cbb3690773d6df4 (diff) | |
download | rabbitmq-server-git-dfa730b7370664ae40011cf83a911be018523c73.tar.gz |
delegate: documentation edits
-rw-r--r-- | deps/rabbit_common/src/delegate.erl | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/deps/rabbit_common/src/delegate.erl b/deps/rabbit_common/src/delegate.erl index e6e76d2ea0..b2ea3c499c 100644 --- a/deps/rabbit_common/src/delegate.erl +++ b/deps/rabbit_common/src/delegate.erl @@ -36,16 +36,19 @@ %% the pool is configurable, the aim is to make sure we don't have too %% few delegates and thus limit performance on many-CPU machines. -%% Optimisation for 'delegate' -%% If a message is sent to only one queue(in most application scenarios), -%% passing through the 'delegate' is meaningless. -%% Hardcoding "?DEFAULT_NAME and/or gen_server2" is to avoid affecting those -%% operations that must go through the 'delegate', such as: -%% 1. "delegate:invoke(Pids, {erlang, process_info, [memory]})", "erlang, process_info" -%% must be called inside the target node. +%% There are some optimisations applied. +%% If a message is sent to only one queue (a common scenario), +%% sending them over the delegate mechanism is redundant. +%% This optimization is applied to gen_server2 module calls when +%% delegate prefix matches the default, ?DEFAULT_NAME. +%% +%% Coonsider two examples: +%% +%% 1. "delegate:invoke(Pids, {erlang, process_info, [memory]})", "erlang:process_info/1" +%% should be called inside the target node. %% 2. "{Results, Errors} = delegate:invoke(MemberPids, ?DELEGATE_PREFIX, FunOrMFA)", -%% For some reason, the operation specifically specifies a delegate name rather than -%% ?DEFAULT_NAME. +%% Since this operation specifically specifies a delegate name rather than +%% relying on ?DEFAULT_NAME, it will be invoked using the delegate mechanism. -behaviour(gen_server2). |