diff options
| author | Michael Klishin <michael@novemberain.com> | 2017-10-02 00:48:31 +0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2017-10-02 00:48:31 +0300 |
| commit | 9e7cea3ae6dfb89bc14e562812420ee846486220 (patch) | |
| tree | 7ac12faee12e1c4bea6e3ab010e81b047b4c8952 | |
| parent | 2ccd9717cd2d8ce1d51d42913b0c26894ddca535 (diff) | |
| parent | 43edeb93dbef0f0f1e6f66f98da43bf908f0933a (diff) | |
| download | rabbitmq-server-git-9e7cea3ae6dfb89bc14e562812420ee846486220.tar.gz | |
Merge pull request #1378 from rabbitmq/always-prioritise-consumers
Remove consumer bias & allow queues under max load to drain quickly
| -rw-r--r-- | src/rabbit_amqqueue_process.erl | 18 |
1 files changed, 5 insertions, 13 deletions
diff --git a/src/rabbit_amqqueue_process.erl b/src/rabbit_amqqueue_process.erl index 16a5a70e13..cdadb5b1d4 100644 --- a/src/rabbit_amqqueue_process.erl +++ b/src/rabbit_amqqueue_process.erl @@ -22,7 +22,6 @@ -define(SYNC_INTERVAL, 200). %% milliseconds -define(RAM_DURATION_UPDATE_INTERVAL, 5000). --define(CONSUMER_BIAS_RATIO, 1.1). %% i.e. consume 10% faster -export([info_keys/0]). @@ -969,18 +968,18 @@ emit_consumer_deleted(ChPid, ConsumerTag, QName) -> %%---------------------------------------------------------------------------- -prioritise_call(Msg, _From, _Len, State) -> +prioritise_call(Msg, _From, _Len, _State) -> case Msg of info -> 9; {info, _Items} -> 9; consumers -> 9; stat -> 7; - {basic_consume, _, _, _, _, _, _, _, _, _} -> consumer_bias(State); - {basic_cancel, _, _, _} -> consumer_bias(State); + {basic_consume, _, _, _, _, _, _, _, _, _} -> 1; + {basic_cancel, _, _, _} -> 1; _ -> 0 end. -prioritise_cast(Msg, _Len, State) -> +prioritise_cast(Msg, _Len, _State) -> case Msg of delete_immediately -> 8; {set_ram_duration_target, _Duration} -> 8; @@ -988,7 +987,7 @@ prioritise_cast(Msg, _Len, State) -> {run_backing_queue, _Mod, _Fun} -> 6; {ack, _AckTags, _ChPid} -> 3; %% [1] {resume, _ChPid} -> 2; - {notify_sent, _ChPid, _Credit} -> consumer_bias(State); + {notify_sent, _ChPid, _Credit} -> 1; _ -> 0 end. @@ -1001,13 +1000,6 @@ prioritise_cast(Msg, _Len, State) -> %% about. Finally, we prioritise ack over resume since it should %% always reduce memory use. -consumer_bias(#q{backing_queue = BQ, backing_queue_state = BQS}) -> - case BQ:msg_rates(BQS) of - {0.0, _} -> 0; - {Ingress, Egress} when Egress / Ingress < ?CONSUMER_BIAS_RATIO -> 1; - {_, _} -> 0 - end. - prioritise_info(Msg, _Len, #q{q = #amqqueue{exclusive_owner = DownPid}}) -> case Msg of {'DOWN', _, process, DownPid, _} -> 8; |
