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.


You can run lavinmqperf with the command line input

bin/lavinmqperf [throughput | bind-churn | queue-churn | connection-churn | connection-count] [arguments]

If you don’t specify any arguments, Lavinmqperf will run the tests with default settings. Please see the Parameters section below for more information.


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 local machine

crystal run src/ -- -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.


Lavinmqperf supports the following performance metrics #### 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.


Lavinmqperf provides several parameters that allow you to customize the tests to your specific needs. Here is a table that explains the available parameters and how to set them:

Option Description Default Value
-x [# of publishes] Sets the number of publishers 1
-y [# of consumers] Sets the number of consumers 1
-s [msgsize] Sets the size of each message 16 bytes
-a [# of messages] Sets the number of messages consumed before an Ack 0
-c [# of messages] Sets the number of messages to confirm publishes  
-t [# of messages] Sets the number of publish messages in transactions  
-T [# of messages] Sets the number of ack messages in transactions  
-u [queue name] Sets the queue name perf-test
-k [routing-key name] Sets the routing key name Same as queue name
-e [exchange name] Sets the exchange name “\”
-r [publish rate] Sets the maximum publish rate 0
-R [consumer rate] Sets the maximum consumer rate 0
-p Sets persistent messages to true false
-P [# of messages] Sets the number of messages to prefetch 0 (unlimited)
-g Poll with basic_get instead of consuming  
-j Sets flag to get output as JSON  
-z [seconds] Sets the number of seconds to run the test Unlimited
-q Sets flag to only print summary Prints every second
-C [# of messages] Publishes a maximum of X messages Unlimited
-D [# of messages] Consumes a maximum of X messages Unlimited
--queue-arg=JSON Queue arguments as a JSON string  
--consumer-arg=JSON Consumer arguments as a JSON string  
--uri=[URI] URI to connect to amqp://guest:guest@localhost

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.

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.