-
Notifications
You must be signed in to change notification settings - Fork 110
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add --exit-when option #280
Conversation
Acceptance steps: Get the branch and create the binary: cd /tmp
git clone [email protected]:rabbitmq/rabbitmq-perf-test.git
cd rabbitmq-perf-test
git checkout rabbitmq-perf-test-279-consumer-activity
make binary
tar xf target/rabbitmq-perf-test-2.17.0-SNAPSHOT-bin.tar.gz Run a local broker instance: docker run -it --rm --name rabbitmq -p 5672:5672 -p 5552:5552 -p 15672:15672 rabbitmq:3.9-management Open another terminal tab. Let's start with the existing behavior when the consumer queue gets empty. Publish some messages: rabbitmq-perf-test-2.17.0-SNAPSHOT/bin/runjava com.rabbitmq.perf.PerfTest -x 1 -y 0 --queue test --pmessages 50000 Consume from the queue, the program should "hang" when the queue is empty: rabbitmq-perf-test-2.17.0-SNAPSHOT/bin/runjava com.rabbitmq.perf.PerfTest -x 0 -y 1 --queue test --consumer-rate 10000 Terminate the process with Ctrl+C. Now let's try with the new option. Publish some messages: rabbitmq-perf-test-2.17.0-SNAPSHOT/bin/runjava com.rabbitmq.perf.PerfTest -x 1 -y 0 --queue test --pmessages 50000 Now consume with rabbitmq-perf-test-2.17.0-SNAPSHOT/bin/runjava com.rabbitmq.perf.PerfTest -x 0 -y 1 --queue test --consumer-rate 10000 --exit-when idle
id: test-153245-095, starting consumer #0
id: test-153245-095, starting consumer #0, channel #0
id: test-153245-095, time: 1.000s, received: 7911 msg/s, min/median/75th/95th/99th consumer latency: 0/0/0/0/0 µs
id: test-153245-095, time: 2.000s, received: 10001 msg/s, min/median/75th/95th/99th consumer latency: 0/0/0/0/0 µs
id: test-153245-095, time: 3.000s, received: 9981 msg/s, min/median/75th/95th/99th consumer latency: 0/0/0/0/0 µs
id: test-153245-095, time: 4.000s, received: 10011 msg/s, min/median/75th/95th/99th consumer latency: 0/0/0/0/0 µs
id: test-153245-095, time: 5.000s, received: 10001 msg/s, min/median/75th/95th/99th consumer latency: 0/0/0/0/0 µs
test stopped (No activity for 1 second for queue test)
id: test-153245-095, sending rate avg: 0 msg/s
id: test-153245-095, receiving rate avg: 8028 msg/s Now let's try with the Publish some messages: rabbitmq-perf-test-2.17.0-SNAPSHOT/bin/runjava com.rabbitmq.perf.PerfTest -x 1 -y 0 --queue test --pmessages 50000 Consume with rabbitmq-perf-test-2.17.0-SNAPSHOT/bin/runjava com.rabbitmq.perf.PerfTest -x 0 -y 1 --queue test --consumer-rate 10000 --exit-when empty
id: test-093321-464, starting consumer #0
id: test-093321-464, starting consumer #0, channel #0
id: test-093321-464, time: 1.000s, received: 8981 msg/s, min/median/75th/95th/99th consumer latency: 0/0/0/0/0 µs
id: test-093321-464, time: 2.000s, received: 9993 msg/s, min/median/75th/95th/99th consumer latency: 0/0/0/0/0 µs
id: test-093321-464, time: 3.000s, received: 9991 msg/s, min/median/75th/95th/99th consumer latency: 0/0/0/0/0 µs
id: test-093321-464, time: 4.000s, received: 10001 msg/s, min/median/75th/95th/99th consumer latency: 0/0/0/0/0 µs
id: test-093321-464, time: 5.000s, received: 9994 msg/s, min/median/75th/95th/99th consumer latency: 0/0/0/0/0 µs
test stopped (Consumer queue(s) empty)
id: test-093321-464, sending rate avg: 0 msg/s
id: test-093321-464, receiving rate avg: 8157 msg/s Now let's try with several queues. We'll use only Publish some messages on 10 queues: rabbitmq-perf-test-2.17.0-SNAPSHOT/bin/runjava com.rabbitmq.perf.PerfTest -x 10 -y 0 --queue-pattern 'perf-test-%d' --queue-pattern-from 1 --queue-pattern-to 10 --pmessages 50000 Consume from the queues until they are empty (and consumers become idle):
|
All good! One thing I noticed is:
The queue doesn't exist before using PerfTest and it behaves the same as if the queue did exist and was empty. I don't know if that's wanted or not. It's the same with empty and idle.
For what it's worth, your instructions were using |
As far as I don't know if it's important enough to bother with differentiating |
Even though So PerfTest creates the queue, registers a consumer, and the consumer stays idle for a couple of seconds, and exits. This is the expected behavior (the one I implemented and thought makes sense).
Thanks, corrected. |
Yes, the missing queue case is an edge case. Currently PerfTest creates the queue anyway and exits because the consumer is idle. |
…-activity Add --exit-when option
Fixes #279