Skip to content

Open source, composable payments platform | PCI compliant | SaaS and Self-host options | Enables connectivity to multiple payment, payout, fraud, vault and tokenization providers | Uplifts authorization with intelligent routing and revenue recovery | Reduce payment processing costs with cost observability | Reduces payment ops with reconciliation

11.1 KB
Raw Blame

EC2 deployment and capacity validation

Use one EC2 instance in the target services' VPC, one container and one admin. Start with 16 vCPUs and 32 GiB RAM; choose the final size from generator CPU, memory and network measurements. Run the generator on a different host from the services under test so they do not compete for compute resources.

Start

Mount encrypted gp3 EBS at /srv/loadtest. Size storage from measured bytes per API attempt × attempts/sec × test duration and desired run retention; every attempt is recorded, so artifacts are not small at 1,000 flows/sec. Configure EBS IOPS/throughput from recorder commit latency and backlog, and keep free-space alerts. Ensure /srv/loadtest is owned by container UID 1000.

From loadtest/console, prepare an ignored .env using .env.example. Inject admin hash and service credentials from AWS Secrets Manager into this runtime file or environment using the EC2 instance role. Do not build them into the image. Set:

ORIGIN=https://loadtest.example.com
CONSOLE_BIND_ADDRESS=0.0.0.0
CONSOLE_DATA_PATH=/srv/loadtest

Run docker compose up -d --build. The image uses the pinned Go/k6 extension and Node 24 runtime. Change service endpoints in Settings to the services' private DNS names; 127.0.0.1 inside a container refers to the container itself. The shared .env.example defaults to local development. Set PGHOST and GRAFANA_URL to addresses reachable from the container before deploying it.

Place an HTTPS ALB with an ACM certificate in front of port 4174. Allow inbound 4174 only from the ALB security group and allow browser ingress only from the intended administrator network. Set health checks to /health, deregistration delay to 75 seconds, and idle timeout to at least 90 seconds. SSE sends a snapshot every second and does not depend on the browser remaining open.

Only one console process/container may use the volume. Jobs and sessions persist in /data/console.sqlite; jobs left active after restart become interrupted. New jobs wait until surviving workers have stopped after a restart. Cancellation and shutdown allow 60 seconds for k6 to stop and drain. The container grace period is 75 seconds. Forced termination leaves incomplete recording.

Database TLS

Set PGSSLROOTCERT to an absolute mounted PEM path when PostgreSQL uses a private certificate authority, then launch with npm run start:tls. Leave the variable empty for a certificate issued by a system-trusted CA. The TLS launcher refuses to replace a worker that owns an active job or fault recovery. Container deployments can instead save the same CA path in Settings → Database; mount the certificate read-only and choose Verified certificate. For managed databases that require encryption but do not expose a verifiable server CA, choose Required · encrypted.

Grafana

Grafana panels run on a separate origin, served on port 4176 by default. Publish that port through a separate same-site HTTPS hostname (for example metrics.loadtest.example.com) and set GRAFANA_EMBED_ORIGIN accordingly. Route only that hostname to port 4176; keep the console hostname on 4174. Both listeners must reach the same console data directory. The normal Compose file exposes both ports on loopback for local use. Grafana access uses one-time embed tickets and a separate HttpOnly cookie, revoked when its console session ends.

GRAFANA_URL binds the server's Grafana identity to its upstream origin. Changing the saved base URL to another origin cannot forward that identity; change the server configuration explicitly when moving Grafana. Similarly, changing Router, Superposition or database destinations requires entering their credentials again.

Workers stop active load if control-plane contact is lost for 30 seconds, with a 10-second drain before forced termination. Cancellation and worker failures stop sibling workers before the coordinator finishes; unverified stops fail explicitly.

The Node adapter permits streamed artifacts up to 2 GB by default. Other API requests and login forms retain a streamed 1 MiB limit. Reverse proxies must allow the artifact upload size and sufficient upload time on worker routes.

The console automatically detects root-hosted Grafana and rewrites its frontend paths under the authenticated /grafana/ proxy. Existing Grafana deployments can stay at /; no deployment changes are required for path compatibility. Embedding still requires Grafana to permit frames and a server identity that can authenticate panel HTML. Grafana Live WebSocket panels are not supported.

For a dedicated Grafana deployment, you can alternatively configure:

[server]
root_url = https://loadtest.example.com/grafana/
serve_from_sub_path = true
[security]
allow_embedding = true
cookie_secure = true

Supply GRAFANA_TOKEN for a Viewer service account. Grafana UI versions that do not accept bearer authentication for embeds require auth proxy mode:

[auth.proxy]
enabled = true
header_name = X-WEBAUTH-USER
header_property = username
auto_sign_up = true
enable_login_token = false
# Restrict to the console host's private IP; never expose this identity header publicly.
whitelist = <console-private-IP>
[users]
auto_assign_org_role = Viewer

