Skip to content

Load Testing

Trackarr includes a built-in load testing suite to measure tracker performance under high concurrency.

Quick Start

bash
# Start the load test environment
docker compose -f docker-compose.loadtest.yml up -d --build

# Wait for the tracker to be ready
docker logs -f trackarr-loadtest

# Initialize the database (first time only)
docker exec trackarr-loadtest npm run db:push

# Run load tests
npm run test:load -- --peers 100 --duration 10

Test Scenarios

ScenarioPeersDurationPurpose
Smoke10010sValidate setup
Normal1,00030sProduction-like load
Stress5,00060sFind breaking points

Smoke Test

Quick validation that everything works:

bash
npm run test:load -- --peers 100 --duration 10

Normal Load Test

Simulates typical production traffic:

bash
npm run test:load -- --peers 1000 --duration 30

Stress Test

Pushes the tracker to its limits:

bash
npm run test:load -- --peers 5000 --duration 60 --torrents 100

Configuration Options

OptionDefaultDescription
--urlhttp://localhost:8080Tracker URL
--peers100Number of simulated peers
--torrents10Number of torrents
--duration10Test duration (seconds)
--interval100Announce interval (ms)
--rampup2000Ramp-up time (ms)

Understanding Results

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
  LOAD TEST RESULTS
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

  Throughput:
    Total Requests:     1250
    Successful:         1250
    Failed:             0
    Error Rate:         0.00%
    Requests/sec:       125.00

  Latency (ms):
    P50:                12.34
    P95:                45.67
    P99:                89.12

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
  ✓ PASSED
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

Key Metrics

MetricTargetDescription
Error Rate< 1%Percentage of failed requests
P99 Latency< 500ms99th percentile response time
Requests/sec> 100Throughput capacity

Pass/Fail Criteria

The test automatically passes or fails based on:

  • Error Rate must be below 1%
  • P99 Latency must be below 500ms

Troubleshooting

Connection Refused

The tracker isn't running or port 8080 isn't exposed.

bash
docker logs trackarr-loadtest | grep "listening"

High Error Rate

Check if the database schema is initialized:

bash
docker exec trackarr-loadtest npm run db:push

High Latency

Possible causes:

  • Redis memory pressure
  • PostgreSQL connection pool exhaustion
  • Insufficient container resources

Monitor with:

bash
docker stats

Released under the MIT License.