#apache-kafka #performance-testing #kafka #rocket-mq #benchmark #message #testing

app mq-workload-generator

A tool for testing the performance of Apache RocketMQ and Apache Kafka

5 releases

0.2.2 Mar 19, 2024
0.2.1 Mar 1, 2024
0.2.0 Feb 28, 2024
0.1.1 Dec 12, 2023
0.1.0 Aug 7, 2023

#31 in Profiling

Download history 8/week @ 2024-02-10 2/week @ 2024-02-17 258/week @ 2024-02-24 35/week @ 2024-03-02 43/week @ 2024-03-09 148/week @ 2024-03-16 14/week @ 2024-03-23 36/week @ 2024-03-30 8/week @ 2024-04-06

210 downloads per month

Custom license

27KB
321 lines

MessageQueue Workload Generator

Crates.io

Introduction

A tool for testing the performance of Apache RocketMQ and Apache Kafka.

Quick Start

Install

Install via cargo

cargo install mq-workload-generator

Install manually

Download the binary from release page. Currently, only Linux and macOS are supported. For other platforms, you need to build from source on your own.

Basic usage

send and receive 100 messages per second to the topic test:

# To set a parameter, choose either the CLI or ENV mode.
export ACCESS_POINT=localhost:9092
mq-workload-generator --topic test --qps 100
# example output: 
# this tool will print the current send and receive tps every second.
Jul 25 10:38:44.203 INFO[src/main.rs:32:5] Begin generating workload and wait for the server to come online...
Jul 25 10:38:44.204 INFO[src/main.rs:82:17] current send tps: 100, receive tps: 100
Jul 25 10:38:45.206 INFO[src/main.rs:82:17] current send tps: 100, receive tps: 100
Jul 25 10:38:46.205 INFO[src/main.rs:82:17] current send tps: 100, receive tps: 100
Jul 25 10:38:47.205 INFO[src/main.rs:82:17] current send tps: 100, receive tps: 100

All available options:

A tool for testing the performance of Apache RocketMQ and Apache Kafka

Usage: mq-workload-generator [OPTIONS] --topic <TOPIC>

Options:
  -d, --driver <DRIVER>
          Work load driver, available option: rocketmq, kafka [env: DRIVER=] [default: kafka]
  -a, --access-point <ACCESS_POINT>
          Access point of the mq cluster, default is localhost:8081 for RocketMQ and localhost:9092 for Kafka [env: ACCESS_POINT=]
  -t, --topic <TOPIC>
          Target topic [env: TOPIC=]
  -g, --group <GROUP>
          Group used by consumer [env: GROUP=] [default: mq_workload_generator]
  -p, --parallelism <PARALLELISM>
          Number of the client [env: PARALLELISM=] [default: 1]
  -q, --qps <QPS>
          Send tps of the sum of all producers [env: QPS=] [default: 100]
      --key-size <KEY_SIZE>
          Random key with specified size for each record sent by producer [env: KEY_SIZE=]
      --min-payload-size <MIN_PAYLOAD_SIZE>
          Minimum message payload size, measured in bytes [env: MIN_PAYLOAD_SIZE=]
      --max-payload-size <MAX_PAYLOAD_SIZE>
          Maximum message payload size, measured in bytes [env: MAX_PAYLOAD_SIZE=]
      --payload-size <PAYLOAD_SIZE>
          Fixed message payload size, measured in bytes. The priority is given to the dynamic payload size, which ranges from **min_payload_size** to **max_payload_size** [env: PAYLOAD_SIZE=] [default: 4096]
      --mode <MODE>
          Mode of the workload test, available values: producer, consumer, producer_and_consumer [env: MODE=] [default: producer_and_consumer]
      --access-key <ACCESS_KEY>
          Access Key to the topic [env: ACCESS_KEY=] [default: ]
      --secret-key <SECRET_KEY>
          Secret Key to the topic [env: SECRET_KEY=] [default: ]
  -v, --verbose
          Print detail error [env: VERBOSE=]
  -h, --help
          Print help
  -V, --version
          Print version

Use in Kubernetes

There is an out-of-the-box Kubernetes manifest file available for deploying the workload generator in Kubernetes.

kubectl create namespace benchmark
kubectl apply -f deployment-consumer.yaml
kubectl apply -f deployment-producer.yaml

TODO

  • Add more options: user-specific consumer group, payload size, consume time, lag message count, etc.
  • Support more platform: Apache Kafka.
  • Add more metrics: send/receive latency, etc.
  • Add more test cases: send/receive with large message or delay/transaction message.

Dependencies

~36–53MB
~900K SLoC