Set GRAFANA_USER to that Viewer identity. Supply the private GRAFANA_URL as the upstream address. The console strips browser cookies/identity headers and accepts only the configured upstream. Add panel URLs under /grafana/d-solo/. The proxy supports read-only dashboard/data-source queries, not Grafana editing or live WebSocket panels.

Acceptance

  1. Run 10 flows/sec locally using the three-flow 50/30/20 mix and a Stripe test connector. Check login, SSE progress, cancellation, restart recovery and recon.
  2. On EC2 step through 100, 500 and 1,000 offered flows/sec. Tune VU multipliers from full-flow latency and observed drops, rather than request latency alone.
  3. Sustain 1,000 for 30 minutes in both merchant modes. Require no recording gaps, bounded queue, no dropped iterations due to the generator, and responsive UI. Report successful TPS and downstream failures separately from offered TPS.
  4. Characterize recorder CPU time, memory/network usage, queue depth, commit latency and successful TPS with representative flows before claiming a host's capacity. Use the native mock-backed integration tests for correctness, then measure against your actual environment. AWS provisioning is separate from this image; this console does not create cloud resources.

References: SvelteKit Node deployment, k6 capacity guidance, and Grafana auth proxy.

Worker ownership

The container entrypoint runs an SSR server and an independent loopback-only, authenticated worker service. /data/console.sqlite stores versioned profiles, fixture sets, jobs and activity; private worker connection metadata also lives under /data. Keep this volume on one local EBS filesystem, never share it between multiple console containers. Browser disconnects and SSR restarts leave workers executing. Container termination signals both services and drains the recorder; a worker crash marks unfinished runs incomplete on recovery.

Configure an existing PostgreSQL account with SELECT permission on payment_intent, then use Settings → Database → Test connection. No role is created automatically. Saved connection settings override environment defaults.

Distributed workers

The console is the control plane. It owns scenarios, synchronized run state, fault execution and result merging. Remote workers connect outbound over HTTPS, receive a worker-specific fixture/config bundle, run one TPS shard, and stream health and progress back. Workers never receive gcloud or kubectl credentials.

Set a long random LOADTEST_WORKER_ENROLLMENT_TOKEN on the control plane and each new worker. Enrollment exchanges it for a unique credential stored with mode 0600 in the worker data directory. Remove the enrollment token from a worker after its identity has been created. Put the control plane behind TLS in production and restrict the worker API to the private network.

For a local multi-container verification:

docker compose -f compose.yaml -f compose.distributed.yaml up --build --scale worker=4

Each worker defaults to 250 TPS and 2,500 VUs. Settings shows heartbeats and advertised capacity. Performance enables Distributed · auto when at least one remote worker is healthy. The scheduler refuses a run unless combined TPS and VU capacity satisfy the scenario, then schedules all workers against a common future start time. Infrastructure faults remain single control-plane events while load continues on every shard.

In cloud deployments use one persistent control-plane data volume, an Auto Scaling Group or Kubernetes Deployment for worker containers, and object storage for long-term artifact retention. Workers need outbound access to the control plane and the tested Hyperswitch endpoints; they need no inbound ports.

Build Dockerfile.cloud on top of the published console image for the control-plane Deployment. It installs the gcloud and kubectl binaries used by the Cloud fault presets. Authenticate it with workload identity and narrowly scoped AlloyDB IAM and Kubernetes RBAC; do not mount either credential into load workers. The ordinary console image remains suitable when infrastructure faults are disabled.

Existing fixtures and custom fault execution

Imported credential files use the same private server-side fixture format as provisioned fixtures (directories 0700, files 0600). Fixture APIs return verification results and identifiers, never keys. Do not commit .data, fixture artifacts, or credential JSON. Verification performs read-only Hyperswitch inspections; actual connector authorization is a separate smoke test. Keep the admin inspection key bound to the intended Router endpoint.

Custom fault commands are disabled by default. Setting LOADTEST_ALLOW_CUSTOM_COMMANDS=true grants authenticated console administrators shell execution as the supervisor's OS user. Enable it only on a trusted console; use a dedicated OS identity with access limited to the intended test resources. The working directory and any scripts must exist on that machine or inside its container. Remote hosts require explicit remote commands and credentials managed outside command text. Existing GCP/Kubernetes adapters remain the default.

The supervisor snapshots commands into each run and journals recovery before triggering. A nonzero exit, timeout, or interrupted trigger still attempts configured restoration. Self-recovering faults omit restoration but must pass the healthy check. Keep scripts idempotent, checks read-only, and timeouts short enough for stop-time recovery. Process groups are killed when a command exceeds its timeout. Command stdout/stderr are not recorded; activity and failures identify lifecycle stages. Changing the deployment opt-in requires restarting the idle supervisor as well as the web process. Never reload it during an active fault.