diff options
| author | Simon MacMullen <simon@rabbitmq.com> | 2014-01-24 12:54:55 +0000 |
|---|---|---|
| committer | Simon MacMullen <simon@rabbitmq.com> | 2014-01-24 12:54:55 +0000 |
| commit | c232b0fd7664db4e3a33424665aaec5f910397e4 (patch) | |
| tree | 98f0b2eda5d19e67bf8567848f7abd01481396d5 | |
| parent | a18f10901e9db0038b71274f7eaadcaef35f6312 (diff) | |
| download | rabbitmq-server-git-c232b0fd7664db4e3a33424665aaec5f910397e4.tar.gz | |
Explicitly target an egress/ingress ratio.
| -rw-r--r-- | src/rabbit_amqqueue_process.erl | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/rabbit_amqqueue_process.erl b/src/rabbit_amqqueue_process.erl index b4891d9927..968f9517dd 100644 --- a/src/rabbit_amqqueue_process.erl +++ b/src/rabbit_amqqueue_process.erl @@ -22,7 +22,7 @@ -define(SYNC_INTERVAL, 25). %% milliseconds -define(RAM_DURATION_UPDATE_INTERVAL, 5000). --define(CONSUMER_BIAS, 0.8). +-define(CONSUMER_BIAS_RATIO, 1.1). %% i.e. consume 10% faster -export([start_link/1, info_keys/0]). @@ -855,10 +855,12 @@ prioritise_cast(Msg, _Len, State) -> consumer_bias(#q{backing_queue = BQ, backing_queue_state = BQS}) -> {Ingress, Egress} = BQ:msg_rates(BQS), - case ?CONSUMER_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 + case Ingress of + 0.0 -> 0; + _ -> case Egress / Ingress < ?CONSUMER_BIAS_RATIO of + true -> +1; + false -> 0 + end end. prioritise_info(Msg, _Len, #q{q = #amqqueue{exclusive_owner = DownPid}}) -> |
