Skip to content

Commit a69fde9

Browse files
committed
Add load test for simultaneous call capacity testing
- Add tests/perf/load_test.py with full load testing framework - Read SIP credentials from CSV file for flexibility - Callers play TTS audio, receivers record and respond - Measure: call success rate, setup latency, packet loss, jitter, CPU/memory - Save results to timestamped directories with report.txt and metrics.json - Save call recordings for audio quality verification - Add README with usage instructions - Gitignore results and credentials (extensions.csv)
1 parent 77ae0f7 commit a69fde9

5 files changed

Lines changed: 858 additions & 0 deletions

File tree

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@ secrets.ini
99
*.log
1010
*.log.*
1111

12+
# Load test results and credentials
13+
tests/perf/results/
14+
tests/perf/extensions.csv
15+
1216
# Byte-compiled / optimized / DLL files
1317
__pycache__/
1418
*.py[cod]

tests/perf/README.md

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
# PySIP Load Test
2+
3+
Tests how many simultaneous calls PySIP can handle with metrics on:
4+
- Maximum concurrent calls
5+
- Call success/failure rate
6+
- Call setup latency
7+
- Audio quality (packet loss, jitter)
8+
- Resource usage (CPU, memory)
9+
10+
## Setup
11+
12+
1. Create `extensions.csv` with your SIP credentials:
13+
14+
```csv
15+
username,password,server,port
16+
1,password001,77.37.67.125,5060
17+
2,password002,77.37.67.125,5060
18+
3,password003,77.37.67.125,5060
19+
4,password004,77.37.67.125,5060
20+
```
21+
22+
**Note:** First half of credentials are used as receivers, second half as callers.
23+
For N call pairs, you need 2N credentials.
24+
25+
2. Install optional dependency for resource monitoring:
26+
```bash
27+
pip install psutil
28+
```
29+
30+
## Usage
31+
32+
```bash
33+
# Basic test (1 call pair with 2 credentials)
34+
python -m tests.perf.load_test --credentials tests/perf/extensions.csv --duration 30
35+
36+
# Longer test with more calls
37+
python -m tests.perf.load_test --credentials tests/perf/extensions.csv --duration 60 --ramp-rate 5
38+
```
39+
40+
## Options
41+
42+
| Option | Default | Description |
43+
|--------|---------|-------------|
44+
| `--credentials`, `-c` | required | Path to CSV file with SIP credentials |
45+
| `--duration`, `-d` | 30 | How long to maintain calls (seconds) |
46+
| `--ramp-rate`, `-r` | 5 | Calls to start per second |
47+
| `--output`, `-o` | tests/perf/results | Output directory for results |
48+
49+
## Output
50+
51+
Results are saved to `tests/perf/results/<timestamp>/`:
52+
- `report.txt` - Human-readable summary
53+
- `metrics.json` - Detailed metrics for analysis
54+
- `recordings/` - Audio recordings from receivers
55+
56+
## Example Output
57+
58+
```
59+
PySIP Load Test Results
60+
==================================================
61+
Test Time: 2026-01-03T16:00:00
62+
Test Duration: 35.2s
63+
Target Calls: 10
64+
65+
Call Results:
66+
Peak Concurrent Calls: 10
67+
Successful Calls: 10/10 (100.0%)
68+
Failed Calls: 0
69+
70+
Call Setup Latency:
71+
Min: 45ms
72+
Avg: 123ms
73+
Max: 892ms
74+
P95: 450ms
75+
76+
Audio Quality:
77+
Avg Packet Loss: 0.2%
78+
Avg Jitter: 12.3ms
79+
Avg RTT: 45.2ms
80+
81+
Resource Usage:
82+
Peak CPU: 34.2%
83+
Peak Memory: 156MB
84+
```

tests/perf/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# Performance tests package

tests/perf/extensions.csv.example

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
username,password,server,port
2+
1,password001,sip.example.com,5060
3+
2,password002,sip.example.com,5060
4+
3,password003,sip.example.com,5060
5+
4,password004,sip.example.com,5060
6+

0 commit comments

Comments
 (0)