diff options
author | Matthias Radestock <matthias@rabbitmq.com> | 2014-01-29 18:15:24 +0000 |
---|---|---|
committer | Matthias Radestock <matthias@rabbitmq.com> | 2014-01-29 18:15:24 +0000 |
commit | 5be4087156b12449ee14bc6c79cfd62f2e28074b (patch) | |
tree | 76acfefe39d7b19fc6c7dd7f3446644d034ac2de | |
parent | a51555fcf80940c7f9ded0542342177c9810c987 (diff) | |
download | rabbitmq-server-5be4087156b12449ee14bc6c79cfd62f2e28074b.tar.gz |
cosmetic
-rw-r--r-- | src/rabbit_amqqueue_process.erl | 11 | ||||
-rw-r--r-- | src/rabbit_variable_queue.erl | 33 |
2 files changed, 20 insertions, 24 deletions
diff --git a/src/rabbit_amqqueue_process.erl b/src/rabbit_amqqueue_process.erl index 968f9517..8ab62dac 100644 --- a/src/rabbit_amqqueue_process.erl +++ b/src/rabbit_amqqueue_process.erl @@ -854,13 +854,10 @@ prioritise_cast(Msg, _Len, State) -> end. consumer_bias(#q{backing_queue = BQ, backing_queue_state = BQS}) -> - {Ingress, Egress} = BQ:msg_rates(BQS), - case Ingress of - 0.0 -> 0; - _ -> case Egress / Ingress < ?CONSUMER_BIAS_RATIO of - true -> +1; - false -> 0 - end + 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}}) -> diff --git a/src/rabbit_variable_queue.erl b/src/rabbit_variable_queue.erl index e402a61d..c4033f28 100644 --- a/src/rabbit_variable_queue.erl +++ b/src/rabbit_variable_queue.erl @@ -704,7 +704,7 @@ set_ram_duration_target( in = AvgIngressRate, ack_out = AvgAckEgressRate, ack_in = AvgAckIngressRate }, - target_ram_count = TargetRamCount }) -> + target_ram_count = TargetRamCount }) -> Rate = AvgEgressRate + AvgIngressRate + AvgAckEgressRate + AvgAckIngressRate, TargetRamCount1 = @@ -756,16 +756,16 @@ update_rate(Now, TS, Count, Rate) -> Time = timer:now_diff(Now, TS) / ?MICROS_PER_SECOND, rabbit_misc:moving_average(Time, ?RATE_AVG_HALF_LIFE, Count / Time, Rate). -ram_duration(State0) -> - State = #vqstate { - rates = #rates { out = AvgEgressRate, - in = AvgIngressRate, - ack_out = AvgAckEgressRate, - ack_in = AvgAckIngressRate }, - ram_msg_count = RamMsgCount, - ram_msg_count_prev = RamMsgCountPrev, - ram_pending_ack = RPA, - ram_ack_count_prev = RamAckCountPrev } = update_rates(State0), +ram_duration(State) -> + State1 = #vqstate { rates = #rates { out = AvgEgressRate, + in = AvgIngressRate, + ack_out = AvgAckEgressRate, + ack_in = AvgAckIngressRate }, + ram_msg_count = RamMsgCount, + ram_msg_count_prev = RamMsgCountPrev, + ram_pending_ack = RPA, + ram_ack_count_prev = RamAckCountPrev } = + update_rates(State), RamAckCount = gb_trees:size(RPA), @@ -779,7 +779,7 @@ ram_duration(State0) -> AvgAckEgressRate + AvgAckIngressRate)) end, - {Duration, State}. + {Duration, State1}. needs_timeout(State = #vqstate { index_state = IndexState, target_ram_count = TargetRamCount }) -> @@ -1539,11 +1539,10 @@ reduce_memory_use(AlphaBetaFun, BetaDeltaFun, AckFun, ram_pending_ack = RPA, ram_msg_count = RamMsgCount, target_ram_count = TargetRamCount, - rates = #rates { in = AvgIngress, - out = AvgEgress, - ack_in = AvgAckIngress, - ack_out = AvgAckEgress } - }) -> + rates = #rates { in = AvgIngress, + out = AvgEgress, + ack_in = AvgAckIngress, + ack_out = AvgAckEgress } }) -> {Reduce, State1 = #vqstate { q2 = Q2, q3 = Q3 }} = case chunk_size(RamMsgCount + gb_trees:size(RPA), TargetRamCount) of |