summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthew Sackman <matthew@lshift.net>2009-09-01 16:13:05 +0100
committerMatthew Sackman <matthew@lshift.net>2009-09-01 16:13:05 +0100
commita6238f41cf1a96e8d1ee995b42222525eb201e81 (patch)
tree395199834cbb193137978a8866ccc92791254dae
parent1d931a1f5deb943076d8da3c3e0f357d716a6caa (diff)
downloadrabbitmq-server-git-a6238f41cf1a96e8d1ee995b42222525eb201e81.tar.gz
The multiplier for the memory thresholds should not be on the number of available tokes. In extremis, when available tokens is 0, this makes queues very likely to switch mode (bad, memory is tight), and when there are lots of tokens available, this makes queues less likely to switch mode (bad, memory is plentiful). Instead, we should be using constant offsets, based on the total number of tokens in the system.
-rw-r--r--src/rabbit_memory_manager.erl7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/rabbit_memory_manager.erl b/src/rabbit_memory_manager.erl
index eb37a6f3b4..bf694c8fed 100644
--- a/src/rabbit_memory_manager.erl
+++ b/src/rabbit_memory_manager.erl
@@ -41,7 +41,8 @@
-export([register/5, report_memory/3, info/0, conserve_memory/2]).
-define(TOTAL_TOKENS, 10000000).
--define(THRESHOLD_MULTIPLIER, 1.05).
+-define(THRESHOLD_MULTIPLIER, 0.05).
+-define(THRESHOLD_OFFSET, ?TOTAL_TOKENS * ?THRESHOLD_MULTIPLIER).
-define(SERVER, ?MODULE).
@@ -228,8 +229,8 @@ handle_cast({report_memory, Pid, Memory, Hibernating},
end;
{oppressed, OrigAvail} ->
case Alarmed orelse Hibernating orelse
- (Avail > (OrigAvail / ?THRESHOLD_MULTIPLIER) andalso
- Avail < (OrigAvail * ?THRESHOLD_MULTIPLIER)) of
+ (Avail > (OrigAvail - ?THRESHOLD_OFFSET) andalso
+ Avail < (OrigAvail + ?THRESHOLD_OFFSET)) of
true ->
{State, oppressed};
false ->