Introduction
Configuration
Language Support
AMQP 0-9-1 Overview
More Exchange Types
More Consumer Features
Queue Deep-dive
Other Features
Reliable Message Delivery
High Availability
Monitoring
Management HTTP API
Tutorials
Networking
LavinMQ CLI
lavinmqperf
lavinmqperf
is a command-line tool designed to help you test the performance of your LavinMQ service. It allows you to spin up clients on your server and measure the performance of LavinMQ as these clients interact with it in different ways.lavinmqperf
provides real-time updates and a summary report of the results at the end of each test.
Usage
You can run lavinmqperf
with the command line input
bin/lavinmqperf [protocol] [throughput | bind-churn | queue-churn | connection-churn | connection-count | queue-count] [arguments]
[protocol]
can be either amqp
or mqtt
, depending on which protocol you want to test. The [throughput | bind-churn | queue-churn | connection-churn | connection-count | queue-count]
specifies the type of test you want to run. The [arguments]
are optional parameters that allow you to customize the test.
If you don’t specify any protocol or arguments, lavinmqperf
will run the tests with default AMQP settings. Please see the Parameters section below for more information.
Example
Here is a simple example on how to run a throughput test with lavinmqperf
on your local setup.
First, make sure LavinMQ is running on your machine
crystal run src/lavinmq.cr -- -D /tmp/amqp
Go to the LavinMQ repository and run
bin/lavinmqperf throughput -x 1 -y 2
This command runs a throughput test with lavinmqperf
, using one publisher and two consumers.
AMQP Features
lavinmqperf
supports various performance metrics to help you evaluate the performance of your LavinMQ service. The available metrics for the AMQP protocol include:
Throughput
Measures the number of messages per second that LavinMQ can sustain to publish and consume.
Bind-churn
Measures the maximum rate at which LavinMQ can bind to both a durable and a non-durable queue.
Queue-churn
Measures the maximum rate at which LavinMQ can create and delete a queue.
Connection-churn
Measures the maximum rate at which clients can connect and disconnect.
Connection-count
Measures the number of connections that LavinMQ can sustain, as well as the amount of memory used by those connections.
Queue-count
Measures the number of queues that LavinMQ can sustain.
Parameters
lavinmqperf
provides several parameters that allow you to customize the tests to your AMQP needs. Here is a table that explains the available parameters and how to set them:
Option / Flag | Description | Default Value |
---|---|---|
-x, --publishers=number | Number of publishers | 1 |
-y, --consumers=number | Number of consumers | 1 |
-s, --size=bytes | Size of each message | 16 bytes |
-V, --verify | Verify the message body | false |
-a, --ack=messages | Ack after X consumed messages | 0 |
-c, --confirm=max-unconfirmed | Confirm publishes every X messages | |
-t, --transaction=messages | Publish messages in transactions | |
-T, --transaction=acknowledgements | Ack messages in transactions | |
-u, --queue=name | Queue name | perf-test |
-k, --routing-key=name | Routing key | Same as queue name |
-e, --exchange=name | Exchange to publish to | ”” |
-r, --rate=number | Max publish rate | 0 |
-R, --consumer-rate=number | Max consume rate | 0 |
-p, --persistent | Persistent messages | false |
-P, --prefetch=number | Number of messages to prefetch | 0 (unlimited) |
-g, --poll | Poll with basic_get instead of consuming | false |
-j, --json | Output result as JSON | false |
-z, --time=seconds | Only run for X seconds | Unlimited |
-q, --quiet | Quiet, only print the summary | false |
-C, --pmessages=messages | Publish max X number of messages | Unlimited |
-D, --cmessages=messages | Consume max X number of messages | Unlimited |
--queue-args=JSON | Queue arguments as a JSON string | |
--consumer-args=JSON | Consumer arguments as a JSON string | |
--properties=JSON | Properties added to published messages | |
--random-bodies | Each message body is random | false |
MQTT Features
Throughput
Measures the number of messages per second that LavinMQ can sustain to publish and consume.
Parameters
lavinmqperf
provides several parameters that allow you to customize the tests to your MQTT needs. Here is a table that explains the available parameters and how to set them:
Option / Flag | Description | Default Value |
---|---|---|
-x, --publishers=number | Number of publishers | 1 |
-y, --consumers=number | Number of consumers | 1 |
-s, --size=bytes | Size of each message | 16 bytes |
-V, --verify | Verify the message body | false |
-q, --qos=level | QoS level (0 or 1) | 0 |
-t, --topic=name | Topic name | perf-test |
-r, --rate=number | Max publish rate | 0 |
-R, --consumer-rate=number | Max consume rate | 0 |
-j, --json | Output result as JSON | false |
-z, --time=seconds | Only run for X seconds | Unlimited |
-q, --quiet | Quiet, only print the summary | false |
-C, --pmessages=messages | Publish max X number of messages | Unlimited |
-D, --cmessages=messages | Consume max X number of messages | Unlimited |
--random-bodies | Each message body is random | false |
--retain | Set retain flag on published messages | false |
--clean-session | Use clean session | false |
-u, --uri=uri | MQTT broker URI | mqtt://localhost:1883 |
Ready to take the next steps? Here are some things you should keep in mind:
Managed LavinMQ instance on CloudAMQP
LavinMQ has been built with performance and ease of use in mind - we've benchmarked a throughput of about 1,000,000 messages/sec. You can try LavinMQ without any installation hassle by creating a free instance on CloudAMQP. Signing up is a breeze.
Running on Kubernetes?
We have built a LavinMQ operator to simplify deployment and management on Kubernetes. You can find the installation guide and source code on GitHub.
Help and feedback
We welcome your feedback and are eager to address any questions you may have about this piece or using LavinMQ. Join our Slack channel to connect with us directly. You can also find LavinMQ on GitHub.