Benchmarking the performance of Azure Service Bus on Standard and Premium tiers using the Java SDK.
You can use this section to run the code locally, prior to running it in the cloud.
Start by creating the Service Bus namespace using a Standard bus tier:
# Upgrade
az bicep upgrade
# Create
az deployment sub create \
--location brazilsouth \
--template-file azure/dev/main.bicep \
--parameters rgLocation=brazilsouth
Get the connection string for the namespace:
az servicebus namespace authorization-rule keys list -g "rg-servicebus-benchmark-dev" --namespace-name "bus-benchmark-999-dev" --name "RootManageSharedAccessKey" --query "primaryConnectionString" -o tsv
Create the app.properties
in the root folder from the template:
# Open the file and edit the "connection_string" property
cp config/template.app.properties app.properties
Install the latest stable Java in your local machine if you don't have it:
sdk install maven
sdk install java 21-tem
Run the benchmark client:
mvn install
mvn exec:java -Dreactor.schedulers.defaultBoundedElasticSize=100
ℹ️ Due to this known issue,
defaultBoundedElasticSize
needs to be set for Reactor. Value must be greater than "maxConcurrentCalls".
Run the benchmark in the cloud with a Premium namespace.
First, create the Linux VM SSH key pair:
ssh-keygen -f azure/premium/id_rsa
Now create the infrastructure for the benchmark:
# Upgrade
az bicep upgrade
# Create
az deployment sub create \
--location brazilsouth \
--template-file azure/premium/main.bicep \
--parameters rgLocation=brazilsouth vmUsername=bench vmPassword=p4ssw0rd
Once the process is complete, connect to the VM and check if the cloud-init
script executed correctly:
ssh -i ./azure/premium/id_rsa bench@<publicIp>
cloud-init status
Download and extract the application code from the latest release:
curl -L https://github.com/epomatti/azure-servicebus-performance-benchmark/archive/refs/tags/v0.0.1.tar.gz -o client.tar.gz
tar -xf client.tar.gz
From the application root, create the properties file:
cp config/template.app.properties app.properties
Set up the Service Bus connectivity:
# Get the connection string (run this in your local machine)
az servicebus namespace authorization-rule keys list -g "rg-servicebus-benchmark-premium" --namespace-name "bus-benchmark-999-premium" --name "RootManageSharedAccessKey" --query "primaryConnectionString" -o tsv
# Edit with the real connection string of the Premium namespace
nano app.properties
Change the application properties of the client for a high volume load test. Example:
app.message_quantity=1000000
To control Java memory and JVM configurations:
export MAVEN_OPTS="-Xms256m -Xmx16g"
Run the application:
mvn install
mvn exec:java -Dlogback.configurationFile="logback-benchmark.xml" -Dreactor.schedulers.defaultBoundedElasticSize=1200
Average numbers collected during the tests:
Tier | Message Units | Send mode | Avg. messages / Sec |
---|---|---|---|
Premium | 1x | Single | 5,000 |
Premium | 1x | Batch | 13,888 |
Namespace resources:
Sample: