- AlibabaCloud (AliCloud)
$ git clone https://github.com/openmessaging/openmessaging-benchmark $ cd openmessaging-benchmark
You’ll also need to have Maven installed.
Create local artifacts
Once you have the repo cloned locally, you can create all the artifacts necessary to run the benchmarks with a single Maven command:
$ mvn install
Deploy a RocketMQ cluster on AlibabaCloud
You can deploy a RocketMQ cluster on AliCloud (for benchmarking purposes) using Terraform and Ansible. You’ll need to have both of those tools installed as well as the
terraform-inventory plugin for Terraform.
In addition, you’ll need to:
- Create an AliCloud account (or use an existing account)
Export the AccessKey and SecretKey
Once you’re all set up with AliCloud account, you’ll need to export the AccessKey and SecretKey.
$ export ALICLOUD_ACCESS_KEY="XXXX" $ export ALICLOUD_SECRET_KEY="XXXX"
Create resources using Terraform
With AccessKey and SecretKey in place, you can create the necessary AliCloud resources using just a few Terraform commands:
$ cd driver-rocketmq/deploy $ terraform init $ terraform apply
This will install the following ECS instances (plus some other resources, such as public IPs, a security group.):
|RocketMQ Broker instances||The VMs on which a RocketMQ broker will run||2|
|RocketMQ NameServer instances||The VMs on which a RocketMQ NameServer node will run||1|
|Client instance||The VM from which the benchmarking suite itself will be run||4|
When you run
terraform apply, you will be prompted to type
yes to continue with the installation or anything else to quit.
Once the installation is complete, you will see a confirmation message listing the resources that have been installed.
There’s a handful of configurable parameters related to the Terraform deployment that you can alter by modifying the defaults in the
||The AliCloud region in which the RocketMQ cluster will be deployed||
||The availability zone of the specific region||
||The name of file that can save key pairs data source after running terraform plan.||
||The AliCloud Machine Image to be used by the cluster’s machines||
||The ECS instance types used by the various components||
If you modify the
private_key_file, make sure that you point to the appropriate SSH key path in
ansible.cfg when running the Ansible playbook.
Running the Ansible playbook
With the appropriate infrastructure in place, you can install and start the RocketMQ cluster using Ansible with just one command:
$ ansible-playbook \ --user root \ --inventory `which terraform-inventory` \ deploy.yaml
SSHing into the client host
In the output produced by Terraform, there’s a
client_ssh_host variable that provides the IP address for the client EC2 host from which benchmarks can be run. You can SSH into that host using this command:
$ ssh -i rocketmq_alicloud.pem root@$(terraform output client_ssh_host)
Running the benchmarks from the client hosts
The benchmark scripts can be run from the /opt/benchmark working directory.
Once you’ve successfully SSHed into the client host, you can run any of the existing benchmarking workloads by specifying the YAML file for that workload when running the
benchmark executable. All workloads are in the
workloads folder. Here’s an example:
$ sudo bin/benchmark \ --drivers driver-rocketmq/rocketmq.yaml \ workloads/simple-workload.yaml
Although benchmarks are run from a specific client host, the benchmarks are run in distributed mode, across multiple client hosts.
There are multiple RocketMQ “modes” for which you can run benchmarks. Each mode has its own YAML configuration file in the
|Standard||Non-batch and at-least-once semantics||
The example used the “standard” mode as configured in
Specify client hosts
By default, benchmarks will be run from the set of hosts created by Terraform. You can also specify a comma-separated list of client hosts using the
--workers flag (or
-w for short):
$ sudo bin/benchmark \ --drivers driver-rocketmq/rocketmq.yaml \ --workers 22.214.171.124:8080,126.96.36.199:8080 \ # or -w 188.8.131.52:8080,184.108.40.206:8080 workloads/1-topic-16-partitions-1kb.yaml
Downloading your benchmarking results
The OpenMessaging benchmarking suite stores results in JSON files in the
/opt/benchmark folder on the client host from which the benchmarks are run. You can download those results files onto your local machine using
scp. You can download all generated JSON results files using this command:
$ scp -i rocketmq_alicloud.pem root@$(terraform output client_ssh_host):/opt/benchmark/*.json .
Tearing down your benchmarking infrastructure
Once you’re finished running your benchmarks, you should tear down the AliCloud infrastructure you deployed for the sake of saving costs. You can do that with one command:
$ terraform destroy -force
Make sure to let the process run to completion (it could take several minutes). Once the tear down is complete, all AliCloud resources that you created for the RocketMQ benchmarking suite will have been removed.