Skip to content

Commit 7897d66

Browse files
committed
Fixing ttfr
1 parent 0b8b23b commit 7897d66

2 files changed

Lines changed: 33 additions & 32 deletions

File tree

benchmarks/main.yml

Lines changed: 31 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -98,13 +98,13 @@ scripts:
9898
- sh: sudo rm -Rf ${{REPO_DIR}}
9999
- sh: mkdir -p ${{REPO_DIR}}/logs
100100
- sh: cd ${{REPO_DIR}}
101-
- log: Cloning project repo
101+
- log: Cloning project repo ${{config.repo.branch}}@${{config.repo.url}}
102102
- sh: git clone -b ${{config.repo.branch}} ${{config.repo.url}}
103103
- sh: cd ${{PROJ_REPO_NAME}}
104104
- log: Checked out repo
105105
- sh: git remote get-url origin
106106
- sh: git branch --show-current
107-
- sh: cd scripts/startup
107+
- sh: cd ${{SCRIPTS_DIR}}
108108
- sh: npm install axios@0.27.2
109109

110110
# install-wrk: #TODO: Move to core-scripts
@@ -266,14 +266,14 @@ scripts:
266266
- sh: ${{RUNTIME.buildCmd}}
267267
- for-each: ITERATION ${{=[...Array(${{ITERATIONS}}).keys()]}}
268268
then:
269-
- sh: node ${{REPO_DIR}}/scripts/startup/time.js "${{= "${{RUNTIME.runCmd}}".trim().replace(/ +/g, ' ') }}" ${{TARGET_URL}} | awk '{print $1}'
270-
then:
271-
- set-state: START_TIME
272-
- script: state-array-push
273-
with:
274-
array: RUN.output.results.${{RUNTIME.name}}.startup.timings
275-
value: ${{START_TIME}}
276-
- sh: sleep ${{PAUSE_TIME}}
269+
- sh: node ${{SCRIPTS_DIR}}/time.js "${{= "${{RUNTIME.runCmd}}".trim().replace(/ +/g, ' ') }}" ${{TARGET_URL}} | awk '{print $1}'
270+
then:
271+
- set-state: START_TIME
272+
- script: state-array-push
273+
with:
274+
array: RUN.output.results.${{RUNTIME.name}}.startup.timings
275+
value: ${{START_TIME}}
276+
- sh: sleep ${{PAUSE_TIME}}
277277
- script: state-array-calc-avg
278278
with:
279279
var-name: RUN.output.results.${{RUNTIME.name}}.startup.avStartTime
@@ -285,27 +285,27 @@ scripts:
285285
- sh: cd ${{RUNTIME.dir}}
286286
- for-each: ITERATION ${{=[...Array(${{ITERATIONS}}).keys()]}}
287287
then:
288-
- sh: ${{RUNTIME.runCmd}} 2>&1 >${{REPO_DIR}}/logs/measure-rss-${{RUNTIME.name}}-${{ITERATION}}.log &
289-
- sh: APP_PID=$!
290-
- log: $APP_PID
291-
- sh: sleep ${{PAUSE_TIME}}
292-
- sh: pmap -x $APP_PID | grep total | awk '{print $4}'
293-
then:
294-
- set-state: RSS_STARTUP
295-
- script: state-array-push
296-
with:
297-
array: RUN.output.results.${{RUNTIME.name}}.rss.startup
298-
value: ${{= ${{RSS_STARTUP}}/1024 }}
299-
- sh: curl -s ${{TARGET_URL}} > /dev/null
300-
- sh: pmap -x $APP_PID | grep total | awk '{print $4}'
301-
then:
302-
- set-state: FIRST_REQUEST
303-
- script: state-array-push
304-
with:
305-
array: RUN.output.results.${{RUNTIME.name}}.rss.firstRequest
306-
value: ${{= ${{FIRST_REQUEST}}/1024 }}
307-
- sh: kill -15 $APP_PID
308-
- sh: sleep ${{PAUSE_TIME}}
288+
- sh: ${{RUNTIME.runCmd}} 2>&1 >${{REPO_DIR}}/logs/measure-rss-${{RUNTIME.name}}-${{ITERATION}}.log &
289+
- sh: APP_PID=$!
290+
- log: $APP_PID
291+
- sh: sleep ${{PAUSE_TIME}}
292+
- sh: pmap -x $APP_PID | grep total | awk '{print $4}'
293+
then:
294+
- set-state: RSS_STARTUP
295+
- script: state-array-push
296+
with:
297+
array: RUN.output.results.${{RUNTIME.name}}.rss.startup
298+
value: ${{= ${{RSS_STARTUP}}/1024 }}
299+
- sh: curl -s ${{TARGET_URL}} > /dev/null
300+
- sh: pmap -x $APP_PID | grep total | awk '{print $4}'
301+
then:
302+
- set-state: FIRST_REQUEST
303+
- script: state-array-push
304+
with:
305+
array: RUN.output.results.${{RUNTIME.name}}.rss.firstRequest
306+
value: ${{= ${{FIRST_REQUEST}}/1024 }}
307+
- sh: kill -15 $APP_PID
308+
- sh: sleep ${{PAUSE_TIME}}
309309
- script: state-array-calc-avg
310310
with:
311311
var-name: RUN.output.results.${{RUNTIME.name}}.rss.avStartupRss

scripts/infra.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#!/bin/bash
22
set -euo pipefail
3+
thisdir=`dirname "$0"`
34

45
help() {
56
echo "This script starts the necessary services for the app in question"
@@ -19,7 +20,7 @@ exit_abnormal() {
1920

2021
start_postgres() {
2122
echo "Starting PostgreSQL database '${DB_CONTAINER_NAME}'"
22-
local pid=$(${engine} run -d --rm=true --name ${DB_CONTAINER_NAME} -v ./dbdata:/docker-entrypoint-initdb.d/ -p 5432:5432 -e POSTGRES_USER=fruits -e POSTGRES_PASSWORD=fruits -e POSTGRES_DB=fruits postgres:17 > /dev/null)
23+
local pid=$(cd ${thisdir} && ${engine} run -d --rm=true --name ${DB_CONTAINER_NAME} -v ./dbdata:/docker-entrypoint-initdb.d/ -p 5432:5432 -e POSTGRES_USER=fruits -e POSTGRES_PASSWORD=fruits -e POSTGRES_DB=fruits postgres:17 > /dev/null)
2324
echo "PostgreSQL DB process: $pid"
2425

2526
echo "Waiting for PostgreSQL to be ready..."

0 commit comments

Comments
 (0)