Skip to main content

curl load test and response comparison dashboard

Project description

Curl Compare Load Test

A lightweight Flask-based load testing dashboard that executes real curl commands against two target hosts and compares response behavior under concurrent traffic.

It is useful for migration validation, canary checks, regression detection, and performance baselining between API environments.

Curl Compare UI

What It Does

  • Runs the same curl template against two hosts by replacing {host}.
  • Supports per-request variable substitution ({id}, {name}, etc.).
  • Simulates Locust-style concurrency with configurable users, spawn rate, and duration.
  • Streams live results via Server-Sent Events (SSE).
  • Compares responses as JSON (semantic compare) when possible, otherwise raw text.
  • Captures curl timings using time_total and time_starttransfer (TTFB).
  • Shows request-level diffs and aggregate metrics (avg, p50, p95, p99).

Requirements

  • Python >=3.9
  • curl available in the runtime environment
  • Pip for dependency installation

Installation

Install as a package:

pip install .

Or install dependencies only:

pip install -r requirements.txt

Running the Application

Development:

curl-compare-loadtest

Production example with Gunicorn:

gunicorn -w 4 -k gthread -b 0.0.0.0:8000 app:app

Open http://localhost:8000.

Quick Start

  1. Enter a curl template that includes {host}.
  2. Provide Host 1 and Host 2 (domain only, no protocol).
  3. Add variable lines (key=value,key2=value2), one line per request profile.
  4. Configure users, spawn rate, and duration.
  5. Run the test and inspect live status, latency metrics, and response diffs.

Curl Template and Variables

Required token

  • {host} must exist in the template.

Optional tokens

  • Any {token} that matches keys in each variable line.
  • {vars} is also supported and maps to the full raw variable line.

Example:

Template:

curl -X GET "https://{host}/v1/items?id={id}&name={name}"

Variable lines:

id=123,name=alice
id=124,name=bob

Headers and body placeholders are also supported:

curl -X POST "https://{host}/v1/users" -H "X-Trace-Id: {trace_id}" -d '{"name":"{name}"}'

Comparison Logic

  • MATCH: responses are identical.
    • If both bodies are valid JSON, objects are compared structurally.
    • Otherwise, raw response text is compared.
  • DIFFERENCE: responses differ.
  • EMPTY: one or both responses are empty.
  • TEMPLATE ERROR: template/render/command/timing issue occurred for at least one host.

Runtime Limits and Input Guardrails

  • users: 1 to 500
  • spawn_rate: 0.1 to 200 users/sec
  • duration_seconds: 1 to 3600
  • per curl execution timeout: 30 seconds
  • stored response body for diff display: up to 20000 chars per host

Out-of-range numeric values are clamped to safe limits.

API Endpoints

  • GET /
    Serves the dashboard UI.
  • GET /stream
    Starts a run and streams events via SSE.
  • POST /stop?run_id=<id>
    Stops an active run.

/stream query parameters:

  • curl_template
  • host1
  • host2
  • variables (multiline key=value,...)
  • users
  • spawn_rate
  • duration_seconds
  • run_id (optional; generated if omitted)

Packaging

Build distributable artifacts:

python -m build

Artifacts are created in dist/ (wheel and source distribution).

Project Metadata

  • Package: curl-compare-loadtest
  • Entry point: curl-compare-loadtest -> app:main
  • License: MIT

Notes for Reliable Results

  • Keep request templates deterministic where possible.
  • Avoid including volatile fields (timestamps, random IDs) if strict matching is required.
  • Use representative variable sets to simulate production-like traffic patterns.

License

MIT License. See LICENSE.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

curl_compare_loadtest-0.0.3.tar.gz (16.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

curl_compare_loadtest-0.0.3-py3-none-any.whl (14.5 kB view details)

Uploaded Python 3

File details

Details for the file curl_compare_loadtest-0.0.3.tar.gz.

File metadata

  • Download URL: curl_compare_loadtest-0.0.3.tar.gz
  • Upload date:
  • Size: 16.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for curl_compare_loadtest-0.0.3.tar.gz
Algorithm Hash digest
SHA256 b9dfd2be679584d2755817e76c18283fb233934e40e29842b5c50bf203ec943b
MD5 881c3af4e193af4fde6fcfc77b6fe758
BLAKE2b-256 790b2707fe8879cc206fd21b644833ce787882959dcdf6632cbb8c043984d4bf

See more details on using hashes here.

File details

Details for the file curl_compare_loadtest-0.0.3-py3-none-any.whl.

File metadata

File hashes

Hashes for curl_compare_loadtest-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 f55770d36396ca2485a7006b9ec69c29c0dfd5cccbcb01045181117ac3cac68f
MD5 eaeb65df61e1094a1f23d19398bff2c3
BLAKE2b-256 2e5d8012789b57b93efd220869cd78cfbd3b666f25eb34d290672d03ab61c001

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page