diff options
author | Simon MacMullen <simon@rabbitmq.com> | 2014-03-04 10:27:48 +0000 |
---|---|---|
committer | Simon MacMullen <simon@rabbitmq.com> | 2014-03-04 10:27:48 +0000 |
commit | 3f11f949a6fd0dff7dc7373682aa70851613dbd2 (patch) | |
tree | c90d7bd31c139405ba245f91fbe01664ea1939fa /src/rabbit_amqqueue_process.erl | |
parent | 8326fecaca6f864633c3e98fc15df6a081c112d5 (diff) | |
parent | c03bcb90b5ce1d6035ac627500667f9b51a1e4a8 (diff) | |
download | rabbitmq-server-3f11f949a6fd0dff7dc7373682aa70851613dbd2.tar.gz |
Merge in default
Diffstat (limited to 'src/rabbit_amqqueue_process.erl')
-rw-r--r-- | src/rabbit_amqqueue_process.erl | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/src/rabbit_amqqueue_process.erl b/src/rabbit_amqqueue_process.erl index 25f0a18c..e3202f54 100644 --- a/src/rabbit_amqqueue_process.erl +++ b/src/rabbit_amqqueue_process.erl @@ -861,12 +861,21 @@ prioritise_cast(Msg, _Len, State) -> {set_ram_duration_target, _Duration} -> 8; {set_maximum_since_use, _Age} -> 8; {run_backing_queue, _Mod, _Fun} -> 6; - {ack, _AckTags, _ChPid} -> consumer_bias(State); + {ack, _AckTags, _ChPid} -> 3; %% [1] + {resume, _ChPid} -> 2; {notify_sent, _ChPid, _Credit} -> consumer_bias(State); - {resume, _ChPid} -> consumer_bias(State); _ -> 0 end. +%% [1] It should be safe to always prioritise ack / resume since they +%% will be rate limited by how fast consumers receive messages - +%% i.e. by notify_sent. We prioritise ack and resume to discourage +%% starvation caused by prioritising notify_sent. We don't vary their +%% prioritiy since acks should stay in order (some parts of the queue +%% stack are optimised for that) and to make things easier to reason +%% 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; |