Skip to content

Commit 2ee29a7

Browse files
supporting numactl
supporting numactl
1 parent 89ed4d5 commit 2ee29a7

File tree

6 files changed

+36
-15
lines changed

6 files changed

+36
-15
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ This takes three arguments:
106106
is kept on the filesystem. Useful for testing performance on a fuller
107107
filesystem, which could be modeled through running multiple iterations
108108
of `mthread.sh`.
109-
1. Optional: date. This test assumes that data was already generated (`keep` flag was used the previous test). Format of `%m%dD%H%M` is expected like `0404D1232`.
109+
1. Optional: date. This test assumes that data was already generated (`keep` flag was used the previous test). Format of `%m%d_H%M%S` is expected like `0408_152349`.
110110

111111
If you would like the data to be compressed then pass the environment variable `COMPRESS` with the [kdb+ compression parameters](https://code.kx.com/q/kb/file-compression/#compression-parameters).
112112

@@ -115,7 +115,7 @@ Example usages
115115
```bash
116116
$ ./mthread.sh $(nproc) full delete
117117
$ COMPRESS="17 2 6" ./mthread.sh 8 full keep
118-
$ ./mthread.sh 8 readonly keep 0404:1232
118+
$ ./mthread.sh 8 readonly keep 0408_152349
119119
```
120120

121121

common.sh

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
if [[ $(uname) == "Linux" ]]; then
2-
COREPERSOCKET=$(lscpu | grep "Core(s) per socket" | cut -d":" -f 2 |xargs)
32
SOCKETNR=$(lscpu | grep "Socket(s)" | cut -d":" -f 2 |xargs)
3+
COREPERSOCKET=$(lscpu | grep "Core(s) per socket" | cut -d":" -f 2 |xargs)
4+
THREADPERCORE=$(lscpu | grep "Thread(s) per core" | cut -d":" -f 2 |xargs)
45
CPUMOODEL=$(lscpu | grep "Model name" | cut -d":" -f 2 |xargs)
56
else
6-
COREPERSOCKET=$(sysctl -n hw.ncpu)
77
SOCKETNR=1
8+
COREPERSOCKET=$(sysctl -n hw.ncpu)
9+
THREADPERCORE=1
810
CPUMOODEL=$(sysctl -n machdep.cpu.brand_string)
911
fi
10-
CORECOUNT=$((COREPERSOCKET * SOCKETNR))
12+
COMPUTECOUNT=$((COREPERSOCKET * SOCKETNR * THREADPERCORE))

config/env

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,11 @@ export EXCLUDETESTS=""
1414

1515
export SUDO="sudo" # "" or "sudo" if sudo is required for some commands e.g. to flush page cache
1616

17+
# Worker processes can be started with a numactl command.
18+
# Option `roundrobin` means that worker `i` is started on numa node `i mod N` where N is the number of numa nodes.
19+
# If N is 1 or NUMA is set to `nonuma` then no numactl is used.
20+
export NUMA="nonuma" # nonuma or roundrobin
21+
1722
##############
1823
# Settings for object storage
1924
# See this for more details: https://code.kx.com/insights/1.4/core/objstor/main.html

mthread.sh

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -93,10 +93,11 @@ yq -i ".env.THREADNR=$THREADNR" $CONFIG
9393
yq -i ".env.PROCNR=$NUMPROCESSES" $CONFIG
9494
yq -i ".env.FLUSH=\"$(basename $FLUSH)\"" $CONFIG
9595
yq -i ".env.DBDIR=\"$(cat $PARFILE)\"" $CONFIG
96-
yq -i ".nano.VERSION=\"$(yq '.dev' version.yaml)\"" $CONFIG
97-
yq -i ".kdb.MAJOR=$($QBIN -q <<< ".z.K" | tr -d f)" $CONFIG
98-
yq -i ".kdb.MINOR=\"$($QBIN -q <<< ".z.k")\"" $CONFIG
99-
yq -i ".kdb.QBIN=\"$QBIN\"" $CONFIG
96+
yq -i ".env.NUMA=\"$NUMA\"" $CONFIG
97+
yq -i ".nano.version=\"$(yq '.dev' version.yaml)\"" $CONFIG
98+
yq -i ".kdb.major=$($QBIN -q <<< ".z.K" | tr -d f)" $CONFIG
99+
yq -i ".kdb.minor=\"$($QBIN -q <<< ".z.k")\"" $CONFIG
100+
yq -i ".kdb.qbin=\"$QBIN\"" $CONFIG
100101
yq -i ".dbize.SEQWRITETESTLIMIT=$SEQWRITETESTLIMIT" $CONFIG
101102
yq -i ".dbize.RANDREADNUMBER=$RANDREADNUMBER" $CONFIG
102103
yq -i ".dbize.RANDREADFILESIZE=$RANDREADFILESIZE" $CONFIG
@@ -105,15 +106,27 @@ yq -i ".system.os.name=\"$(uname)\"" $CONFIG
105106
yq -i ".system.os.kernel=\"$(uname -r)\"" $CONFIG
106107
yq -i ".system.cpu.arch=\"$(arch)\"" $CONFIG
107108
yq -i ".system.cpu.model=\"$CPUMOODEL\"" $CONFIG
108-
yq -i ".system.cpu.corepersocket=$COREPERSOCKET" $CONFIG
109109
yq -i ".system.cpu.socketnr=$SOCKETNR" $CONFIG
110+
yq -i ".system.cpu.corepersocket=$COREPERSOCKET" $CONFIG
111+
yq -i ".system.cpu.threadpercore=$THREADPERCORE" $CONFIG
110112
yq -i ".system.memsizeGB=$($QBIN -q <<<'.Q.w[][`mphy] div 1024 * 1024 * 1024')" $CONFIG
111113

114+
function getNuma {
115+
echo ""
116+
}
117+
112118
if [[ $(uname) == "Linux" ]]; then
113119
lscpu > ${RESDIR}/lscpu.out
114120
${SUDO} dmidecode -t memory > ${RESDIR}/dmidecode.out
115121
if command -v numactl 2>&1 >/dev/null; then
116122
numactl --hardware > ${RESDIR}/numactl.out
123+
NUMANODES=$(lscpu|grep "NUMA node(s)"|cut -d":" -f 2|xargs)
124+
if [[ ${NUMA} == "roundrobin" ]] && [[ ${NUMANODES} -gt 1 ]]; then
125+
function getNuma {
126+
local IDX=$(((${1}-1) % NUMANODES))
127+
echo "numactl -N $IDX -m $IDX"
128+
}
129+
fi
117130
fi
118131
fi
119132

@@ -174,7 +187,8 @@ function runTest {
174187
${QBIN} ./src/controller.q -iostatfile ${IOSTATFILE} -s $NUMPROCESSES -q -p ${CONTROLLERPORT} > ${CURRENTLOGDIR}/controller_${TESTER%.*}.log 2 >&1 &
175188
j=0
176189
for i in $(seq $NUMPROCESSES); do
177-
${QBIN} ./src/${TESTER} -processes $NUMPROCESSES -db ${array[$j]}/${HOST}.${i}/${DATE} -result ${RESFILEPREFIX}${i}.psv -controller ${CONTROLLERPORT} -s ${THREADNR} -p $((WORKERBASEPORT + i)) > ${LOGFILEPREFIX}${i}_${TESTER%.*}.log 2>&1 &
190+
local NUMAPREFIX=$(getNuma $i)
191+
${NUMAPREFIX} ${QBIN} ./src/${TESTER} -processes $NUMPROCESSES -db ${array[$j]}/${HOST}.${i}/${DATE} -result ${RESFILEPREFIX}${i}.psv -controller ${CONTROLLERPORT} -s ${THREADNR} -p $((WORKERBASEPORT + i)) > ${LOGFILEPREFIX}${i}_${TESTER%.*}.log 2>&1 &
178192
j=$(( ($j + 1) % $NUMSEGS ))
179193
done
180194
wait -n

runSeveral.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@ source common.sh
66

77
if [ $# -lt 1 ]; then
88
readonly OUTPUT=./results/throughput_total.psv
9-
readonly LIMIT=$CORECOUNT
9+
readonly LIMIT=$COMPUTECOUNT
1010
elif [ $# -lt 2 ]; then
1111
readonly OUTPUT=$1
12-
readonly LIMIT=$CORECOUNT
12+
readonly LIMIT=$COMPUTECOUNT
1313
else
1414
readonly OUTPUT=$1
1515
readonly LIMIT=$2

version.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
pub: 3.3.3
2-
dev: 3.3.3
1+
pub: 3.4.0
2+
dev: 3.4.0

0 commit comments

Comments
 (0)