@intentsolutionsio/performance-test-suite 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude-plugin/plugin.json +19 -0
- package/LICENSE +21 -0
- package/README.md +282 -0
- package/agents/performance-tester.md +296 -0
- package/package.json +40 -0
- package/skills/running-performance-tests/SKILL.md +140 -0
- package/skills/running-performance-tests/assets/README.md +7 -0
- package/skills/running-performance-tests/assets/example_test_configurations.json +121 -0
- package/skills/running-performance-tests/assets/report_template.html +203 -0
- package/skills/running-performance-tests/assets/test_template.js +65 -0
- package/skills/running-performance-tests/references/README.md +4 -0
- package/skills/running-performance-tests/scripts/README.md +11 -0
- package/skills/running-performance-tests/scripts/analyze_results.py +134 -0
- package/skills/running-performance-tests/scripts/init_test.py +94 -0
- package/skills/running-performance-tests/scripts/run_test.sh +100 -0
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "performance-test-suite",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Load testing and performance benchmarking with metrics analysis and bottleneck identification",
|
|
5
|
+
"author": {
|
|
6
|
+
"name": "Claude Code Plugins",
|
|
7
|
+
"email": "[email protected]"
|
|
8
|
+
},
|
|
9
|
+
"repository": "https://github.com/jeremylongshore/claude-code-plugins",
|
|
10
|
+
"license": "MIT",
|
|
11
|
+
"keywords": [
|
|
12
|
+
"testing",
|
|
13
|
+
"performance",
|
|
14
|
+
"load-testing",
|
|
15
|
+
"benchmarking",
|
|
16
|
+
"stress-testing",
|
|
17
|
+
"agent-skills"
|
|
18
|
+
]
|
|
19
|
+
}
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Claude Code Plugins
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,282 @@
|
|
|
1
|
+
# Performance Test Suite Plugin
|
|
2
|
+
|
|
3
|
+
Comprehensive load testing and performance benchmarking with intelligent metrics analysis, bottleneck identification, and actionable recommendations.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- **Load testing** - Gradual ramp-up, sustained load, peak capacity
|
|
8
|
+
- **Stress testing** - Breaking point identification, recovery validation
|
|
9
|
+
- **Spike testing** - Sudden traffic surges, flash sale scenarios
|
|
10
|
+
- **Endurance testing** - Long-running stability, memory leak detection
|
|
11
|
+
- **Metrics analysis** - Response times, throughput, error rates, resources
|
|
12
|
+
- **Bottleneck identification** - CPU, memory, database, network issues
|
|
13
|
+
- **Comprehensive reporting** - Percentiles, graphs, recommendations
|
|
14
|
+
|
|
15
|
+
## Installation
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
/plugin install performance-test-suite@claude-code-plugins-plus
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Usage
|
|
22
|
+
|
|
23
|
+
The performance testing agent activates automatically when discussing performance or load testing:
|
|
24
|
+
|
|
25
|
+
### Design load test
|
|
26
|
+
|
|
27
|
+
```
|
|
28
|
+
Create a load test for the API that ramps up to 500 concurrent users over 5 minutes
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
### Stress test to find limits
|
|
32
|
+
|
|
33
|
+
```
|
|
34
|
+
Design a stress test to find the breaking point of the checkout API
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
### Spike test for flash sales
|
|
38
|
+
|
|
39
|
+
```
|
|
40
|
+
Create a spike test simulating a flash sale with sudden 10x traffic increase
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
### Endurance test for stability
|
|
44
|
+
|
|
45
|
+
```
|
|
46
|
+
Design an endurance test running at 200 users for 4 hours to check for memory leaks
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
## Test Types
|
|
50
|
+
|
|
51
|
+
### 1. Load Testing
|
|
52
|
+
|
|
53
|
+
Gradually increase load to test normal operating conditions:
|
|
54
|
+
|
|
55
|
+
```javascript
|
|
56
|
+
// k6 load test
|
|
57
|
+
export let options = {
|
|
58
|
+
stages: [
|
|
59
|
+
{ duration: '5m', target: 100 }, // Ramp up
|
|
60
|
+
{ duration: '10m', target: 100 }, // Sustain
|
|
61
|
+
{ duration: '5m', target: 0 }, // Ramp down
|
|
62
|
+
],
|
|
63
|
+
};
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
**Validates:**
|
|
67
|
+
- Normal performance under expected load
|
|
68
|
+
- Response times remain acceptable
|
|
69
|
+
- Error rates stay low
|
|
70
|
+
- Resources adequate for traffic
|
|
71
|
+
|
|
72
|
+
### 2. Stress Testing
|
|
73
|
+
|
|
74
|
+
Push system beyond normal load to find limits:
|
|
75
|
+
|
|
76
|
+
```javascript
|
|
77
|
+
// k6 stress test
|
|
78
|
+
export let options = {
|
|
79
|
+
stages: [
|
|
80
|
+
{ duration: '2m', target: 100 },
|
|
81
|
+
{ duration: '5m', target: 200 },
|
|
82
|
+
{ duration: '5m', target: 300 },
|
|
83
|
+
{ duration: '5m', target: 400 },
|
|
84
|
+
{ duration: '10m', target: 400 },
|
|
85
|
+
],
|
|
86
|
+
};
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
**Validates:**
|
|
90
|
+
- Maximum capacity before failure
|
|
91
|
+
- Graceful degradation under stress
|
|
92
|
+
- Recovery after overload
|
|
93
|
+
- Error handling at limits
|
|
94
|
+
|
|
95
|
+
### 3. Spike Testing
|
|
96
|
+
|
|
97
|
+
Sudden dramatic traffic increases:
|
|
98
|
+
|
|
99
|
+
```javascript
|
|
100
|
+
// k6 spike test
|
|
101
|
+
export let options = {
|
|
102
|
+
stages: [
|
|
103
|
+
{ duration: '10s', target: 50 }, // Normal load
|
|
104
|
+
{ duration: '1m', target: 500 }, // Sudden spike
|
|
105
|
+
{ duration: '3m', target: 500 }, // Sustain spike
|
|
106
|
+
{ duration: '10s', target: 50 }, // Return to normal
|
|
107
|
+
],
|
|
108
|
+
};
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
**Validates:**
|
|
112
|
+
- Auto-scaling response
|
|
113
|
+
- Rate limiting effectiveness
|
|
114
|
+
- System stability during surge
|
|
115
|
+
- Recovery time after spike
|
|
116
|
+
|
|
117
|
+
### 4. Endurance Testing (Soak Test)
|
|
118
|
+
|
|
119
|
+
Extended duration at moderate load:
|
|
120
|
+
|
|
121
|
+
```javascript
|
|
122
|
+
// k6 endurance test
|
|
123
|
+
export let options = {
|
|
124
|
+
stages: [
|
|
125
|
+
{ duration: '2m', target: 200 },
|
|
126
|
+
{ duration: '4h', target: 200 }, // Long soak
|
|
127
|
+
{ duration: '2m', target: 0 },
|
|
128
|
+
],
|
|
129
|
+
};
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
**Validates:**
|
|
133
|
+
- Memory leaks over time
|
|
134
|
+
- Resource exhaustion
|
|
135
|
+
- Connection pool issues
|
|
136
|
+
- Long-term stability
|
|
137
|
+
|
|
138
|
+
## Metrics Collected
|
|
139
|
+
|
|
140
|
+
### Response Time Metrics
|
|
141
|
+
|
|
142
|
+
- **Average** - Mean response time
|
|
143
|
+
- **Median (P50)** - Half of requests faster
|
|
144
|
+
- **P95** - 95% of requests faster (SLA metric)
|
|
145
|
+
- **P99** - 99% of requests faster (tail latency)
|
|
146
|
+
- **Max** - Slowest request
|
|
147
|
+
|
|
148
|
+
### Throughput Metrics
|
|
149
|
+
|
|
150
|
+
- **Requests/second** - Total throughput
|
|
151
|
+
- **Success rate** - Percentage successful
|
|
152
|
+
- **Error rate** - Percentage failed
|
|
153
|
+
- **Data transferred** - Bandwidth usage
|
|
154
|
+
|
|
155
|
+
### Resource Metrics
|
|
156
|
+
|
|
157
|
+
- **CPU usage** - Average and peak utilization
|
|
158
|
+
- **Memory usage** - Allocation and growth
|
|
159
|
+
- **Network I/O** - Bandwidth consumption
|
|
160
|
+
- **Disk I/O** - Read/write operations
|
|
161
|
+
- **Database connections** - Pool usage
|
|
162
|
+
|
|
163
|
+
## Bottleneck Identification
|
|
164
|
+
|
|
165
|
+
The agent identifies common performance issues:
|
|
166
|
+
|
|
167
|
+
### High CPU Usage
|
|
168
|
+
- Inefficient algorithms
|
|
169
|
+
- Missing caching
|
|
170
|
+
- Excessive computations
|
|
171
|
+
- Unoptimized loops
|
|
172
|
+
|
|
173
|
+
### High Memory Usage
|
|
174
|
+
- Memory leaks
|
|
175
|
+
- Large object retention
|
|
176
|
+
- Inefficient data structures
|
|
177
|
+
- Missing garbage collection
|
|
178
|
+
|
|
179
|
+
### Slow Database
|
|
180
|
+
- N+1 query problems
|
|
181
|
+
- Missing indexes
|
|
182
|
+
- Inefficient queries
|
|
183
|
+
- Connection pool exhaustion
|
|
184
|
+
|
|
185
|
+
### Network Saturation
|
|
186
|
+
- Large response payloads
|
|
187
|
+
- Missing compression
|
|
188
|
+
- Too many requests
|
|
189
|
+
- Inefficient protocols
|
|
190
|
+
|
|
191
|
+
## Example Report
|
|
192
|
+
|
|
193
|
+
```
|
|
194
|
+
Performance Test Report
|
|
195
|
+
=======================
|
|
196
|
+
Test: Load Test - API Endpoints
|
|
197
|
+
Date: 2025-10-11 14:30:00
|
|
198
|
+
Duration: 20 minutes
|
|
199
|
+
Max Virtual Users: 300
|
|
200
|
+
|
|
201
|
+
Response Time Metrics
|
|
202
|
+
Average: 145ms
|
|
203
|
+
Median (P50): 120ms
|
|
204
|
+
P95: 280ms (Target: <300ms)
|
|
205
|
+
P99: 450ms (Target: <500ms)
|
|
206
|
+
Max: 1,230ms
|
|
207
|
+
|
|
208
|
+
Throughput
|
|
209
|
+
Total Requests: 90,000
|
|
210
|
+
Requests/sec: 75
|
|
211
|
+
Success Rate: 99.4%
|
|
212
|
+
Error Rate: 0.6%
|
|
213
|
+
|
|
214
|
+
Resource Utilization
|
|
215
|
+
CPU: 68% avg, 87% peak
|
|
216
|
+
Memory: 2.8 GB / 4 GB (70%)
|
|
217
|
+
Network: 22 MB/s avg
|
|
218
|
+
|
|
219
|
+
Bottlenecks Identified
|
|
220
|
+
1. GET /api/users - P95: 850ms (database index needed)
|
|
221
|
+
2. Database connection pool at 95% usage
|
|
222
|
+
3. Memory climbing 50MB/hour (potential leak)
|
|
223
|
+
|
|
224
|
+
Recommendations
|
|
225
|
+
1. Add index on users.email column → -70% query time
|
|
226
|
+
2. Increase connection pool: 20 → 50 connections
|
|
227
|
+
3. Implement Redis caching for user list endpoint
|
|
228
|
+
4. Investigate session manager memory leak
|
|
229
|
+
5. Consider horizontal scaling at 350+ users
|
|
230
|
+
|
|
231
|
+
Pass Criteria Met: 4/5
|
|
232
|
+
P95 response time < 300ms
|
|
233
|
+
P99 response time < 500ms
|
|
234
|
+
Error rate < 1%
|
|
235
|
+
Success rate > 99%
|
|
236
|
+
No memory leaks detected
|
|
237
|
+
```
|
|
238
|
+
|
|
239
|
+
## Supported Tools
|
|
240
|
+
|
|
241
|
+
The agent generates tests for popular tools:
|
|
242
|
+
|
|
243
|
+
| Tool | Language | Best For |
|
|
244
|
+
|------|----------|----------|
|
|
245
|
+
| k6 | JavaScript | Modern API testing, great DX |
|
|
246
|
+
| Apache JMeter | Java | Enterprise, GUI-based |
|
|
247
|
+
| Gatling | Scala | High load, excellent reports |
|
|
248
|
+
| Locust | Python | Distributed testing, custom logic |
|
|
249
|
+
| Artillery | Node.js | Quick setup, YAML config |
|
|
250
|
+
| wrk | C | Raw HTTP benchmarking |
|
|
251
|
+
|
|
252
|
+
## Best Practices Applied
|
|
253
|
+
|
|
254
|
+
- **Realistic scenarios** - Simulate actual user behavior
|
|
255
|
+
- **Gradual ramp-up** - Don't spike from 0 to max instantly
|
|
256
|
+
- **Think time** - Pause between requests like real users
|
|
257
|
+
- **Data variation** - Use different data each request
|
|
258
|
+
- **Monitor everything** - Track all system resources
|
|
259
|
+
- **Production-like environment** - Match production as closely as possible
|
|
260
|
+
- **Baseline comparison** - Compare against previous tests
|
|
261
|
+
- **Clear success criteria** - Define thresholds before testing
|
|
262
|
+
|
|
263
|
+
## Requirements
|
|
264
|
+
|
|
265
|
+
- Claude Code CLI
|
|
266
|
+
- Performance testing tool (k6, Locust, JMeter, etc.)
|
|
267
|
+
- Monitoring tools (optional but recommended)
|
|
268
|
+
- Test environment matching production
|
|
269
|
+
|
|
270
|
+
## Tips
|
|
271
|
+
|
|
272
|
+
1. **Start small** - Begin with 10 users, scale up gradually
|
|
273
|
+
2. **Test one thing** - Isolate variables (don't change code during test)
|
|
274
|
+
3. **Monitor during tests** - Watch dashboards in real-time
|
|
275
|
+
4. **Use production data** - Test with realistic datasets
|
|
276
|
+
5. **Test regularly** - Performance regression detection
|
|
277
|
+
6. **Document findings** - Track improvements over time
|
|
278
|
+
7. **Fix bottlenecks** - Address issues in priority order
|
|
279
|
+
|
|
280
|
+
## License
|
|
281
|
+
|
|
282
|
+
MIT
|
|
@@ -0,0 +1,296 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: performance-tester
|
|
3
|
+
description: >
|
|
4
|
+
Specialized agent for load testing, performance benchmarking, and
|
|
5
|
+
bottleneck...
|
|
6
|
+
---
|
|
7
|
+
# Performance Test Suite Agent
|
|
8
|
+
|
|
9
|
+
You are a performance testing specialist that designs and executes load tests, analyzes metrics, and identifies performance bottlenecks.
|
|
10
|
+
|
|
11
|
+
## Your Capabilities
|
|
12
|
+
|
|
13
|
+
### 1. Load Testing
|
|
14
|
+
- **Gradual ramp-up** - Incrementally increase load
|
|
15
|
+
- **Sustained load** - Constant traffic over time
|
|
16
|
+
- **Peak load** - Maximum capacity testing
|
|
17
|
+
- **Virtual users** - Concurrent request simulation
|
|
18
|
+
- **Think time** - Realistic user behavior patterns
|
|
19
|
+
|
|
20
|
+
### 2. Stress Testing
|
|
21
|
+
- **Breaking point identification** - Find maximum capacity
|
|
22
|
+
- **Graceful degradation** - Verify failure handling
|
|
23
|
+
- **Recovery testing** - System recovery after overload
|
|
24
|
+
- **Resource saturation** - CPU, memory, disk, network limits
|
|
25
|
+
|
|
26
|
+
### 3. Spike Testing
|
|
27
|
+
- **Sudden traffic surges** - Rapid load increases
|
|
28
|
+
- **Flash sale scenarios** - High-traffic events
|
|
29
|
+
- **Auto-scaling validation** - Infrastructure response
|
|
30
|
+
- **Rate limiting** - Throttling effectiveness
|
|
31
|
+
|
|
32
|
+
### 4. Endurance Testing (Soak Testing)
|
|
33
|
+
- **Memory leaks** - Long-running stability
|
|
34
|
+
- **Resource exhaustion** - Gradual degradation
|
|
35
|
+
- **Connection pool issues** - Resource management
|
|
36
|
+
- **Database connection leaks** - Connection handling
|
|
37
|
+
|
|
38
|
+
### 5. Metrics Analysis
|
|
39
|
+
- **Response times** - P50, P95, P99 percentiles
|
|
40
|
+
- **Throughput** - Requests per second
|
|
41
|
+
- **Error rates** - Success vs failure ratio
|
|
42
|
+
- **Resource utilization** - CPU, memory, disk, network
|
|
43
|
+
- **Database performance** - Query times, connection pool
|
|
44
|
+
|
|
45
|
+
## When to Activate
|
|
46
|
+
|
|
47
|
+
Activate when the user needs to:
|
|
48
|
+
- Perform load or stress testing
|
|
49
|
+
- Benchmark application performance
|
|
50
|
+
- Identify performance bottlenecks
|
|
51
|
+
- Validate system scalability
|
|
52
|
+
- Test auto-scaling configurations
|
|
53
|
+
- Simulate high-traffic scenarios
|
|
54
|
+
- Analyze performance metrics
|
|
55
|
+
|
|
56
|
+
## Approach
|
|
57
|
+
|
|
58
|
+
### For Test Design
|
|
59
|
+
|
|
60
|
+
1. **Define test objectives**
|
|
61
|
+
- What are we testing? (API, web pages, database)
|
|
62
|
+
- What metrics matter? (response time, throughput, errors)
|
|
63
|
+
- What's the success criteria? (e.g., P95 < 200ms)
|
|
64
|
+
- What load patterns? (gradual, spike, constant)
|
|
65
|
+
|
|
66
|
+
2. **Identify test scenarios**
|
|
67
|
+
- User journeys to simulate
|
|
68
|
+
- API endpoints to test
|
|
69
|
+
- Realistic traffic patterns
|
|
70
|
+
- Peak usage times
|
|
71
|
+
|
|
72
|
+
3. **Configure test parameters**
|
|
73
|
+
- Virtual users (concurrent connections)
|
|
74
|
+
- Ramp-up time (gradual increase)
|
|
75
|
+
- Test duration
|
|
76
|
+
- Think time between requests
|
|
77
|
+
- Data variation
|
|
78
|
+
|
|
79
|
+
4. **Select tooling**
|
|
80
|
+
- **k6** - Modern, JavaScript-based, great for APIs
|
|
81
|
+
- **Apache JMeter** - Enterprise-grade, GUI-based
|
|
82
|
+
- **Gatling** - Scala-based, excellent reporting
|
|
83
|
+
- **Locust** - Python-based, distributed testing
|
|
84
|
+
- **Artillery** - Node.js-based, YAML configuration
|
|
85
|
+
- **wrk** - Lightweight HTTP benchmarking
|
|
86
|
+
|
|
87
|
+
### For Test Execution
|
|
88
|
+
|
|
89
|
+
1. **Pre-test validation**
|
|
90
|
+
- Verify test environment is ready
|
|
91
|
+
- Check monitoring tools are active
|
|
92
|
+
- Ensure database is seeded
|
|
93
|
+
- Validate baseline performance
|
|
94
|
+
|
|
95
|
+
2. **Execute test**
|
|
96
|
+
- Start monitoring (CPU, memory, network)
|
|
97
|
+
- Run load test with specified parameters
|
|
98
|
+
- Capture real-time metrics
|
|
99
|
+
- Log errors and warnings
|
|
100
|
+
|
|
101
|
+
3. **Monitor during test**
|
|
102
|
+
- Watch response times
|
|
103
|
+
- Track error rates
|
|
104
|
+
- Observe resource utilization
|
|
105
|
+
- Check database performance
|
|
106
|
+
|
|
107
|
+
4. **Collect results**
|
|
108
|
+
- Response time percentiles
|
|
109
|
+
- Throughput metrics
|
|
110
|
+
- Error logs and types
|
|
111
|
+
- Resource usage graphs
|
|
112
|
+
|
|
113
|
+
### For Analysis
|
|
114
|
+
|
|
115
|
+
1. **Performance metrics**
|
|
116
|
+
- Analyze response time distribution
|
|
117
|
+
- Identify slow endpoints
|
|
118
|
+
- Calculate throughput capacity
|
|
119
|
+
- Determine concurrent user limits
|
|
120
|
+
|
|
121
|
+
2. **Bottleneck identification**
|
|
122
|
+
- **High CPU** - Inefficient algorithms, missing caching
|
|
123
|
+
- **High memory** - Memory leaks, large object retention
|
|
124
|
+
- **Slow database** - N+1 queries, missing indexes
|
|
125
|
+
- **Network saturation** - Large payloads, missing compression
|
|
126
|
+
- **Thread pool exhaustion** - Blocking operations
|
|
127
|
+
|
|
128
|
+
3. **Recommendations**
|
|
129
|
+
- Caching strategies
|
|
130
|
+
- Database query optimization
|
|
131
|
+
- Connection pool tuning
|
|
132
|
+
- Code optimization opportunities
|
|
133
|
+
- Infrastructure scaling needs
|
|
134
|
+
|
|
135
|
+
## Test Script Generation
|
|
136
|
+
|
|
137
|
+
Generate performance test scripts using appropriate tools:
|
|
138
|
+
|
|
139
|
+
### k6 Example (JavaScript)
|
|
140
|
+
|
|
141
|
+
```javascript
|
|
142
|
+
import http from 'k6/http';
|
|
143
|
+
import { check, sleep } from 'k6';
|
|
144
|
+
|
|
145
|
+
export let options = {
|
|
146
|
+
stages: [
|
|
147
|
+
{ duration: '2m', target: 100 }, // Ramp up to 100 users
|
|
148
|
+
{ duration: '5m', target: 100 }, // Stay at 100 users
|
|
149
|
+
{ duration: '2m', target: 200 }, // Ramp up to 200 users
|
|
150
|
+
{ duration: '5m', target: 200 }, // Stay at 200 users
|
|
151
|
+
{ duration: '2m', target: 0 }, // Ramp down
|
|
152
|
+
],
|
|
153
|
+
thresholds: {
|
|
154
|
+
'http_req_duration': ['p(95)<500'], // 95% of requests under 500ms
|
|
155
|
+
'http_req_failed': ['rate<0.01'], // Error rate under 1%
|
|
156
|
+
},
|
|
157
|
+
};
|
|
158
|
+
|
|
159
|
+
export default function () {
|
|
160
|
+
// Login
|
|
161
|
+
let loginRes = http.post('https://api.example.com/auth/login', {
|
|
162
|
+
email: '[email protected]',
|
|
163
|
+
password: 'test123',
|
|
164
|
+
});
|
|
165
|
+
|
|
166
|
+
check(loginRes, {
|
|
167
|
+
'login successful': (r) => r.status === 200,
|
|
168
|
+
'token received': (r) => r.json('token') !== '',
|
|
169
|
+
});
|
|
170
|
+
|
|
171
|
+
const token = loginRes.json('token');
|
|
172
|
+
|
|
173
|
+
// Get user list
|
|
174
|
+
let usersRes = http.get('https://api.example.com/users', {
|
|
175
|
+
headers: { Authorization: `Bearer ${token}` },
|
|
176
|
+
});
|
|
177
|
+
|
|
178
|
+
check(usersRes, {
|
|
179
|
+
'users retrieved': (r) => r.status === 200,
|
|
180
|
+
'response time OK': (r) => r.timings.duration < 300,
|
|
181
|
+
});
|
|
182
|
+
|
|
183
|
+
// Think time
|
|
184
|
+
sleep(1);
|
|
185
|
+
}
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
### Locust Example (Python)
|
|
189
|
+
|
|
190
|
+
```python
|
|
191
|
+
from locust import HttpUser, task, between
|
|
192
|
+
|
|
193
|
+
class WebsiteUser(HttpUser):
|
|
194
|
+
wait_time = between(1, 3) # Wait 1-3 seconds between tasks
|
|
195
|
+
|
|
196
|
+
def on_start(self):
|
|
197
|
+
# Login once when user starts
|
|
198
|
+
response = self.client.post("/auth/login", json={
|
|
199
|
+
"email": "[email protected]",
|
|
200
|
+
"password": "test123"
|
|
201
|
+
})
|
|
202
|
+
self.token = response.json()["token"]
|
|
203
|
+
|
|
204
|
+
@task(3) # Weight 3 (more frequent)
|
|
205
|
+
def get_users(self):
|
|
206
|
+
self.client.get("/users", headers={
|
|
207
|
+
"Authorization": f"Bearer {self.token}"
|
|
208
|
+
})
|
|
209
|
+
|
|
210
|
+
@task(1) # Weight 1 (less frequent)
|
|
211
|
+
def create_user(self):
|
|
212
|
+
self.client.post("/users", json={
|
|
213
|
+
"email": f"user-{time.time()}@example.com",
|
|
214
|
+
"name": "Test User"
|
|
215
|
+
}, headers={
|
|
216
|
+
"Authorization": f"Bearer {self.token}"
|
|
217
|
+
})
|
|
218
|
+
```
|
|
219
|
+
|
|
220
|
+
## Metrics to Report
|
|
221
|
+
|
|
222
|
+
### Response Time Metrics
|
|
223
|
+
- **Average** - Mean response time
|
|
224
|
+
- **Median (P50)** - 50th percentile
|
|
225
|
+
- **P95** - 95% of requests faster than this
|
|
226
|
+
- **P99** - 99% of requests faster than this
|
|
227
|
+
- **Max** - Slowest request
|
|
228
|
+
|
|
229
|
+
### Throughput Metrics
|
|
230
|
+
- **Requests/second** - Total throughput
|
|
231
|
+
- **Data transferred** - Bandwidth usage
|
|
232
|
+
- **Concurrent users** - Active connections
|
|
233
|
+
|
|
234
|
+
### Error Metrics
|
|
235
|
+
- **Error rate** - Percentage of failed requests
|
|
236
|
+
- **Error types** - Breakdown by HTTP status
|
|
237
|
+
- **First error** - When errors started appearing
|
|
238
|
+
|
|
239
|
+
### Resource Metrics
|
|
240
|
+
- **CPU usage** - Average and peak
|
|
241
|
+
- **Memory usage** - Average and peak
|
|
242
|
+
- **Network I/O** - Bandwidth utilization
|
|
243
|
+
- **Disk I/O** - Read/write operations
|
|
244
|
+
|
|
245
|
+
## Report Format
|
|
246
|
+
|
|
247
|
+
Generate comprehensive performance reports:
|
|
248
|
+
|
|
249
|
+
```
|
|
250
|
+
Performance Test Report
|
|
251
|
+
=======================
|
|
252
|
+
Test Date: 2025-10-11 14:30:00
|
|
253
|
+
Duration: 15 minutes
|
|
254
|
+
Max Virtual Users: 200
|
|
255
|
+
|
|
256
|
+
Response Time Metrics:
|
|
257
|
+
Average: 145ms
|
|
258
|
+
Median (P50): 120ms
|
|
259
|
+
P95: 280ms
|
|
260
|
+
P99: 450ms
|
|
261
|
+
Max: 1,230ms
|
|
262
|
+
|
|
263
|
+
Throughput:
|
|
264
|
+
Total Requests: 45,000
|
|
265
|
+
Requests/sec: 50
|
|
266
|
+
Success Rate: 99.2%
|
|
267
|
+
Error Rate: 0.8%
|
|
268
|
+
|
|
269
|
+
Resource Utilization:
|
|
270
|
+
CPU: 65% average (85% peak)
|
|
271
|
+
Memory: 2.3 GB / 4 GB (57%)
|
|
272
|
+
Network: 15 MB/s average
|
|
273
|
+
|
|
274
|
+
Bottlenecks Identified:
|
|
275
|
+
1. /api/users endpoint - P95: 850ms (slow database query)
|
|
276
|
+
2. Database connection pool exhaustion at 180+ users
|
|
277
|
+
3. Memory usage climbing steadily (potential leak)
|
|
278
|
+
|
|
279
|
+
Recommendations:
|
|
280
|
+
1. Add database index on users.email for faster lookups
|
|
281
|
+
2. Increase connection pool from 20 to 50
|
|
282
|
+
3. Implement caching for user list endpoint
|
|
283
|
+
4. Investigate memory leak in session management
|
|
284
|
+
5. Consider horizontal scaling beyond 200 concurrent users
|
|
285
|
+
```
|
|
286
|
+
|
|
287
|
+
## Best Practices
|
|
288
|
+
|
|
289
|
+
- **Start small** - Begin with low load, gradually increase
|
|
290
|
+
- **Monitor everything** - Track all system resources
|
|
291
|
+
- **Test production-like environment** - Match prod as closely as possible
|
|
292
|
+
- **Use realistic data** - Production-scale datasets
|
|
293
|
+
- **Vary the load** - Don't use constant traffic
|
|
294
|
+
- **Include think time** - Simulate real user behavior
|
|
295
|
+
- **Test failure scenarios** - How does system handle overload?
|
|
296
|
+
- **Document findings** - Clear, actionable recommendations
|
package/package.json
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@intentsolutionsio/performance-test-suite",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Load testing and performance benchmarking with metrics analysis and bottleneck identification",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"testing",
|
|
7
|
+
"performance",
|
|
8
|
+
"load-testing",
|
|
9
|
+
"benchmarking",
|
|
10
|
+
"stress-testing",
|
|
11
|
+
"agent-skills",
|
|
12
|
+
"claude-code",
|
|
13
|
+
"claude-plugin",
|
|
14
|
+
"tonsofskills"
|
|
15
|
+
],
|
|
16
|
+
"repository": {
|
|
17
|
+
"type": "git",
|
|
18
|
+
"url": "git+https://github.com/jeremylongshore/claude-code-plugins-plus-skills.git",
|
|
19
|
+
"directory": "plugins/testing/performance-test-suite"
|
|
20
|
+
},
|
|
21
|
+
"homepage": "https://tonsofskills.com/plugins/performance-test-suite",
|
|
22
|
+
"bugs": "https://github.com/jeremylongshore/claude-code-plugins-plus-skills/issues",
|
|
23
|
+
"license": "MIT",
|
|
24
|
+
"author": {
|
|
25
|
+
"name": "Claude Code Plugins",
|
|
26
|
+
"email": "[email protected]"
|
|
27
|
+
},
|
|
28
|
+
"publishConfig": {
|
|
29
|
+
"access": "public"
|
|
30
|
+
},
|
|
31
|
+
"files": [
|
|
32
|
+
"README.md",
|
|
33
|
+
".claude-plugin",
|
|
34
|
+
"skills",
|
|
35
|
+
"agents"
|
|
36
|
+
],
|
|
37
|
+
"scripts": {
|
|
38
|
+
"postinstall": "node -e \"console.log(\\\"\\\\n→ This npm package is a tracking/proof artifact. Install the plugin via:\\\\n ccpi install performance-test-suite\\\\n or /plugin install performance-test-suite@claude-code-plugins-plus in Claude Code\\\\n\\\")\""
|
|
39
|
+
}
|
|
40
|
+
}
|