diff options
author | Simon MacMullen <simon@rabbitmq.com> | 2013-11-15 12:30:53 +0000 |
---|---|---|
committer | Simon MacMullen <simon@rabbitmq.com> | 2013-11-15 12:30:53 +0000 |
commit | c4994db7360bf9da5110e2de1b0b8bdcc9ab67da (patch) | |
tree | d5d95ca8cbff5a1d72b8ebdd3ecf277d057e78aa | |
parent | 52b6f753a82d6d8b6e5d10714a296fe185563c14 (diff) | |
download | rabbitmq-server-c4994db7360bf9da5110e2de1b0b8bdcc9ab67da.tar.gz |
Matthias' strawman patch: prioritise notify_sent based on current ingress / egress rates.
-rw-r--r-- | src/rabbit_amqqueue_process.erl | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/src/rabbit_amqqueue_process.erl b/src/rabbit_amqqueue_process.erl index 4ff30ce0..78f955e7 100644 --- a/src/rabbit_amqqueue_process.erl +++ b/src/rabbit_amqqueue_process.erl @@ -1104,12 +1104,24 @@ prioritise_call(Msg, _From, _Len, _State) -> _ -> 0 end. -prioritise_cast(Msg, _Len, _State) -> +-define(BIAS, 0.8). + +prioritise_cast(Msg, _Len, State) -> case Msg of delete_immediately -> 8; {set_ram_duration_target, _Duration} -> 8; {set_maximum_since_use, _Age} -> 8; {run_backing_queue, _Mod, _Fun} -> 6; + {notify_sent, _ChPid, _Credit} -> + #q{backing_queue = BQ, backing_queue_state = BQS} = State, + BQSProps = BQ:status(BQS), + [Ingress, Egress] = [proplists:get_value(K, BQSProps) || + K <- [avg_ingress_rate, avg_egress_rate]], + case ?BIAS of + B when B > 0.0 andalso Ingress >= (1.0 - B) * Egress -> +1; + B when B < 0.0 andalso Egress >= (1.0 + B) * Ingress -> -1; + _ -> 0 + end; _ -> 0 end. |