A Java-based load testing framework for AWS SNS & SQS that measures publishing and receiving throughput across Standard and FIFO topics/queues.
This repository contains the test runner, client helpers, and configuration for benchmarking SNS publishing, SNS→SQS delivery, and direct SQS send/receive performance using AWS SDK v2 (async).
aws-sns-sqs-test/
├── src/main/java/net/dev4any1/messaging/awsSnsSqsTest/
│ ├── Main.java # Entry point
│ ├── AWSTest.java # Core load testing framework
│ ├── AwsClients.java # SNS/SQS clients and helpers
│
├── src/main/resources/
│ ├── app.properties # Test configuration (region, queue/topic ARNs)
│ ├── log4j2.xml # Logging configuration
│ ├── template.xml # Sample test message
│
├── pom.xml # Maven build file
└── README.md
- Java 8+
- Maven 3.6+
- AWS account with SNS and SQS enabled
- Please set
AWS_LOCAL_PROFILEinapp.propertiesaccording to the valid profile name in~/.aws/credentialsor disable this property if you are running inside AWS.
mvn clean packageThis creates a runnable fat JAR in:
target/aws-sns-sqs-test.jar
java -jar target/aws-sns-sqs-test.jarjava -jar target/aws-sns-sqs-test.jar 0java -jar target/aws-sns-sqs-test.jar 0 3The runner reads app.properties to discover tests defined as SQS_QUEUE_URL_N / SNS_TOPIC_ARN_N / TEST_NAME_N.
Edit src/main/resources/app.properties to define AWS region, profile, queues, and topics.
Example snippet:
AWS_DOMAIN=amazonaws.com
AWS_LOCAL_PROFILE=MY_AWESOME_PROFILE
AWS_REGION=ap-southeast-1
LOADTEST_MESSAGES_COUNT=10000
TEST_NAME_0=SQS standard; SNS standard
SQS_QUEUE_URL_0=https://sqs.ap-southeast-1.amazonaws.com/123456789012/MY_STD_QUEUE
SNS_TOPIC_ARN_0=arn:aws:sns:ap-southeast-1:123456789012:MY_STD_TOPICKey properties used by the runner (defaults live in src/main/resources/app.properties):
AWS_REGION— AWS regionAWS_LOCAL_PROFILE— (optional) local AWS profile for credentialsAWS_LONG_POLLING_TIMEOUT_SECONDS— receive wait timeAWS_VISIBILITY_TIMEOUT_SECONDS— receive visibility timeoutAWS_MAXBATCH— max number of messages per receive (<= 10)LOADTEST_MESSAGES_COUNT— number of messages to send/receive per test
Below are the exact measured results from a full run (run on 2025-10-03) with 10,000 messages per test in ap-southeast-1.
The run was executed on an r5b.2xlarge instance. CPU details from the instance during testing:
CPU(s): 8
Thread(s) per core: 2
Core(s) per socket: 4
Socket(s): 1
Model name: Intel(R) Xeon(R) Platinum 8259CL CPU @ 2.50GHz
CPU MHz: 3095.041
Log source: the numbers below were extracted from the test runner logs produced during the run (timestamps in the logs are from 2025-10-03).
| Test name | SNS publish th. msg/sec | SQS-SNS receive th. msg/sec | SQS send th. msg/sec | SQS receive th. msg/sec |
|---|---|---|---|---|
| SQS standard; SNS standard | 60.036 | 625.000 | 147.393 | 714.286 |
| SQS standard; SNS fifo | 56.828 | 625.000 | 154.433 | 714.286 |
| SQS fifo; SNS fifo | 57.581 | 303.030 | 110.763 | 312.500 |
| SQS fifo dedup; SNS fifo | 61.890 | 312.500 | 105.594 | 312.500 |
| SQS fifo fast; SNS fifo | 59.741 | 303.030 | 104.432 | 312.500 |
| SQS fifo fast dedup; SNS fifo | 59.879 | 312.500 | 106.002 | 312.500 |
Where these numbers came from (example log lines):
2025-10-03 13:14:07.1 ... SNS publishing throughput: [60.036] messages/second; sends 10000 messages in 166.566 seconds2025-10-03 13:14:23.8 ... SNS receiving throughput: [625.000] messages/second; receives 10000 messages in 16.000 seconds2025-10-03 13:15:31.8 ... SQS sending throughput: [147.393] messages/second; sends 10000 messages in 67.846 seconds2025-10-03 13:15:46.4 ... SQS receiving throughput: [714.286] messages/second; receives 10000 messages in 14.000 seconds
(Full run logs include similar lines for each of the six test cases.)
The framework performs the following per test case:
- (If SNS topic is configured) Connect the SQS queue to the SNS topic by updating the queue policy and creating a subscription.
- Publish
LOADTEST_MESSAGES_COUNTmessages to the SNS topic (or directly to SQS for direct-send tests). - Receive messages from the SQS queue using asynchronous receives with long polling and delete them.
- Measure the time taken and calculate throughput (messages/second) for each operation:
- SNS publish throughput (time to publish N messages to SNS)
- SQS-SNS receive throughput (time to receive N messages that SNS delivered to the queue)
- SQS send throughput (time to
SendMessageN messages directly to the queue) - SQS receive throughput (time to receive N messages directly from the queue)
The code uses shared async clients (SnsAsyncClient, SqsAsyncClient) and recursive CompletableFuture chains to saturate the service while maintaining a simple control flow.
- Standard queues show the highest end-to-end throughput. They are good for high-volume messaging where ordering across all messages is not required.
- FIFO queues consistently show lower throughput (ordering + deduplication overhead). Performance varies across FIFO configurations — e.g.
deduptoggles will affect throughput. - In this run SNS publish throughput is the bottleneck compared to direct SQS send in several test cases.
- Always run multiple iterations and average results for production-grade benchmarking — single runs can be influenced by transient network or region-level factors.
- Configure
app.propertieswith your topic ARNs and queue URLs. Use distinct queues/topics for each test case. - Ensure the SQS queue policy allows SNS to
sqs:SendMessagefrom the topic ARN (the code can set this viaDeliverySetup). - Build & run the jar as shown in the Run section.
- Inspect logs (configured via
log4j2.xml) for the* throughput:lines and collect numbers.
A simple flow diagram (Publisher → SNS → SQS → Consumers) is useful for docs. Place a PNG (e.g. docs/sns-sqs-flow.png) next to this README if desired.
MIT License