Your Python benchmark says 134 TPS. Your endpoint does 1,100+.
A compiled Go benchmark client for Amazon SageMaker real-time inference endpoints. Measures true server-side throughput, latency percentiles, and cost-per-inference — without client-side bottlenecks.
$ smbench --endpoint fraud-xgb-c7g-xlarge --region us-east-1
Endpoint: fraud-xgb-c7g-xlarge
Cost: $0.170/hr
Warmup: 100 requests, avg 7.2ms
Latency (500 sequential): p50=5.4ms p95=6.0ms p99=6.7ms
Throughput:
conc TPS p50(ms) p95(ms) p99(ms) errors
------------------------------------------------------------
1 156.0 6.4 6.9 7.1 0
10 1036.0 9.6 11.2 12.8 0
50 1209.0 41.3 52.1 58.4 0
100 1220.0 81.9 103.2 112.3 0
200 1231.0 162.4 198.7 214.6 0
500 1228.0 406.8 482.1 521.3 0
Peak TPS: 1231 | Cost: $0.0384 per million inferences
CPython's Global Interpreter Lock holds for ~7ms per invoke_endpoint call (SigV4 signing + TLS + request construction). A single Python process maxes at ~134 req/s regardless of thread count. This causes teams to massively over-provision endpoints.
Generic load testers (wrk, vegeta, hey, k6) can't hit SageMaker endpoints because they don't support AWS SigV4 request signing.
smbench uses Go goroutines for true parallelism with the AWS SDK, revealing actual server capacity.
# Install
go install github.com/dgallitelli/smbench@latest
# Benchmark an endpoint (uses sensible defaults)
smbench --endpoint my-model-endpoint --region us-east-1
# With full control via config file
smbench --config bench.yaml --output json- AWS credentials configured (environment variables,
~/.aws/credentials, or IAM role on EC2) - IAM permissions:
sagemaker:InvokeEndpoint(required),pricing:GetProducts(optional, for cost lookup) - Endpoint must be InService in the target region
- Run from EC2 in the same region for accurate results (cross-internet latency masks true throughput)
Go install (requires Go 1.21+):
go install github.com/dgallitelli/smbench@latestPre-built binaries (no Go required):
Download from GitHub Releases for:
linux/amd64— standard EC2 instanceslinux/arm64— Graviton EC2 instancesdarwin/amd64— macOS (Intel)darwin/arm64— macOS (Apple Silicon)
From source:
git clone https://github.com/dgallitelli/smbench.git
cd smbench && go build .Benchmark a single endpoint with defaults (concurrency 1/10/50/100, 30s per level):
smbench --endpoint my-endpoint --region us-east-1Override concurrency and duration:
smbench --endpoint my-endpoint --region us-east-1 \
--concurrency 1,10,50,100,200,500 \
--duration 60sFor trustworthy throughput numbers, run smbench from an EC2 instance in the same region as your endpoints. Use an m5.4xlarge or larger to ensure the client doesn't bottleneck.
Option 1 — SSH/SSM into EC2 and run directly:
# Download the binary (use linux_arm64 for Graviton instances)
curl -sL https://github.com/dgallitelli/smbench/releases/latest/download/smbench_0.1.0_linux_amd64.tar.gz | tar xz
# Run
./smbench --endpoint my-model --region us-east-1 --output json > results.jsonOption 2 — Run remotely via SSM (no SSH needed):
INSTANCE_ID=i-0abc123def456
REGION=us-east-1
ENDPOINT=my-model-c7g-xlarge
CMD_ID=$(aws ssm send-command \
--instance-ids "$INSTANCE_ID" \
--document-name AWS-RunShellScript \
--parameters "{\"commands\":[
\"curl -sL https://github.com/dgallitelli/smbench/releases/latest/download/smbench_0.1.0_linux_amd64.tar.gz | tar xz\",
\"./smbench --endpoint $ENDPOINT --region $REGION --concurrency 1,10,50,100,200,500 --output json\"
]}" \
--query "Command.CommandId" --output text)
# Wait and retrieve results
aws ssm get-command-invocation \
--command-id "$CMD_ID" \
--instance-id "$INSTANCE_ID" \
--query "StandardOutputContent" --output textOption 3 — Upload via S3:
# Build or download the binary, upload to S3
aws s3 cp smbench_linux_amd64 s3://my-bucket/tools/smbench
# On EC2
aws s3 cp s3://my-bucket/tools/smbench /tmp/smbench && chmod +x /tmp/smbench
/tmp/smbench --endpoint my-model --region us-east-1smbench --config bench.yamlValidate config without running:
smbench --validate --config bench.yaml# smbench configuration
endpoints:
- name: my-model-c7g-xlarge
cost_per_hour: 0.170 # optional: manual override
- name: my-model-c6i-xlarge
cost_per_hour: 0.214
benchmark:
concurrency: [1, 10, 50, 100, 200, 500]
duration: 30s # per concurrency level
warmup_requests: 100
latency_requests: 500
payload:
file: payload.csv # single file (repeated for all requests)
# OR
# dir: payloads/ # round-robin through directory
content_type: text/csv # sent as ContentType header
region: us-east-1 # optional: auto-detected from IMDS or SDK
pricing_lookup: true # optional: fetch $/hr from AWS Pricing APICommon content types: text/csv, application/json, application/x-npy, application/x-recordio-protobuf
| Flag | Description | Default |
|---|---|---|
--config |
Path to YAML config file | — |
--endpoint |
Single endpoint name (quick mode) | — |
--region |
AWS region (overrides config/IMDS) | auto |
--concurrency |
Comma-separated concurrency levels | 1,10,50,100 |
--duration |
Duration per concurrency level | 30s |
--output |
Output format: json, table |
table |
--validate |
Validate config and exit | false |
--version |
Print version | — |
Results are printed to stdout. Progress messages go to stderr, so you can safely redirect:
smbench --endpoint my-ep --region us-east-1 > results.txtsmbench --config bench.yaml --output json | jq '.results[0].cost_per_million'Full JSON schema example
{
"environment": {
"instance_type": "m5.4xlarge",
"availability_zone": "us-east-1a",
"region": "us-east-1",
"timestamp": "2026-05-20T03:15:35Z",
"smbench_version": "0.1.0"
},
"config": {
"concurrency": [1, 10, 50, 100, 200, 500],
"duration_seconds": 30,
"warmup_requests": 100,
"latency_requests": 500,
"content_type": "text/csv",
"payload_count": 1
},
"results": [
{
"endpoint": "fraud-xgb-c7g-xlarge",
"cost_per_hour": 0.170,
"warmup": {"requests": 100, "avg_ms": 7.2},
"latency": {"requests": 500, "p50_ms": 5.4, "p95_ms": 6.0, "p99_ms": 6.7},
"throughput": [
{"concurrency": 1, "tps": 156.0, "p50_ms": 6.4, "p95_ms": 6.9, "p99_ms": 7.1, "total_errors": 0},
{"concurrency": 100, "tps": 1220.0, "p50_ms": 81.9, "p95_ms": 103.2, "p99_ms": 112.3, "total_errors": 0}
],
"cost_per_million": 0.0384
}
]
}Each endpoint undergoes a 3-phase benchmark:
- Warmup — Sequential requests to prime JIT compilation, TLS sessions, and connection pools
- Sequential Latency — 500 back-to-back single requests measuring uncontended round-trip time (p50/p95/p99)
- TPS Scaling — Sustained concurrent load at each concurrency level for the configured duration. TPS = successful requests / elapsed wall time
$/million = (cost_per_hour / (peak_tps × 3600)) × 1,000,000
Cost comes from: manual cost_per_hour in config, or auto-lookup via the AWS Pricing API. The pricing lookup infers instance type from the endpoint name (e.g., my-model-c7g-xlarge → ml.c7g.xlarge). If your endpoint naming doesn't follow this convention, use cost_per_hour in config.
| Category | Meaning |
|---|---|
ModelError |
5xx from the container (model crash, OOM, timeout) |
Throttling |
429 / rate limit (endpoint at capacity) |
ValidationError |
Bad request (wrong payload format) |
ServiceUnavailable |
Cold start or scaling event |
Context cancellation errors (in-flight requests when the measurement window ends) are excluded from error counts and latency calculations.
| Tool | Problem |
|---|---|
| Python + ThreadPoolExecutor | GIL caps at ~134 TPS per process regardless of thread count |
| Locust | Python-based — same GIL limit per worker process |
| wrk / hey / vegeta / k6 | HTTP-only — no AWS SigV4 signing, can't authenticate with SageMaker |
| SageMaker Inference Recommender | Black box, no raw data export, limited concurrency control |
| multiprocessing (Python) | Works but requires N processes × N connection pools — complex and resource-heavy |
- Run from an EC2 instance in the same region and AZ as your endpoints for accurate results
- Use m5.4xlarge or larger for the benchmark client — you need enough vCPUs for goroutines at high concurrency
- Results are comparable only within the same client instance type, region, and AZ
- Payload matters — always benchmark with representative production payloads, not synthetic data
- Cost numbers assume sustained peak — real cost depends on your traffic pattern
| Symptom | Cause | Fix |
|---|---|---|
| All requests fail | Wrong region or endpoint name | Check --region matches where endpoint is deployed |
| 0 TPS / p50=0.0ms | Endpoint not InService | Run aws sagemaker describe-endpoint --endpoint-name <name> |
| Pricing lookup failed | Missing IAM permissions or non-standard endpoint name | Add pricing:GetProducts permission, or set cost_per_hour in config |
| ~134 TPS ceiling | You're running a Python client, not smbench | Use the Go binary |
| High latency (>100ms) | Running from outside the endpoint's region | Run from an EC2 instance in the same region |
Apache 2.0