Skip to content

Commit 5276f4f

Browse files
author
Simon MacMullen
committed
Start to push scenarios towards what we actually want to measure. Also MulticastParams should clearly not default to 10s.
1 parent 95ec687 commit 5276f4f

File tree

3 files changed

+57
-22
lines changed

3 files changed

+57
-22
lines changed

test/src/com/rabbitmq/examples/perf/MulticastParams.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public class MulticastParams {
2828
protected int prefetchCount = 0;
2929
protected int minMsgSize = 0;
3030

31-
protected int timeLimit = 10;
31+
protected int timeLimit = 0;
3232
protected int rateLimit = 0;
3333
protected int producerMsgCount = 0;
3434
protected int consumerMsgCount = 0;

test/src/com/rabbitmq/examples/perf/PerformanceMain.java

Lines changed: 55 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,14 @@ public class PerformanceMain {
3232

3333
//private static final List<?> NO_FLAGS = Arrays.asList();
3434
private static final List<?> PERSISTENT = Arrays.asList("persistent");
35+
private static final List<?> MANDATORY = Arrays.asList("mandatory");
36+
private static final List<?> IMMEDIATE = Arrays.asList("immediate");
3537

3638
private static Map<String, Object> results = new HashMap<String, Object>();
3739

3840
public static void main(String[] args) throws Exception {
3941
runStaticBrokerTests();
40-
runTests(new Scenario[]{varyingBroker()});
42+
runTests(new Scenario[]{message_size_broker_config()});
4143
writeJSON();
4244
}
4345

@@ -49,11 +51,12 @@ private static void writeJSON() throws IOException {
4951
}
5052

5153
private static void runStaticBrokerTests() throws Exception {
52-
Broker broker = Broker.DEFAULT;
54+
Broker broker = Broker.HIPE_COARSE;
5355
broker.start();
54-
runTests(new Scenario[]{no_ack(), ack(), ack_confirm(), ack_confirm_persist(),
55-
fill_drain_queue("small", 500000), fill_drain_queue("large", 1000000),
56-
varying(), varying2d(), ratevslatency()});
56+
runTests(new Scenario[]{no_consume(), no_ack(), no_ack_mandatory(), no_ack_immediate(), ack(),
57+
ack_confirm(), ack_confirm_persist(), fill_drain_queue("small", 500000),
58+
fill_drain_queue("large", 1000000), consumers(),
59+
message_sizes(), message_size_vs_producers(), rate_vs_latency()});
5760
broker.stop();
5861
}
5962

@@ -66,26 +69,44 @@ private static void runTests(Scenario[] scenarios) throws Exception {
6669
}
6770
}
6871

72+
private static Scenario no_consume() throws IOException, InterruptedException {
73+
MulticastParams params = params();
74+
params.setConsumerCount(0);
75+
return new SimpleScenario("no-consume", factory, params);
76+
}
77+
6978
private static Scenario no_ack() throws IOException, InterruptedException {
70-
MulticastParams params = new MulticastParams();
79+
MulticastParams params = params();
7180
return new SimpleScenario("no-ack", factory, params);
7281
}
7382

83+
private static Scenario no_ack_mandatory() throws IOException, InterruptedException {
84+
MulticastParams params = params();
85+
params.setFlags(MANDATORY);
86+
return new SimpleScenario("no-ack-mandatory", factory, params);
87+
}
88+
89+
private static Scenario no_ack_immediate() throws IOException, InterruptedException {
90+
MulticastParams params = params();
91+
params.setFlags(IMMEDIATE);
92+
return new SimpleScenario("no-ack-immediate", factory, params);
93+
}
94+
7495
private static Scenario ack() throws IOException, InterruptedException {
75-
MulticastParams params = new MulticastParams();
96+
MulticastParams params = params();
7697
params.setAutoAck(false);
7798
return new SimpleScenario("ack", factory, params);
7899
}
79100

80101
private static Scenario ack_confirm() throws IOException, InterruptedException {
81-
MulticastParams params = new MulticastParams();
102+
MulticastParams params = params();
82103
params.setAutoAck(false);
83104
params.setConfirm(1000);
84105
return new SimpleScenario("ack-confirm", factory, params);
85106
}
86107

87108
private static Scenario ack_confirm_persist() throws IOException, InterruptedException {
88-
MulticastParams params = new MulticastParams();
109+
MulticastParams params = params();
89110
params.setAutoAck(false);
90111
params.setConfirm(1000);
91112
params.setFlags(PERSISTENT);
@@ -109,36 +130,50 @@ private static MulticastParams fill_drain_params() {
109130
params.setQueueName("test");
110131
params.setExclusive(false);
111132
params.setAutoDelete(true);
112-
params.setTimeLimit(0);
113133
return params;
114134
}
115135

116-
private static Scenario varying() throws IOException, InterruptedException {
117-
MulticastParams params = new MulticastParams();
136+
private static Scenario message_sizes() throws IOException, InterruptedException {
137+
MulticastParams params = params();
118138
return new VaryingScenario("message-sizes", factory, params,
119-
var("minMsgSize", 0, 100, 1000, 10000));
139+
var("minMsgSize", 0, 100, 200, 300, 400, 500, 6000, 700, 800, 900, 1000,
140+
1100, 1200, 1300, 1400, 1500, 1600, 1700, 1800, 1900, 2000, 5000));
120141
}
121142

122-
private static Scenario varying2d() throws IOException, InterruptedException {
123-
MulticastParams params = new MulticastParams();
143+
private static Scenario consumers() throws IOException, InterruptedException {
144+
MulticastParams params = params();
145+
params.setAutoAck(false);
146+
return new VaryingScenario("consumers", factory, params,
147+
var("consumerCount", 1, 2, 5, 10, 50, 100),
148+
var("prefetchCount", 1, 10, 100, 1000, 10000));
149+
}
150+
151+
private static Scenario message_size_vs_producers() throws IOException, InterruptedException {
152+
MulticastParams params = params();
124153
params.setConsumerCount(0);
125154
return new VaryingScenario("message-sizes-and-producers", factory, params,
126155
var("minMsgSize", 0, 1000, 10000),
127156
var("producerCount", 1, 2, 3, 4, 5, 6, 7, 8, 9, 10));
128157
}
129158

130-
private static Scenario varyingBroker() throws IOException, InterruptedException {
131-
MulticastParams params = new MulticastParams();
159+
private static Scenario message_size_broker_config() throws IOException, InterruptedException {
160+
MulticastParams params = params();
132161
return new VaryingScenario("message-sizes-and-broker-config", factory, params,
133-
var("minMsgSize", 0, 500, 1000, 2000, 5000, 10000),
162+
var("minMsgSize", 0, 500, 1000, 1500, 2000),
134163
new BrokerVariable(Broker.DEFAULT, Broker.HIPE, Broker.COARSE, Broker.HIPE_COARSE));
135164
}
136165

137-
private static Scenario ratevslatency() throws IOException, InterruptedException {
138-
MulticastParams params = new MulticastParams();
166+
private static Scenario rate_vs_latency() throws IOException, InterruptedException {
167+
MulticastParams params = params();
139168
return new RateVsLatencyScenario("rate-vs-latency", factory, params);
140169
}
141170

171+
private static MulticastParams params() {
172+
MulticastParams p = new MulticastParams();
173+
p.setTimeLimit(30);
174+
return p;
175+
}
176+
142177
private static Variable var(String name, Object... values) {
143178
return new MulticastVariable(name, values);
144179
}

test/src/com/rabbitmq/examples/perf/RateVsLatencyScenario.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public void run() throws IOException, InterruptedException {
3838
s.run();
3939
SimpleScenarioStats m = s.getStats();
4040
int maxRate = (int) (m.getRecvRate() + m.getSendRate()) / 2;
41-
Double[] factors = new Double[]{0.8, 0.9, 0.95, 0.96, 0.97, 0.98, 0.99, 1.0, 1.01, 1.02, 1.05, 1.1};
41+
Double[] factors = new Double[]{0.8, 0.9, 0.95, 0.96, 0.97, 0.98, 0.99, 1.0, 1.01, 1.02, 1.03, 1.04, 1.05};
4242
Integer [] rates = new Integer[factors.length];
4343
for (int i = 0; i < rates.length; i++) {
4444
rates[i] = (int) (factors[i] * maxRate);

0 commit comments

Comments
 (0)