proagents 1.6.17 → 1.6.18
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/settings.local.json +169 -0
- package/COMMANDS.md +595 -0
- package/README.md +13 -23
- package/package.json +2 -7
- package/.proagents/ai-models/README.md +0 -141
- package/.proagents/ai-models/cost-management.md +0 -362
- package/.proagents/ai-models/fallbacks.md +0 -342
- package/.proagents/ai-models/model-config.md +0 -318
- package/.proagents/ai-models/task-routing.md +0 -503
- package/.proagents/ai-training/README.md +0 -155
- package/.proagents/ai-training/continuous-learning.md +0 -413
- package/.proagents/ai-training/domain-knowledge.md +0 -378
- package/.proagents/ai-training/pattern-learning.md +0 -455
- package/.proagents/ai-training/training-data.md +0 -337
- package/.proagents/ai-training/user-preferences.md +0 -346
- package/.proagents/approval-workflows/README.md +0 -146
- package/.proagents/approval-workflows/approval-config.md +0 -332
- package/.proagents/approval-workflows/approval-stages.md +0 -503
- package/.proagents/approval-workflows/emergency-bypass.md +0 -351
- package/.proagents/approval-workflows/examples.md +0 -859
- package/.proagents/approval-workflows/notifications.md +0 -320
- package/.proagents/compliance/README.md +0 -206
- package/.proagents/compliance/access-control.md +0 -310
- package/.proagents/compliance/audit-logging.md +0 -444
- package/.proagents/compliance/compliance-frameworks.md +0 -429
- package/.proagents/compliance/reports.md +0 -491
- package/.proagents/compliance/retention-policies.md +0 -454
- package/.proagents/config-versioning/README.md +0 -120
- package/.proagents/config-versioning/changelog.md +0 -300
- package/.proagents/config-versioning/rollback.md +0 -283
- package/.proagents/config-versioning/versioning.md +0 -330
- package/.proagents/contract-testing/README.md +0 -223
- package/.proagents/contract-testing/contract-testing.md +0 -614
- package/.proagents/contract-testing/pact-integration.md +0 -507
- package/.proagents/contract-testing/schema-validation.md +0 -565
- package/.proagents/dependency-management/README.md +0 -140
- package/.proagents/dependency-management/automation.md +0 -363
- package/.proagents/dependency-management/compatibility.md +0 -319
- package/.proagents/dependency-management/security-scanning.md +0 -413
- package/.proagents/dependency-management/update-policies.md +0 -374
- package/.proagents/disaster-recovery/README.md +0 -247
- package/.proagents/disaster-recovery/automation.md +0 -366
- package/.proagents/disaster-recovery/backup-recovery.md +0 -571
- package/.proagents/disaster-recovery/incident-response.md +0 -565
- package/.proagents/disaster-recovery/rollback-procedures.md +0 -499
- package/.proagents/disaster-recovery/runbooks.md +0 -603
- package/.proagents/disaster-recovery/scenarios.md +0 -892
- package/.proagents/disaster-recovery/testing.md +0 -438
- package/.proagents/environments/README.md +0 -244
- package/.proagents/environments/configuration.md +0 -437
- package/.proagents/environments/promotion.md +0 -434
- package/.proagents/environments/setup.md +0 -420
- package/.proagents/examples/README.md +0 -55
- package/.proagents/examples/backend-nodejs/README.md +0 -188
- package/.proagents/examples/backend-nodejs/complete-conversation.md +0 -601
- package/.proagents/examples/backend-nodejs/proagents.config.yaml +0 -415
- package/.proagents/examples/backend-nodejs/workflow-example.md +0 -909
- package/.proagents/examples/fullstack-nextjs/README.md +0 -155
- package/.proagents/examples/fullstack-nextjs/complete-conversation.md +0 -604
- package/.proagents/examples/fullstack-nextjs/proagents.config.yaml +0 -287
- package/.proagents/examples/fullstack-nextjs/workflow-example.md +0 -553
- package/.proagents/examples/mobile-react-native/README.md +0 -171
- package/.proagents/examples/mobile-react-native/complete-conversation.md +0 -825
- package/.proagents/examples/mobile-react-native/proagents.config.yaml +0 -330
- package/.proagents/examples/mobile-react-native/workflow-example.md +0 -723
- package/.proagents/examples/web-frontend-react/README.md +0 -125
- package/.proagents/examples/web-frontend-react/complete-conversation.md +0 -556
- package/.proagents/examples/web-frontend-react/proagents.config.yaml +0 -183
- package/.proagents/examples/web-frontend-react/workflow-example.md +0 -603
- package/.proagents/existing-projects/README.md +0 -65
- package/.proagents/existing-projects/challenges.md +0 -861
- package/.proagents/existing-projects/coexistence-mode.md +0 -483
- package/.proagents/existing-projects/compatibility-assessment.md +0 -541
- package/.proagents/existing-projects/gradual-adoption.md +0 -515
- package/.proagents/existing-projects/migration-strategies.md +0 -788
- package/.proagents/existing-projects/pattern-reconciliation.md +0 -489
- package/.proagents/existing-projects/team-onboarding.md +0 -617
- package/.proagents/existing-projects/technical-debt-handling.md +0 -644
- package/.proagents/feature-flags/README.md +0 -263
- package/.proagents/feature-flags/ab-testing.md +0 -413
- package/.proagents/feature-flags/configuration.md +0 -420
- package/.proagents/feature-flags/kill-switches.md +0 -444
- package/.proagents/feature-flags/rollout-strategies.md +0 -392
- package/.proagents/history.log +0 -12
- package/.proagents/i18n/README.md +0 -133
- package/.proagents/i18n/extraction.md +0 -433
- package/.proagents/i18n/tms-integration.md +0 -332
- package/.proagents/i18n/translation-workflow.md +0 -413
- package/.proagents/i18n/validation.md +0 -355
- package/.proagents/logging/README.md +0 -276
- package/.proagents/logging/aggregation.md +0 -475
- package/.proagents/logging/log-levels.md +0 -376
- package/.proagents/logging/sensitive-data.md +0 -423
- package/.proagents/logging/structured-logging.md +0 -406
- package/.proagents/metrics/README.md +0 -69
- package/.proagents/metrics/code-quality-kpis.md +0 -461
- package/.proagents/metrics/deployment-metrics.md +0 -517
- package/.proagents/metrics/developer-productivity.md +0 -368
- package/.proagents/metrics/learning-effectiveness.md +0 -478
- package/.proagents/migrations/README.md +0 -77
- package/.proagents/migrations/from-claude-projects.md +0 -313
- package/.proagents/migrations/from-cursor-rules.md +0 -345
- package/.proagents/migrations/from-custom-workflows.md +0 -410
- package/.proagents/monitoring/README.md +0 -308
- package/.proagents/monitoring/alerting.md +0 -449
- package/.proagents/monitoring/dashboards.md +0 -454
- package/.proagents/monitoring/health-checks.md +0 -436
- package/.proagents/monitoring/metrics.md +0 -434
- package/.proagents/multi-project/README.md +0 -170
- package/.proagents/multi-project/coordinated-deploy.md +0 -510
- package/.proagents/multi-project/cross-project-deps.md +0 -395
- package/.proagents/multi-project/unified-changelog.md +0 -477
- package/.proagents/multi-project/walkthroughs/monorepo-setup.md +0 -787
- package/.proagents/multi-project/workspace-config.md +0 -408
- package/.proagents/notifications/README.md +0 -151
- package/.proagents/notifications/channels.md +0 -457
- package/.proagents/notifications/preferences.md +0 -415
- package/.proagents/notifications/routing.md +0 -449
- package/.proagents/notifications/scheduling.md +0 -425
- package/.proagents/notifications/templates.md +0 -446
- package/.proagents/offline-mode/README.md +0 -145
- package/.proagents/offline-mode/caching.md +0 -344
- package/.proagents/offline-mode/offline-operations.md +0 -312
- package/.proagents/offline-mode/queue-specifications.md +0 -679
- package/.proagents/offline-mode/sync.md +0 -475
- package/.proagents/parallel-features/README.md +0 -85
- package/.proagents/parallel-features/conflict-detection.md +0 -226
- package/.proagents/parallel-features/dependency-management.md +0 -392
- package/.proagents/parallel-features/merge-coordination.md +0 -506
- package/.proagents/parallel-features/tracking-system.md +0 -416
- package/.proagents/performance/README.md +0 -59
- package/.proagents/performance/bundle-analysis.md +0 -375
- package/.proagents/performance/load-testing.md +0 -563
- package/.proagents/performance/runtime-metrics.md +0 -489
- package/.proagents/performance/web-vitals.md +0 -425
- package/.proagents/plugins/README.md +0 -139
- package/.proagents/plugins/creating-plugins.md +0 -504
- package/.proagents/plugins/plugin-api.md +0 -467
- package/.proagents/plugins/plugin-registry.md +0 -276
- package/.proagents/reporting/README.md +0 -158
- package/.proagents/reporting/dashboards.md +0 -366
- package/.proagents/reporting/exports.md +0 -524
- package/.proagents/reporting/quality-metrics.md +0 -385
- package/.proagents/reporting/templates/README.md +0 -56
- package/.proagents/reporting/templates/dashboard-config.json +0 -187
- package/.proagents/reporting/templates/metrics-queries.md +0 -427
- package/.proagents/reporting/templates/react-dashboard.tsx +0 -544
- package/.proagents/reporting/templates/widgets.md +0 -451
- package/.proagents/reporting/velocity-metrics.md +0 -340
- package/.proagents/reverse-engineering/README.md +0 -151
- package/.proagents/reverse-engineering/architecture-extraction.md +0 -325
- package/.proagents/reverse-engineering/code-analysis.md +0 -377
- package/.proagents/reverse-engineering/dependency-mapping.md +0 -567
- package/.proagents/reverse-engineering/diagram-generation.md +0 -586
- package/.proagents/reverse-engineering/documentation-generation.md +0 -468
- package/.proagents/reverse-engineering/pattern-detection.md +0 -569
- package/.proagents/reverse-engineering/quality-assessment.md +0 -733
- package/.proagents/secrets/README.md +0 -278
- package/.proagents/secrets/access-control.md +0 -443
- package/.proagents/secrets/rotation.md +0 -403
- package/.proagents/secrets/scanning.md +0 -487
- package/.proagents/secrets/storage.md +0 -394
- package/.proagents/webhooks/README.md +0 -126
- package/.proagents/webhooks/endpoints.md +0 -298
- package/.proagents/webhooks/events.md +0 -316
- package/.proagents/webhooks/payloads.md +0 -325
- package/.proagents/webhooks/reliability.md +0 -363
- package/.proagents/webhooks/security.md +0 -380
|
@@ -1,563 +0,0 @@
|
|
|
1
|
-
# Load Testing Guide
|
|
2
|
-
|
|
3
|
-
Comprehensive load testing strategies and implementation.
|
|
4
|
-
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
## Overview
|
|
8
|
-
|
|
9
|
-
Load testing ensures your application can handle expected (and unexpected) traffic. This guide covers:
|
|
10
|
-
- Load testing types
|
|
11
|
-
- Tool selection and setup
|
|
12
|
-
- Test scenario design
|
|
13
|
-
- Result analysis
|
|
14
|
-
|
|
15
|
-
---
|
|
16
|
-
|
|
17
|
-
## Load Testing Types
|
|
18
|
-
|
|
19
|
-
### 1. Smoke Test
|
|
20
|
-
Quick validation that system works under minimal load.
|
|
21
|
-
|
|
22
|
-
```yaml
|
|
23
|
-
smoke_test:
|
|
24
|
-
duration: "1m"
|
|
25
|
-
users: 1-5
|
|
26
|
-
purpose: "Verify system is functional"
|
|
27
|
-
when: "Before every deployment"
|
|
28
|
-
```
|
|
29
|
-
|
|
30
|
-
### 2. Load Test
|
|
31
|
-
Assess performance under expected normal conditions.
|
|
32
|
-
|
|
33
|
-
```yaml
|
|
34
|
-
load_test:
|
|
35
|
-
duration: "10-30m"
|
|
36
|
-
users: "Expected average"
|
|
37
|
-
purpose: "Verify performance targets met"
|
|
38
|
-
when: "Before releases"
|
|
39
|
-
```
|
|
40
|
-
|
|
41
|
-
### 3. Stress Test
|
|
42
|
-
Find the breaking point of the system.
|
|
43
|
-
|
|
44
|
-
```yaml
|
|
45
|
-
stress_test:
|
|
46
|
-
duration: "Until failure"
|
|
47
|
-
users: "Gradually increase"
|
|
48
|
-
purpose: "Find system limits"
|
|
49
|
-
when: "Quarterly or major changes"
|
|
50
|
-
```
|
|
51
|
-
|
|
52
|
-
### 4. Spike Test
|
|
53
|
-
Handle sudden traffic spikes.
|
|
54
|
-
|
|
55
|
-
```yaml
|
|
56
|
-
spike_test:
|
|
57
|
-
duration: "5-10m"
|
|
58
|
-
users: "10x normal suddenly"
|
|
59
|
-
purpose: "Test auto-scaling and recovery"
|
|
60
|
-
when: "Before marketing campaigns"
|
|
61
|
-
```
|
|
62
|
-
|
|
63
|
-
### 5. Soak Test
|
|
64
|
-
Extended duration testing for memory leaks.
|
|
65
|
-
|
|
66
|
-
```yaml
|
|
67
|
-
soak_test:
|
|
68
|
-
duration: "4-24 hours"
|
|
69
|
-
users: "Normal load"
|
|
70
|
-
purpose: "Find memory leaks, connection issues"
|
|
71
|
-
when: "Monthly"
|
|
72
|
-
```
|
|
73
|
-
|
|
74
|
-
---
|
|
75
|
-
|
|
76
|
-
## K6 Load Testing
|
|
77
|
-
|
|
78
|
-
### Installation
|
|
79
|
-
|
|
80
|
-
```bash
|
|
81
|
-
# macOS
|
|
82
|
-
brew install k6
|
|
83
|
-
|
|
84
|
-
# Linux
|
|
85
|
-
sudo gpg -k
|
|
86
|
-
sudo gpg --no-default-keyring --keyring /usr/share/keyrings/k6-archive-keyring.gpg --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys C5AD17C747E3415A3642D57D77C6C491D6AC1D69
|
|
87
|
-
echo "deb [signed-by=/usr/share/keyrings/k6-archive-keyring.gpg] https://dl.k6.io/deb stable main" | sudo tee /etc/apt/sources.list.d/k6.list
|
|
88
|
-
sudo apt-get update
|
|
89
|
-
sudo apt-get install k6
|
|
90
|
-
```
|
|
91
|
-
|
|
92
|
-
### Basic Load Test
|
|
93
|
-
|
|
94
|
-
```javascript
|
|
95
|
-
// tests/load/basic.js
|
|
96
|
-
import http from 'k6/http';
|
|
97
|
-
import { check, sleep } from 'k6';
|
|
98
|
-
|
|
99
|
-
export const options = {
|
|
100
|
-
stages: [
|
|
101
|
-
{ duration: '2m', target: 100 }, // Ramp up to 100 users
|
|
102
|
-
{ duration: '5m', target: 100 }, // Stay at 100 users
|
|
103
|
-
{ duration: '2m', target: 0 }, // Ramp down
|
|
104
|
-
],
|
|
105
|
-
thresholds: {
|
|
106
|
-
http_req_duration: ['p(95)<500'], // 95% under 500ms
|
|
107
|
-
http_req_failed: ['rate<0.01'], // Less than 1% failures
|
|
108
|
-
},
|
|
109
|
-
};
|
|
110
|
-
|
|
111
|
-
export default function () {
|
|
112
|
-
const res = http.get('https://api.example.com/users');
|
|
113
|
-
|
|
114
|
-
check(res, {
|
|
115
|
-
'status is 200': (r) => r.status === 200,
|
|
116
|
-
'response time < 500ms': (r) => r.timings.duration < 500,
|
|
117
|
-
});
|
|
118
|
-
|
|
119
|
-
sleep(1);
|
|
120
|
-
}
|
|
121
|
-
```
|
|
122
|
-
|
|
123
|
-
### API Flow Test
|
|
124
|
-
|
|
125
|
-
```javascript
|
|
126
|
-
// tests/load/user-flow.js
|
|
127
|
-
import http from 'k6/http';
|
|
128
|
-
import { check, group, sleep } from 'k6';
|
|
129
|
-
import { SharedArray } from 'k6/data';
|
|
130
|
-
|
|
131
|
-
// Load test data
|
|
132
|
-
const users = new SharedArray('users', function () {
|
|
133
|
-
return JSON.parse(open('./test-users.json'));
|
|
134
|
-
});
|
|
135
|
-
|
|
136
|
-
export const options = {
|
|
137
|
-
scenarios: {
|
|
138
|
-
user_flow: {
|
|
139
|
-
executor: 'ramping-vus',
|
|
140
|
-
startVUs: 0,
|
|
141
|
-
stages: [
|
|
142
|
-
{ duration: '2m', target: 50 },
|
|
143
|
-
{ duration: '5m', target: 50 },
|
|
144
|
-
{ duration: '2m', target: 100 },
|
|
145
|
-
{ duration: '5m', target: 100 },
|
|
146
|
-
{ duration: '2m', target: 0 },
|
|
147
|
-
],
|
|
148
|
-
},
|
|
149
|
-
},
|
|
150
|
-
thresholds: {
|
|
151
|
-
'http_req_duration{name:login}': ['p(95)<1000'],
|
|
152
|
-
'http_req_duration{name:get_profile}': ['p(95)<500'],
|
|
153
|
-
'http_req_duration{name:list_posts}': ['p(95)<800'],
|
|
154
|
-
http_req_failed: ['rate<0.02'],
|
|
155
|
-
},
|
|
156
|
-
};
|
|
157
|
-
|
|
158
|
-
const BASE_URL = 'https://api.example.com';
|
|
159
|
-
|
|
160
|
-
export default function () {
|
|
161
|
-
const user = users[Math.floor(Math.random() * users.length)];
|
|
162
|
-
|
|
163
|
-
group('User Authentication Flow', function () {
|
|
164
|
-
// Login
|
|
165
|
-
const loginRes = http.post(
|
|
166
|
-
`${BASE_URL}/auth/login`,
|
|
167
|
-
JSON.stringify({
|
|
168
|
-
email: user.email,
|
|
169
|
-
password: user.password,
|
|
170
|
-
}),
|
|
171
|
-
{
|
|
172
|
-
headers: { 'Content-Type': 'application/json' },
|
|
173
|
-
tags: { name: 'login' },
|
|
174
|
-
}
|
|
175
|
-
);
|
|
176
|
-
|
|
177
|
-
check(loginRes, {
|
|
178
|
-
'login successful': (r) => r.status === 200,
|
|
179
|
-
'has token': (r) => r.json('token') !== undefined,
|
|
180
|
-
});
|
|
181
|
-
|
|
182
|
-
const token = loginRes.json('token');
|
|
183
|
-
const authHeaders = {
|
|
184
|
-
'Content-Type': 'application/json',
|
|
185
|
-
Authorization: `Bearer ${token}`,
|
|
186
|
-
};
|
|
187
|
-
|
|
188
|
-
sleep(1);
|
|
189
|
-
|
|
190
|
-
// Get Profile
|
|
191
|
-
const profileRes = http.get(`${BASE_URL}/users/me`, {
|
|
192
|
-
headers: authHeaders,
|
|
193
|
-
tags: { name: 'get_profile' },
|
|
194
|
-
});
|
|
195
|
-
|
|
196
|
-
check(profileRes, {
|
|
197
|
-
'profile loaded': (r) => r.status === 200,
|
|
198
|
-
});
|
|
199
|
-
|
|
200
|
-
sleep(0.5);
|
|
201
|
-
|
|
202
|
-
// List Posts
|
|
203
|
-
const postsRes = http.get(`${BASE_URL}/posts?limit=10`, {
|
|
204
|
-
headers: authHeaders,
|
|
205
|
-
tags: { name: 'list_posts' },
|
|
206
|
-
});
|
|
207
|
-
|
|
208
|
-
check(postsRes, {
|
|
209
|
-
'posts loaded': (r) => r.status === 200,
|
|
210
|
-
'has posts': (r) => r.json('data').length > 0,
|
|
211
|
-
});
|
|
212
|
-
|
|
213
|
-
sleep(2);
|
|
214
|
-
});
|
|
215
|
-
}
|
|
216
|
-
```
|
|
217
|
-
|
|
218
|
-
### Spike Test
|
|
219
|
-
|
|
220
|
-
```javascript
|
|
221
|
-
// tests/load/spike.js
|
|
222
|
-
import http from 'k6/http';
|
|
223
|
-
import { check, sleep } from 'k6';
|
|
224
|
-
|
|
225
|
-
export const options = {
|
|
226
|
-
stages: [
|
|
227
|
-
{ duration: '1m', target: 50 }, // Normal load
|
|
228
|
-
{ duration: '10s', target: 500 }, // Spike!
|
|
229
|
-
{ duration: '3m', target: 500 }, // Stay at spike
|
|
230
|
-
{ duration: '10s', target: 50 }, // Scale down
|
|
231
|
-
{ duration: '2m', target: 50 }, // Recovery
|
|
232
|
-
{ duration: '1m', target: 0 }, // Ramp down
|
|
233
|
-
],
|
|
234
|
-
thresholds: {
|
|
235
|
-
http_req_duration: ['p(99)<3000'], // Even during spike
|
|
236
|
-
http_req_failed: ['rate<0.1'], // Allow some failures during spike
|
|
237
|
-
},
|
|
238
|
-
};
|
|
239
|
-
|
|
240
|
-
export default function () {
|
|
241
|
-
const res = http.get('https://api.example.com/health');
|
|
242
|
-
check(res, { 'status is 200': (r) => r.status === 200 });
|
|
243
|
-
sleep(0.5);
|
|
244
|
-
}
|
|
245
|
-
```
|
|
246
|
-
|
|
247
|
-
### Soak Test
|
|
248
|
-
|
|
249
|
-
```javascript
|
|
250
|
-
// tests/load/soak.js
|
|
251
|
-
import http from 'k6/http';
|
|
252
|
-
import { check, sleep } from 'k6';
|
|
253
|
-
|
|
254
|
-
export const options = {
|
|
255
|
-
stages: [
|
|
256
|
-
{ duration: '5m', target: 100 }, // Ramp up
|
|
257
|
-
{ duration: '4h', target: 100 }, // Sustained load for 4 hours
|
|
258
|
-
{ duration: '5m', target: 0 }, // Ramp down
|
|
259
|
-
],
|
|
260
|
-
thresholds: {
|
|
261
|
-
http_req_duration: ['p(95)<500'],
|
|
262
|
-
http_req_failed: ['rate<0.01'],
|
|
263
|
-
},
|
|
264
|
-
};
|
|
265
|
-
|
|
266
|
-
export default function () {
|
|
267
|
-
const res = http.get('https://api.example.com/users');
|
|
268
|
-
check(res, { 'status is 200': (r) => r.status === 200 });
|
|
269
|
-
sleep(1);
|
|
270
|
-
}
|
|
271
|
-
```
|
|
272
|
-
|
|
273
|
-
---
|
|
274
|
-
|
|
275
|
-
## Artillery Load Testing
|
|
276
|
-
|
|
277
|
-
### Installation
|
|
278
|
-
|
|
279
|
-
```bash
|
|
280
|
-
npm install -g artillery
|
|
281
|
-
```
|
|
282
|
-
|
|
283
|
-
### Basic Test Config
|
|
284
|
-
|
|
285
|
-
```yaml
|
|
286
|
-
# tests/load/artillery.yml
|
|
287
|
-
config:
|
|
288
|
-
target: "https://api.example.com"
|
|
289
|
-
phases:
|
|
290
|
-
- duration: 120
|
|
291
|
-
arrivalRate: 10
|
|
292
|
-
rampTo: 50
|
|
293
|
-
name: "Ramp up"
|
|
294
|
-
- duration: 300
|
|
295
|
-
arrivalRate: 50
|
|
296
|
-
name: "Sustained load"
|
|
297
|
-
- duration: 60
|
|
298
|
-
arrivalRate: 50
|
|
299
|
-
rampTo: 0
|
|
300
|
-
name: "Ramp down"
|
|
301
|
-
|
|
302
|
-
defaults:
|
|
303
|
-
headers:
|
|
304
|
-
Content-Type: "application/json"
|
|
305
|
-
|
|
306
|
-
scenarios:
|
|
307
|
-
- name: "User Flow"
|
|
308
|
-
flow:
|
|
309
|
-
- post:
|
|
310
|
-
url: "/auth/login"
|
|
311
|
-
json:
|
|
312
|
-
email: "{{ $randomString(8) }}@test.com"
|
|
313
|
-
password: "testpassword"
|
|
314
|
-
capture:
|
|
315
|
-
- json: "$.token"
|
|
316
|
-
as: "token"
|
|
317
|
-
|
|
318
|
-
- get:
|
|
319
|
-
url: "/users/me"
|
|
320
|
-
headers:
|
|
321
|
-
Authorization: "Bearer {{ token }}"
|
|
322
|
-
expect:
|
|
323
|
-
- statusCode: 200
|
|
324
|
-
|
|
325
|
-
- get:
|
|
326
|
-
url: "/posts"
|
|
327
|
-
headers:
|
|
328
|
-
Authorization: "Bearer {{ token }}"
|
|
329
|
-
expect:
|
|
330
|
-
- statusCode: 200
|
|
331
|
-
```
|
|
332
|
-
|
|
333
|
-
### Run Artillery
|
|
334
|
-
|
|
335
|
-
```bash
|
|
336
|
-
# Run test
|
|
337
|
-
artillery run tests/load/artillery.yml
|
|
338
|
-
|
|
339
|
-
# Run with report
|
|
340
|
-
artillery run tests/load/artillery.yml --output report.json
|
|
341
|
-
|
|
342
|
-
# Generate HTML report
|
|
343
|
-
artillery report report.json --output report.html
|
|
344
|
-
```
|
|
345
|
-
|
|
346
|
-
---
|
|
347
|
-
|
|
348
|
-
## Test Scenarios
|
|
349
|
-
|
|
350
|
-
### Scenario 1: E-commerce Checkout Flow
|
|
351
|
-
|
|
352
|
-
```javascript
|
|
353
|
-
// tests/load/checkout.js
|
|
354
|
-
export default function () {
|
|
355
|
-
group('E-commerce Checkout', function () {
|
|
356
|
-
// Browse products
|
|
357
|
-
http.get(`${BASE_URL}/products`);
|
|
358
|
-
sleep(2);
|
|
359
|
-
|
|
360
|
-
// View product
|
|
361
|
-
http.get(`${BASE_URL}/products/123`);
|
|
362
|
-
sleep(1);
|
|
363
|
-
|
|
364
|
-
// Add to cart
|
|
365
|
-
http.post(`${BASE_URL}/cart/items`, JSON.stringify({
|
|
366
|
-
productId: '123',
|
|
367
|
-
quantity: 1,
|
|
368
|
-
}), { headers: authHeaders });
|
|
369
|
-
sleep(0.5);
|
|
370
|
-
|
|
371
|
-
// Checkout
|
|
372
|
-
http.post(`${BASE_URL}/checkout`, JSON.stringify({
|
|
373
|
-
cartId: 'cart-123',
|
|
374
|
-
paymentMethod: 'card',
|
|
375
|
-
}), { headers: authHeaders });
|
|
376
|
-
sleep(1);
|
|
377
|
-
});
|
|
378
|
-
}
|
|
379
|
-
```
|
|
380
|
-
|
|
381
|
-
### Scenario 2: Real-time API
|
|
382
|
-
|
|
383
|
-
```javascript
|
|
384
|
-
// tests/load/websocket.js
|
|
385
|
-
import ws from 'k6/ws';
|
|
386
|
-
import { check } from 'k6';
|
|
387
|
-
|
|
388
|
-
export default function () {
|
|
389
|
-
const url = 'wss://api.example.com/realtime';
|
|
390
|
-
|
|
391
|
-
const res = ws.connect(url, {}, function (socket) {
|
|
392
|
-
socket.on('open', () => {
|
|
393
|
-
socket.send(JSON.stringify({ type: 'subscribe', channel: 'updates' }));
|
|
394
|
-
});
|
|
395
|
-
|
|
396
|
-
socket.on('message', (data) => {
|
|
397
|
-
const msg = JSON.parse(data);
|
|
398
|
-
check(msg, {
|
|
399
|
-
'message received': (m) => m.type !== undefined,
|
|
400
|
-
});
|
|
401
|
-
});
|
|
402
|
-
|
|
403
|
-
socket.setTimeout(function () {
|
|
404
|
-
socket.close();
|
|
405
|
-
}, 30000);
|
|
406
|
-
});
|
|
407
|
-
|
|
408
|
-
check(res, { 'connected': (r) => r && r.status === 101 });
|
|
409
|
-
}
|
|
410
|
-
```
|
|
411
|
-
|
|
412
|
-
---
|
|
413
|
-
|
|
414
|
-
## Results Analysis
|
|
415
|
-
|
|
416
|
-
### Understanding K6 Output
|
|
417
|
-
|
|
418
|
-
```
|
|
419
|
-
/\ |‾‾| /‾‾/ /‾‾/
|
|
420
|
-
/\ / \ | |/ / / /
|
|
421
|
-
/ \/ \ | ( / ‾‾\
|
|
422
|
-
/ \ | |\ \ | (‾) |
|
|
423
|
-
/ __________ \ |__| \__\ \_____/ .io
|
|
424
|
-
|
|
425
|
-
execution: local
|
|
426
|
-
script: basic.js
|
|
427
|
-
output: -
|
|
428
|
-
|
|
429
|
-
scenarios: (100.00%) 1 scenario, 100 max VUs, 9m30s max duration
|
|
430
|
-
✓ default: Up to 100 looping VUs for 9m0s
|
|
431
|
-
|
|
432
|
-
✓ status is 200
|
|
433
|
-
✓ response time < 500ms
|
|
434
|
-
|
|
435
|
-
checks.........................: 100.00% ✓ 54000 ✗ 0
|
|
436
|
-
data_received..................: 12 MB 22 kB/s
|
|
437
|
-
data_sent......................: 4.3 MB 7.8 kB/s
|
|
438
|
-
http_req_blocked...............: avg=1.2ms min=0s med=0s p(95)=0s p(99)=0s
|
|
439
|
-
http_req_connecting............: avg=500µs min=0s med=0s p(95)=0s p(99)=0s
|
|
440
|
-
✓ http_req_duration............: avg=45ms min=12ms med=38ms p(95)=89ms p(99)=120ms
|
|
441
|
-
http_req_receiving.............: avg=500µs min=0s med=0s p(95)=1ms p(99)=2ms
|
|
442
|
-
http_req_sending...............: avg=100µs min=0s med=0s p(95)=0s p(99)=1ms
|
|
443
|
-
http_req_waiting...............: avg=44ms min=12ms med=37ms p(95)=88ms p(99)=119ms
|
|
444
|
-
http_reqs......................: 54000 100/s
|
|
445
|
-
iteration_duration.............: avg=1.04s min=1.01s med=1.03s p(95)=1.09s p(99)=1.12s
|
|
446
|
-
iterations.....................: 54000 100/s
|
|
447
|
-
vus............................: 100 min=1 max=100
|
|
448
|
-
vus_max........................: 100 min=100 max=100
|
|
449
|
-
```
|
|
450
|
-
|
|
451
|
-
### Key Metrics Interpretation
|
|
452
|
-
|
|
453
|
-
| Metric | Good | Warning | Critical |
|
|
454
|
-
|--------|------|---------|----------|
|
|
455
|
-
| `http_req_duration p(95)` | <200ms | 200-500ms | >500ms |
|
|
456
|
-
| `http_req_failed` | <1% | 1-5% | >5% |
|
|
457
|
-
| `iterations` | Meets target | 10% below | >20% below |
|
|
458
|
-
| `checks` | 100% | 95-99% | <95% |
|
|
459
|
-
|
|
460
|
-
---
|
|
461
|
-
|
|
462
|
-
## Load Test Report Template
|
|
463
|
-
|
|
464
|
-
```markdown
|
|
465
|
-
# Load Test Report
|
|
466
|
-
|
|
467
|
-
## Test Information
|
|
468
|
-
- **Date:** [Date]
|
|
469
|
-
- **Environment:** [staging/production]
|
|
470
|
-
- **Duration:** [Duration]
|
|
471
|
-
- **Test Type:** [Load/Stress/Spike/Soak]
|
|
472
|
-
|
|
473
|
-
## Summary
|
|
474
|
-
|
|
475
|
-
| Metric | Target | Result | Status |
|
|
476
|
-
|--------|--------|--------|--------|
|
|
477
|
-
| Max Users | 100 | 100 | ✅ |
|
|
478
|
-
| P95 Latency | <500ms | 89ms | ✅ |
|
|
479
|
-
| Error Rate | <1% | 0.1% | ✅ |
|
|
480
|
-
| Throughput | 100 rps | 120 rps | ✅ |
|
|
481
|
-
|
|
482
|
-
## Detailed Results
|
|
483
|
-
|
|
484
|
-
### Response Time
|
|
485
|
-
- P50: 38ms
|
|
486
|
-
- P95: 89ms
|
|
487
|
-
- P99: 120ms
|
|
488
|
-
- Max: 250ms
|
|
489
|
-
|
|
490
|
-
### Throughput
|
|
491
|
-
- Requests/sec: 120
|
|
492
|
-
- Total requests: 54,000
|
|
493
|
-
|
|
494
|
-
### Errors
|
|
495
|
-
- Total: 54 (0.1%)
|
|
496
|
-
- 5xx: 0
|
|
497
|
-
- Timeouts: 54
|
|
498
|
-
|
|
499
|
-
## Bottlenecks Identified
|
|
500
|
-
|
|
501
|
-
1. **Database connection pool**
|
|
502
|
-
- Saturated at 80 concurrent users
|
|
503
|
-
- Recommendation: Increase pool size
|
|
504
|
-
|
|
505
|
-
2. **Memory usage**
|
|
506
|
-
- Peaked at 85% during max load
|
|
507
|
-
- Recommendation: Add memory or optimize
|
|
508
|
-
|
|
509
|
-
## Recommendations
|
|
510
|
-
|
|
511
|
-
1. Increase database pool from 10 to 25
|
|
512
|
-
2. Add response caching for `/api/products`
|
|
513
|
-
3. Consider horizontal scaling for >200 users
|
|
514
|
-
|
|
515
|
-
## Appendix
|
|
516
|
-
|
|
517
|
-
[Attach detailed test output and graphs]
|
|
518
|
-
```
|
|
519
|
-
|
|
520
|
-
---
|
|
521
|
-
|
|
522
|
-
## Configuration
|
|
523
|
-
|
|
524
|
-
```yaml
|
|
525
|
-
# proagents.config.yaml
|
|
526
|
-
|
|
527
|
-
performance:
|
|
528
|
-
load_testing:
|
|
529
|
-
enabled: true
|
|
530
|
-
tool: "k6"
|
|
531
|
-
|
|
532
|
-
default_thresholds:
|
|
533
|
-
http_req_duration_p95: 500ms
|
|
534
|
-
http_req_failed: 1%
|
|
535
|
-
|
|
536
|
-
environments:
|
|
537
|
-
staging:
|
|
538
|
-
base_url: "https://staging.example.com"
|
|
539
|
-
max_users: 100
|
|
540
|
-
|
|
541
|
-
production:
|
|
542
|
-
base_url: "https://api.example.com"
|
|
543
|
-
max_users: 500 # Higher limit
|
|
544
|
-
|
|
545
|
-
schedule:
|
|
546
|
-
smoke: "on_deploy"
|
|
547
|
-
load: "weekly"
|
|
548
|
-
stress: "monthly"
|
|
549
|
-
soak: "monthly"
|
|
550
|
-
```
|
|
551
|
-
|
|
552
|
-
---
|
|
553
|
-
|
|
554
|
-
## Commands
|
|
555
|
-
|
|
556
|
-
| Command | Description |
|
|
557
|
-
|---------|-------------|
|
|
558
|
-
| `pa:load-test` | Run default load test |
|
|
559
|
-
| `pa:load-test --smoke` | Run smoke test |
|
|
560
|
-
| `pa:load-test --stress` | Run stress test |
|
|
561
|
-
| `pa:load-test --spike` | Run spike test |
|
|
562
|
-
| `pa:load-test --soak` | Run soak test |
|
|
563
|
-
| `pa:load-test --report` | Generate test report |
|