Repository navigation
Expand file tree
/
Copy pathloadtest.sh
More file actions
executable file
·49 lines (39 loc) · 1.79 KB
/
Copy pathloadtest.sh
File metadata and controls
executable file
·49 lines (39 loc) · 1.79 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#!/bin/bash
# VT-12 load test. Starts a clean stack WITHOUT the demo feed, then hands off to
# testfiles/loadtest.q which drives the load and measures the whole chain from one process.
#
# ./loadtest.sh 200k rows, 50 instruments
# ROWS=2000000 PAIRS=500 ./loadtest.sh heavier
#
# Wipes var/ so every run starts from a known state.
cd "$(dirname "$0")"
. ./setenv.sh >/dev/null 2>&1
if [ ! -f "${TORQHOME}/torq.q" ]; then
echo "ERROR: no torq.q under TORQHOME=${TORQHOME}" >&2
echo " set TORQHOME to your TorQ checkout, or edit setenv.sh" >&2
exit 1
fi
ROWS=${ROWS:-200000}
PAIRS=${PAIRS:-50}
BATCH=${BATCH:-1000}
SETENV="$PWD/setenv.sh" "$TORQHOME/torq.sh" stop all >/dev/null 2>&1
rm -rf var
mkdir -p "$KDBDB" "$KDBLOG" "$KDBTPLOG"
echo "load test: $ROWS rows, $PAIRS instruments, batches of $BATCH"
APPHOME="$TORQAPPHOME"
# Bring the stack up through TorQ's process manager, naming the processes so the demo
# feed (feed1) is left out - the load test drives its own data through testfiles/loadtest.q.
SETENV="$PWD/setenv.sh" "$TORQHOME/torq.sh" start discovery1 stp1 wdb1 idb1
sleep 8
# count only THIS pack's processes - the procnames are TorQ defaults, so an unscoped
# pgrep counts every stack on the machine, so match on this tree's own paths
up=$(pgrep -f 'procname (discovery1|stp1|wdb1|idb1)' 2>/dev/null | while read -r pid; do
ps -p "$pid" -o args= 2>/dev/null | grep -qF -- "$TORQAPPHOME" && echo x
done | wc -l)
echo "stack up: ${up}/4"
echo ""
LOADROWS=$ROWS LOADPAIRS=$PAIRS LOADBATCH=$BATCH q "${APPHOME}/testfiles/loadtest.q" </dev/null
echo ""
echo " files on disk : $(find "$KDBDB" -type f | wc -l)"
echo " size on disk : $(du -sh "$KDBDB" | cut -f1)"
echo " error bytes : $(cat "${KDBLOG}"/err_*.log 2>/dev/null | wc -c)"