diff --git a/.github/workflows/cli-p2p-compose-smoke.yml b/.github/workflows/cli-p2p-compose-smoke.yml index e523064..8571603 100644 --- a/.github/workflows/cli-p2p-compose-smoke.yml +++ b/.github/workflows/cli-p2p-compose-smoke.yml @@ -60,10 +60,17 @@ jobs: BENCH_BIN_SIZE_BYTES: '512' BENCH_COUCHDB_RTT_MS: ${{ inputs.couchdb_rtt_ms || '20' }} BENCH_SYNC_TIMEOUT: '180' - BENCH_PEERS_TIMEOUT: '90' + BENCH_PEERS_TIMEOUT: '20' + LIVESYNC_P2P_RELAY_READY_TIMEOUT_MS: '60000' BENCH_LIVESYNC_TEST_TEE: '0' run: docker compose -f test/bench-network/compose.yml run --rm bench-runner + - name: Show Compose diagnostics + if: failure() + run: | + docker compose -f test/bench-network/compose.yml ps + docker compose -f test/bench-network/compose.yml logs --no-color couchdb nostr-relay + - name: Upload benchmark results if: always() uses: actions/upload-artifact@v4 diff --git a/src/apps/cli/testdeno/bench-p2p.ts b/src/apps/cli/testdeno/bench-p2p.ts index e249428..2dfb2f5 100644 --- a/src/apps/cli/testdeno/bench-p2p.ts +++ b/src/apps/cli/testdeno/bench-p2p.ts @@ -179,9 +179,9 @@ async function main(): Promise { await host.waitUntilContains("P2P host is running", 20000); const hostReadyElapsed = nowMs() - hostReadyStart; - const peerDiscoveryStart = nowMs(); + const peerDiscoveryCommandStart = nowMs(); const peer = await discoverPeer(clientVault, clientSettings, config.peersTimeoutSeconds); - const peerDiscoveryElapsed = nowMs() - peerDiscoveryStart; + const peerDiscoveryCommandElapsed = nowMs() - peerDiscoveryCommandStart; const syncStart = nowMs(); await runCliOrFail( @@ -223,7 +223,10 @@ async function main(): Promise { binFileCount: seedFiles.binCount, mirrorElapsedMs: Number(mirrorElapsed.toFixed(1)), hostReadyElapsedMs: Number(hostReadyElapsed.toFixed(1)), - peerDiscoveryElapsedMs: Number(peerDiscoveryElapsed.toFixed(1)), + peerDiscoveryTimeoutSeconds: config.peersTimeoutSeconds, + peerDiscoveryCommandElapsedMs: Number(peerDiscoveryCommandElapsed.toFixed(1)), + peerDiscoveryNote: + "p2p-peers waits for the requested timeout before printing discovered peers, so this is command duration, not first-peer latency.", syncElapsedMs: Number(syncElapsed.toFixed(1)), throughputBytesPerSec: Number((seedFiles.totalBytes / (syncElapsed / 1000)).toFixed(2)), throughputMiBPerSec: Number((seedFiles.totalBytes / (syncElapsed / 1000) / 1024 / 1024).toFixed(4)), diff --git a/test/bench-network/README.md b/test/bench-network/README.md index 7ccb166..e702e7e 100644 --- a/test/bench-network/README.md +++ b/test/bench-network/README.md @@ -68,6 +68,10 @@ The current CouchDB latency model is the existing HTTP proxy inside latency, but it does not model packet loss, jitter, MTU, bandwidth limits, bufferbloat, or VPN encapsulation. +For P2P runs, `BENCH_PEERS_TIMEOUT` is passed to `p2p-peers`. That command waits +for the requested observation window before printing discovered peers, so the +reported peer discovery command time should not be read as first-peer latency. + ## Latency sweep To run P2P once and CouchDB at several requested RTT values: diff --git a/test/bench-network/compose.yml b/test/bench-network/compose.yml index e54ec0e..ca0f6a2 100644 --- a/test/bench-network/compose.yml +++ b/test/bench-network/compose.yml @@ -45,6 +45,11 @@ services: exec /app/strfry --config /tmp/strfry.conf relay tmpfs: - /app/strfry-db:rw,size=256m + healthcheck: + test: ["CMD-SHELL", "nc -z 127.0.0.1 7777"] + interval: 2s + timeout: 5s + retries: 30 coturn: image: coturn/coturn:latest @@ -64,7 +69,7 @@ services: couchdb: condition: service_healthy nostr-relay: - condition: service_started + condition: service_healthy environment: BENCH_COMMAND: ${BENCH_COMMAND:-cases} BENCH_CASES: ${BENCH_CASES:-couchdb-baseline,p2p-direct-local} @@ -88,6 +93,7 @@ services: BENCH_TETHERING_VPN_RTT_MS: ${BENCH_TETHERING_VPN_RTT_MS:-120} BENCH_SYNC_TIMEOUT: ${BENCH_SYNC_TIMEOUT:-300} BENCH_PEERS_TIMEOUT: ${BENCH_PEERS_TIMEOUT:-60} + LIVESYNC_P2P_RELAY_READY_TIMEOUT_MS: ${LIVESYNC_P2P_RELAY_READY_TIMEOUT_MS:-60000} BENCH_LIVESYNC_TEST_TEE: ${BENCH_LIVESYNC_TEST_TEE:-0} volumes: - ./bench-results:/workspace/src/apps/cli/testdeno/bench-results