mirror of
https://github.com/PR0M3TH3AN/TORCH.git
synced 2026-11-06 12:51:54 +00:00
feat(scheduler): execute load-test-agent daily run
- Implement `scripts/agent/simple-relay.mjs` for local load testing - Execute `load-test-agent` prompt via scheduler flow - Generate load test reports and run artifacts - Complete daily task for `load-test-agent` Co-authored-by: PR0M3TH3AN <[email protected]>
This commit is contained in:
1 parent
bb4b860695
commit
45f0e16631
9 files changed
+300
No files matched your search
@@ -0,0 +1,12 @@
|
|||||||
|
# Memory Update — load-test-agent — 2026-02-22
|
||||||
|
|
||||||
|
## Key findings
|
||||||
|
- Verified `load-test.mjs` harness works correctly against a local ephemeral relay (`scripts/agent/simple-relay.mjs`).
|
||||||
|
- Dry-run mode defaults to true; explicit `--dry-run 0` is required for live tests.
|
||||||
|
|
||||||
|
## Patterns / reusable knowledge
|
||||||
|
- Use `scripts/agent/simple-relay.mjs` for safe local load testing without external dependencies.
|
||||||
|
- `load-test.mjs` generates reports in `reports/load-test/`.
|
||||||
|
|
||||||
|
## Warnings / gotchas
|
||||||
|
- Ensure local relay port binding works in the environment (`127.0.0.1`).
|
||||||
@@ -0,0 +1,150 @@
|
|||||||
|
{
|
||||||
|
"generatedAt": "2026-02-22T23:05:00.396Z",
|
||||||
|
"config": {
|
||||||
|
"relay": {
|
||||||
|
"protocol": "ws:",
|
||||||
|
"hostname": "127.0.0.1",
|
||||||
|
"port": "42049"
|
||||||
|
},
|
||||||
|
"relaySummary": "ws://127.0.0.1:42049",
|
||||||
|
"dryRun": false,
|
||||||
|
"clients": 10,
|
||||||
|
"durationSec": 10,
|
||||||
|
"rateEps": 20,
|
||||||
|
"mixMetadata": 0.2,
|
||||||
|
"seed": null,
|
||||||
|
"connectConcurrency": 25,
|
||||||
|
"maxConnections": 10,
|
||||||
|
"maxInflight": 300,
|
||||||
|
"publishTimeoutMs": 15000,
|
||||||
|
"metadataParts": 4
|
||||||
|
},
|
||||||
|
"results": {
|
||||||
|
"attempted": 200,
|
||||||
|
"succeeded": 200,
|
||||||
|
"failed": 0,
|
||||||
|
"successRate": 1,
|
||||||
|
"throughputEps": 19.93,
|
||||||
|
"backpressureDrops": 0,
|
||||||
|
"inFlightPeak": 2,
|
||||||
|
"latency": {
|
||||||
|
"count": 200,
|
||||||
|
"minMs": 0.655,
|
||||||
|
"avgMs": 0.9502750000000002,
|
||||||
|
"p50Ms": 0.806,
|
||||||
|
"p90Ms": 1.073,
|
||||||
|
"p95Ms": 1.252,
|
||||||
|
"p99Ms": 3.879,
|
||||||
|
"maxMs": 11.851
|
||||||
|
},
|
||||||
|
"eventLoopLag": {
|
||||||
|
"avgMs": 0.388,
|
||||||
|
"p95Ms": 1
|
||||||
|
},
|
||||||
|
"errorBreakdown": {},
|
||||||
|
"topStackTraces": {},
|
||||||
|
"resource": {
|
||||||
|
"samples": [
|
||||||
|
{
|
||||||
|
"tSec": 5,
|
||||||
|
"rssMb": 78.54,
|
||||||
|
"heapUsedMb": 12.14,
|
||||||
|
"heapTotalMb": 19.35,
|
||||||
|
"cpuPercent": 17.63
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"tSec": 10,
|
||||||
|
"rssMb": 79.04,
|
||||||
|
"heapUsedMb": 12.29,
|
||||||
|
"heapTotalMb": 19.85,
|
||||||
|
"cpuPercent": 13.45
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"sampleCount": 2,
|
||||||
|
"maxRssMb": 79.04,
|
||||||
|
"maxHeapUsedMb": 12.29,
|
||||||
|
"avgCpuPercent": 15.54,
|
||||||
|
"cpuUserMs": 1514.738,
|
||||||
|
"cpuSystemMs": 41.191
|
||||||
|
},
|
||||||
|
"throughputSeries": [
|
||||||
|
{
|
||||||
|
"second": 0,
|
||||||
|
"attempted": 20,
|
||||||
|
"succeeded": 20,
|
||||||
|
"failed": 0,
|
||||||
|
"backpressureDrops": 0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"second": 1,
|
||||||
|
"attempted": 20,
|
||||||
|
"succeeded": 20,
|
||||||
|
"failed": 0,
|
||||||
|
"backpressureDrops": 0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"second": 2,
|
||||||
|
"attempted": 20,
|
||||||
|
"succeeded": 20,
|
||||||
|
"failed": 0,
|
||||||
|
"backpressureDrops": 0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"second": 3,
|
||||||
|
"attempted": 20,
|
||||||
|
"succeeded": 20,
|
||||||
|
"failed": 0,
|
||||||
|
"backpressureDrops": 0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"second": 4,
|
||||||
|
"attempted": 20,
|
||||||
|
"succeeded": 20,
|
||||||
|
"failed": 0,
|
||||||
|
"backpressureDrops": 0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"second": 5,
|
||||||
|
"attempted": 20,
|
||||||
|
"succeeded": 20,
|
||||||
|
"failed": 0,
|
||||||
|
"backpressureDrops": 0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"second": 6,
|
||||||
|
"attempted": 20,
|
||||||
|
"succeeded": 20,
|
||||||
|
"failed": 0,
|
||||||
|
"backpressureDrops": 0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"second": 7,
|
||||||
|
"attempted": 20,
|
||||||
|
"succeeded": 20,
|
||||||
|
"failed": 0,
|
||||||
|
"backpressureDrops": 0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"second": 8,
|
||||||
|
"attempted": 20,
|
||||||
|
"succeeded": 20,
|
||||||
|
"failed": 0,
|
||||||
|
"backpressureDrops": 0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"second": 9,
|
||||||
|
"attempted": 20,
|
||||||
|
"succeeded": 20,
|
||||||
|
"failed": 0,
|
||||||
|
"backpressureDrops": 0
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"hotFunctions": "not measured",
|
||||||
|
"startedAtIso": "2026-02-22T23:04:50.361Z",
|
||||||
|
"completedAtIso": "2026-02-22T23:05:00.396Z",
|
||||||
|
"runDurationSec": 10.035
|
||||||
|
},
|
||||||
|
"remediation": [
|
||||||
|
"No significant bottlenecks observed in this run; increase load gradually and repeat to find saturation point."
|
||||||
|
]
|
||||||
|
}
|
||||||
@@ -0,0 +1,42 @@
|
|||||||
|
# Load Test Report - 2026-02-22
|
||||||
|
|
||||||
|
## Safety
|
||||||
|
- Does not target public relays.
|
||||||
|
- Requires explicit `RELAY_URL`.
|
||||||
|
- Relay target: ws://127.0.0.1:42049
|
||||||
|
- Mode: live publish test
|
||||||
|
|
||||||
|
## Configuration
|
||||||
|
- Clients: 10
|
||||||
|
- Duration: 10s
|
||||||
|
- Rate: 20 events/sec
|
||||||
|
- Metadata mix: 0.2
|
||||||
|
- Max connections: 10
|
||||||
|
- Max in-flight publishes: 300
|
||||||
|
- Seed: (random)
|
||||||
|
|
||||||
|
## Summary
|
||||||
|
- Attempted: 200
|
||||||
|
- Succeeded: 200
|
||||||
|
- Failed: 0
|
||||||
|
- Throughput: 19.93 events/sec
|
||||||
|
- Success rate: 100.00%
|
||||||
|
|
||||||
|
## Latency
|
||||||
|
- p50: 0.806 ms
|
||||||
|
- p90: 1.073 ms
|
||||||
|
- p95: 1.252 ms
|
||||||
|
- p99: 3.879 ms
|
||||||
|
|
||||||
|
## Event Loop Lag
|
||||||
|
- Avg: 0.388 ms
|
||||||
|
- p95: 1 ms
|
||||||
|
|
||||||
|
## Error Taxonomy
|
||||||
|
- none
|
||||||
|
|
||||||
|
## Hot Functions
|
||||||
|
- not measured
|
||||||
|
|
||||||
|
## Prioritized Remediation
|
||||||
|
1. No significant bottlenecks observed in this run; increase load gradually and repeat to find saturation point.
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
import { WebSocketServer } from 'ws';
|
||||||
|
import http from 'http';
|
||||||
|
|
||||||
|
const server = http.createServer();
|
||||||
|
const wss = new WebSocketServer({ server });
|
||||||
|
|
||||||
|
wss.on('connection', (ws) => {
|
||||||
|
ws.on('message', (message) => {
|
||||||
|
try {
|
||||||
|
const data = JSON.parse(message);
|
||||||
|
const type = data[0];
|
||||||
|
if (type === 'REQ') {
|
||||||
|
const subId = data[1];
|
||||||
|
ws.send(JSON.stringify(['EOSE', subId]));
|
||||||
|
} else if (type === 'EVENT') {
|
||||||
|
const event = data[1];
|
||||||
|
ws.send(JSON.stringify(['OK', event.id, true, '']));
|
||||||
|
}
|
||||||
|
} catch (_err) {
|
||||||
|
// ignore
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
server.listen(0, '127.0.0.1', () => {
|
||||||
|
const address = server.address();
|
||||||
|
console.log(`ws://127.0.0.1:${address.port}`);
|
||||||
|
});
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
---
|
||||||
|
agent: load-test-agent
|
||||||
|
cadence: daily
|
||||||
|
run-start: 2026-02-22T23:03:37Z
|
||||||
|
---
|
||||||
|
|
||||||
|
# Context
|
||||||
|
|
||||||
|
Executed prompt: src/prompts/daily/load-test-agent.md
|
||||||
|
|
||||||
|
## Goal
|
||||||
|
Execute a safe, reproducible load test against a local relay to measure baseline performance.
|
||||||
|
|
||||||
|
## Scope
|
||||||
|
- Create a local ephemeral relay for testing.
|
||||||
|
- Run the load test harness (`scripts/agent/load-test.mjs`) against the local relay.
|
||||||
|
- Generate a performance report.
|
||||||
|
|
||||||
|
## Constraints
|
||||||
|
- Must not target public relays.
|
||||||
|
- Must use `load-test-agent` prompt instructions.
|
||||||
|
- Must not introduce new dependencies if possible.
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
---
|
||||||
|
agent: load-test-agent
|
||||||
|
cadence: daily
|
||||||
|
run-start: 2026-02-22T23:03:37Z
|
||||||
|
---
|
||||||
|
|
||||||
|
# Decisions
|
||||||
|
|
||||||
|
Executed prompt: src/prompts/daily/load-test-agent.md
|
||||||
|
|
||||||
|
## Decision
|
||||||
|
Use a local ephemeral WebSocket server as the relay target.
|
||||||
|
|
||||||
|
## Rationale
|
||||||
|
To ensure safety and avoid hitting public relays, as strictly required by the `load-test-agent` prompt and `AGENTS.md`. A local relay provides a controlled environment for measuring baseline harness performance.
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
---
|
||||||
|
agent: load-test-agent
|
||||||
|
cadence: daily
|
||||||
|
run-start: 2026-02-22T23:03:37Z
|
||||||
|
---
|
||||||
|
|
||||||
|
# Test Log
|
||||||
|
|
||||||
|
Executed prompt: src/prompts/daily/load-test-agent.md
|
||||||
|
|
||||||
|
- Command: `node scripts/agent/load-test.mjs --relay-url "ws://127.0.0.1:42049" --clients 10 --duration-sec 10 --allow-dedicated-test-relay 1 --relay-safety-ack LOAD_TEST_INFRA_CONFIRMED --dry-run 0`
|
||||||
|
- Result: Success. Throughput: 19.93 events/sec. Success rate: 100%. No errors. See `reports/load-test/load-test-report-2026-02-22.md` for details.
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
---
|
||||||
|
agent: load-test-agent
|
||||||
|
cadence: daily
|
||||||
|
run-start: 2026-02-22T23:03:37Z
|
||||||
|
---
|
||||||
|
|
||||||
|
# Todo
|
||||||
|
|
||||||
|
Executed prompt: src/prompts/daily/load-test-agent.md
|
||||||
|
|
||||||
|
## Completed Tasks
|
||||||
|
- [x] Run load test against local relay
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
---
|
||||||
|
agent: load-test-agent
|
||||||
|
platform: linux
|
||||||
|
---
|
||||||
|
|
||||||
|
# Completed
|
||||||
|
Executed prompt: src/prompts/daily/load-test-agent.md
|
||||||
Reference in new issue
Block a user