Home

Awesome

Watermill Benchmark

<img align="right" width="300" src="https://watermill.io/img/gopher.svg">

This is a set of tools for benchmarking watermill.

Warning: This tool is meant to provide a rough estimate on how fast each Pub/Sub can process messages. It uses very simplified infrastructure to set things up and default configurations.

Keep in mind that final performance depends on multiple factors.

It's not meant to be a definitive answer on which Pub/Sub is the fastest. It should give you an idea of the ballpark performance you can expect.

How it works

Results (as of 18 November 2024)

Kafka (one node)

Message size (bytes)Publish (messages / s)Subscribe (messages / s)
1641,492101,669
6440,189106,264
25640,044107,278

NATS Jetstream (16 Subscribers)

Message size (bytes)Publish (messages / s)Subscribe (messages / s)Subscribe (messages / s - async ack)
1650,66834,71359,728
6449,20434,56159,743
25648,24234,09759,385

NATS Jetstream (48 Subscribers)

Message size (bytes)Publish (messages / s)Subscribe (messages /s )Subscribe (messages / s - async ack)
1650,68046,37786,348
6449,34146,30786,078
25648,74446,03586,499

Redis

Message size (bytes)Publish (messages / s)Subscribe (messages / s)
1659,15812,134
6458,98812,392
25658,03812,133

SQL (MySQL)

Message size (bytes)Publish (messages / s)Subscribe (messages / s - batch size = 1)Subscribe (messages / s - batch size = 100)
166,3712832,794
649,8872812,637
2569,5962712,766

SQL (PostgreSQL)

Message size (bytes)Publish (messages / s)Subscribe (messages / s - batch size = 1)Subscribe (messages / s - batch size = 100)
162,5521229,460
642,8311189,045
2562,7441047,843

SQL (PostgreSQL Queue)

Subscribe Batch SizeMessage size (bytes)Publish (messages / s)Subscribe (messages / s - batch size = 1)Subscribe (messages / s - batch size = 100)
100162,82514610,466
100642,8421479,626
1002562,8451388,276
Message size (bytes)Publish (messages / s)Subscribe (messages / s)
162,8250,146
642,8420,147
2562,8450,138

Google Cloud Pub/Sub (16 subscribers)

Message size (bytes)Publish (messages / s)Subscribe (messages / s)
163,02728,589
643,02031,057
2562,91832,722

AMQP (RabbitMQ, 16 subscribers)

Message size (bytes)Publish (messages / s)Subscribe (messages / s)
162,77014,604
642,75212,128
2562,7508,550

GoChannel

Message size (bytes)Publish (messages / s)Subscribe (messages / s)
16315,776138,743
64325,341163,034
256341,223145,718

VM Setup

The project includes Terraform definition for setting up an instance on Google Cloud Platform.

It will spin up a fresh Ubuntu 19.04 instance, install docker with dependencies and clone this repository.

Set environment variables:

# project name on GCP
TF_VAR_project=
# public part of the key that you will use to access SSH
TF_VAR_pub_key_path=

Create the VM:

cd setup
terraform apply

The command will output the public IP address of the server. Use ssh with user benchmark to access it.

After running all benchmarks, destroy the VM:

terraform destroy

Configuration

Google Pub/Sub

Set environment variables in compose/.env:

# path to json file within the project with GCP credentials
GOOGLE_APPLICATION_CREDENTIALS=compose/key.json
# project name on GCP
GOOGLE_CLOUD_PROJECT=

Running

Run benchmarks with:

./run.sh <pubsub>