Skip to content

Commit 0b9925e

Browse files
committed
Advise not to use polling in real applications
[#165787240] References #196
1 parent 76f8096 commit 0b9925e

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

src/docs/asciidoc/usage-advanced.adoc

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -290,6 +290,16 @@ but must be used only in the same Java process. So PerfTest can fall back to `Sy
290290
which provides only milliseconds precision, but is reliable between different machines
291291
as long as their clocks are synchronised.
292292

293+
== Asynchronous Consumers vs Synchronous Consumers
294+
295+
Consumers are asynchronous by default in PerfTest. This means they are registered with the AMQP `basic.consume`
296+
method and the broker pushes messages to them. This is the optimal way to consume messages. PerfTest
297+
also provides the `--polling` and `--polling-interval` options to consume messages by polling the broker
298+
with the AMQP `basic.get` method. These options are available to evaluate the performance and the effects
299+
of `basic.get`, but real applications should avoid using `basic.get` as much as possible because
300+
it has several drawbacks compared to asynchronous consumers: it needs a network round trip for each message,
301+
it typically keeps a thread busy for polling in the application, and it intrinsically increases latency.
302+
293303
== TLS Support
294304

295305
PerfTest can use TLS to connect to a node that is

src/main/java/com/rabbitmq/perf/PerfTest.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -567,7 +567,9 @@ public static Options getOptions() {
567567
variableSize.setArgs(Option.UNLIMITED_VALUES);
568568
options.addOption(variableSize);
569569

570-
options.addOption(new Option("po", "polling",false,"use basic.get to consume messages"));
570+
options.addOption(new Option("po", "polling",false,
571+
"use basic.get to consume messages. " +
572+
"Do not use this in real applications."));
571573
options.addOption(new Option("pi", "polling-interval",true, "time to wait before polling with basic.get, " +
572574
"in millisecond, default is 0."));
573575

0 commit comments

Comments
 (0)