diff --git a/load-tests/entrypoint.sh b/load-tests/entrypoint.sh index 6571e930..8748eedf 100755 --- a/load-tests/entrypoint.sh +++ b/load-tests/entrypoint.sh @@ -4,16 +4,17 @@ set -e PIDS=() -# Start 20 instances of the machine -for i in $(seq 1 20); do +# Start 10 instances of the machine +for i in $(seq 1 10); do tsx machine.ts & - echo "Started instance $i" PIDS+=($!) done -# Wait for all instances to finish -for pid in "${PIDS[@]}"; do - wait $pid - echo "Instance $pid finished" +# Every 10 seconds, check if all 50 instances are still running +while true; do + for pid in "${PIDS[@]}"; do + kill -0 $pid || exit 1 + done + echo "All instances are still running" + sleep 30 done - diff --git a/load-tests/machine.ts b/load-tests/machine.ts index 8f7eea07..97afc12e 100644 --- a/load-tests/machine.ts +++ b/load-tests/machine.ts @@ -2,9 +2,11 @@ import { Inferable } from 'inferable' const API_SECRET = process.env.INFERABLE_TEST_API_SECRET +const machineId = `load-test-${Math.floor(Math.random() * 1000000)}` + const client = new Inferable({ apiSecret: API_SECRET, - machineId: `load-test-${Math.floor(Math.random() * 1000000)}`, + machineId, }) client.default.register({ @@ -17,4 +19,8 @@ client.default.register({ name: "searchHaystack", }) -client.default.start() +client.default.start().then(() => { + console.log("Machine started", { + machineId + }) +}) diff --git a/load-tests/script.js b/load-tests/script.js index 218fac62..32faf9cb 100644 --- a/load-tests/script.js +++ b/load-tests/script.js @@ -25,6 +25,7 @@ export default function () { // Create a new run const postRunResponse = http.post(`${BASE_URL}/clusters/${CLUSTER_ID}/runs`, JSON.stringify({ + name: "Load Test", initialPrompt: 'Get the special word from the `searchHaystack` function', reasoningTraces: false, attachedFunctions: [ @@ -58,7 +59,7 @@ export default function () { // Poll the run status until complete or timeout let attempts = 0; - const maxAttempts = 10; + const maxAttempts = 300; while (attempts < maxAttempts) { const getRunResponse = http.get(`${BASE_URL}/clusters/${CLUSTER_ID}/runs/${runId}`, {