diff --git a/memory-updates/2026-02-22T23-03-37Z__load-test-agent.md b/memory-updates/2026-02-22T23-03-37Z__load-test-agent.md new file mode 100644 index 0000000..d393289 --- /dev/null +++ b/memory-updates/2026-02-22T23-03-37Z__load-test-agent.md @@ -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`). diff --git a/reports/load-test/load-report-2026-02-22.json b/reports/load-test/load-report-2026-02-22.json new file mode 100644 index 0000000..6f83fd7 --- /dev/null +++ b/reports/load-test/load-report-2026-02-22.json @@ -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." + ] +} \ No newline at end of file diff --git a/reports/load-test/load-test-report-2026-02-22.md b/reports/load-test/load-test-report-2026-02-22.md new file mode 100644 index 0000000..24fd5f4 --- /dev/null +++ b/reports/load-test/load-test-report-2026-02-22.md @@ -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. diff --git a/scripts/agent/simple-relay.mjs b/scripts/agent/simple-relay.mjs new file mode 100644 index 0000000..c356df1 --- /dev/null +++ b/scripts/agent/simple-relay.mjs @@ -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}`); +}); diff --git a/src/context/CONTEXT_2026-02-22T23-03-37Z.md b/src/context/CONTEXT_2026-02-22T23-03-37Z.md new file mode 100644 index 0000000..d81fe84 --- /dev/null +++ b/src/context/CONTEXT_2026-02-22T23-03-37Z.md @@ -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. diff --git a/src/decisions/DECISIONS_2026-02-22T23-03-37Z.md b/src/decisions/DECISIONS_2026-02-22T23-03-37Z.md new file mode 100644 index 0000000..feea0d0 --- /dev/null +++ b/src/decisions/DECISIONS_2026-02-22T23-03-37Z.md @@ -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. diff --git a/src/test_logs/TEST_LOG_2026-02-22T23-03-37Z.md b/src/test_logs/TEST_LOG_2026-02-22T23-03-37Z.md new file mode 100644 index 0000000..2c4916e --- /dev/null +++ b/src/test_logs/TEST_LOG_2026-02-22T23-03-37Z.md @@ -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. diff --git a/src/todo/TODO_2026-02-22T23-03-37Z.md b/src/todo/TODO_2026-02-22T23-03-37Z.md new file mode 100644 index 0000000..3d62059 --- /dev/null +++ b/src/todo/TODO_2026-02-22T23-03-37Z.md @@ -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 diff --git a/task-logs/daily/2026-02-22T23-03-37Z__load-test-agent__completed.md b/task-logs/daily/2026-02-22T23-03-37Z__load-test-agent__completed.md new file mode 100644 index 0000000..9a0e737 --- /dev/null +++ b/task-logs/daily/2026-02-22T23-03-37Z__load-test-agent__completed.md @@ -0,0 +1,7 @@ +--- +agent: load-test-agent +platform: linux +--- + +# Completed +Executed prompt: src/prompts/daily/load-test-agent.md