summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMatthew Sackman <matthew@lshift.net>2009-04-16 09:03:10 +0100
committerMatthew Sackman <matthew@lshift.net>2009-04-16 09:03:10 +0100
commit2f3206b4da474909b7ae055f9af319fe771132be (patch)
treeb1bcdac02f163481390f88a065f3a9efacc34e66 /src
parentc9c41fc670c97a57bc078374c285f5efdb08b7cd (diff)
downloadrabbitmq-server-git-2f3206b4da474909b7ae055f9af319fe771132be.tar.gz
funny what you realise in the middle of the night...
Diffstat (limited to 'src')
-rw-r--r--src/rabbit_tests.erl25
1 files changed, 14 insertions, 11 deletions
diff --git a/src/rabbit_tests.erl b/src/rabbit_tests.erl
index 491950d212..a3da0ef4bb 100644
--- a/src/rabbit_tests.erl
+++ b/src/rabbit_tests.erl
@@ -662,23 +662,26 @@ rdq_time_tx_publish_commit_deliver_ack(Qs, MsgCount, MsgSizeBytes) ->
rdq_stress_gc(MsgCount) ->
rdq_virgin(),
rdq_start(),
- MsgSizeBytes = 1024*1024,
- Msg = <<0:(8*MsgSizeBytes)>>, % 1MB
+ MsgSizeBytes = 256*1024,
+ Msg = <<0:(8*MsgSizeBytes)>>, % 256KB
List = lists:seq(1, MsgCount),
[rabbit_disk_queue:tx_publish(N, Msg) || N <- List],
rabbit_disk_queue:tx_commit(q, List),
- % this list generation is _very_ slow, as it's O(N^2)
+ StartChunk = round(MsgCount / 20), % 5%
AckList =
- lists:reverse(lists:foldl(fun (E, Acc) -> case lists:member(E, Acc) of
- true ->
- Acc;
- _False -> [E|Acc]
+ lists:reverse(lists:foldl(fun (E, Acc) -> case Acc of
+ [] -> [E];
+ [F|_Fs] ->
+ case E rem F of
+ 0 -> Acc;
+ _ -> [E|Acc]
+ end
end
- end, [], lists:flatten([lists:seq(N,MsgCount,N) || N <- lists:seq(4,MsgCount)])))
- ++ lists:seq(1, 3),
+ end, [], lists:flatten([lists:seq(N,MsgCount,N) || N <- lists:seq(StartChunk,MsgCount)])))
+ ++ lists:seq(1, (StartChunk - 1)),
[begin {Msg, MsgSizeBytes, false} = rabbit_disk_queue:deliver(q, N),
- rabbit_disk_queue:ack(q, [N]),
- rabbit_disk_queue:tx_commit(q, [])
+ rabbit_disk_queue:ack(q, [N]),
+ rabbit_disk_queue:tx_commit(q, [])
end || N <- AckList],
rdq_stop().