Skip to content

epomatti/azure-servicebus-performance-benchmark

Repository files navigation

Azure Service Bus - Performance Benchmark

Benchmarking the performance of Azure Service Bus on Standard and Premium tiers using the Java SDK.

💻 Local Development

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/bicep/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-benchmark999-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

Tip

Check for dependencies and plugins updates.

Run the benchmark client:

mvn install
mvn exec:java
mvn package -P assemble-all

🚀 Cloud Benchmark

Run the benchmark in the cloud with a Premium namespace.

Create the Linux VM SSH key pair:

mkdir .keys && ssh-keygen -f .keys/temp_rsa

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

📈 Benchmarking Results

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:

Troubleshooting

Due to this issue, defaultBoundedElasticSize needed to be set for Reactor. Value must be greater than "maxConcurrentCalls".

This seems to have been resolved, but here is the command for reference if needed:

mvn exec:java -Dreactor.schedulers.defaultBoundedElasticSize=100

References