]>
Commit | Line | Data |
---|---|---|
045e4577 | 1 | #!/bin/bash -e |
b3bd2e75 PD |
2 | port=$1 |
3 | [ -z "$port" ] && port=5300 | |
4 | limit=$2 | |
dfddcdaf | 5 | [ -z "$limit" ] && limit=100000 |
045e4577 OM |
6 | threads=$3 |
7 | [ -z "$threads" ] && threads=2 | |
8 | mthreads=$4 | |
9 | [ -z "$mthreads" ] && mthreads=100 | |
359d6c17 OM |
10 | shards=$5 |
11 | [ -z "$shards" ] && shards=1024 | |
b3bd2e75 | 12 | |
cb99a652 | 13 | : ${RECURSOR:="../pdns/recursordist/pdns_recursor"} |
38645cdf | 14 | : ${RECCONTROL:="../pdns/recursordist/rec_control"} |
923c8ad1 | 15 | : ${CSV:="top-1m.csv"} |
8a27076c | 16 | : ${IPv6:="0"} |
f0f39fda | 17 | : ${TRACE:="fail"} |
ae7072eb | 18 | : ${DNSBULKTEST:="../pdns/dnsbulktest"} |
923c8ad1 PD |
19 | |
20 | if [ $IPv6 = 1 ] | |
21 | then | |
22 | QLA6="::" | |
23 | else | |
24 | QLA6="" | |
25 | fi | |
26 | ||
27 | rm -f recursor.pid pdns_recursor.pid | |
5e94ec93 PD |
28 | /usr/bin/time --format '%Uuser %Ssystem %Eelapsed %PCPU (%Xtext+%Ddata %Mmax)k |
29 | %Iinputs+%Ooutputs (%Fmajor+%Rminor)pagefaults %Wswaps | |
30 | <measurement><name>user CPU seconds</name><value>%U</value></measurement> | |
31 | <measurement><name>system CPU seconds</name><value>%S</value></measurement> | |
32 | <measurement><name>wallclock seconds</name><value>%e</value></measurement> | |
33 | <measurement><name>%% CPU used</name><value>%P</value></measurement> | |
359d6c17 | 34 | ' ${RECURSOR} --daemon=no --local-port=$port --socket-dir=./ --trace=$TRACE --config-dir=. --max-mthreads=$mthreads --query-local-address6="${QLA6}" --threads=$threads --cache-shards=$shards --disable-packetcache > recursor.log 2>&1 & |
b3bd2e75 | 35 | sleep 3 |
045e4577 OM |
36 | |
37 | # warm up the cache | |
38 | echo | |
359d6c17 | 39 | echo === First run with limit=$limit threads=$threads mthreads=$mthreads shards=$shards === |
045e4577 | 40 | ${DNSBULKTEST} --www=false -qe 127.0.0.1 $port $limit < ${CSV} > bulktest.results |
38645cdf OM |
41 | kill -USR1 $(cat pdns_recursor.pid) |
42 | ${RECCONTROL} --socket-dir=. --config-dir=. get-all | |
81cb91db | 43 | # rerun 1 with hot cache |
045e4577 | 44 | echo |
359d6c17 | 45 | echo === Second run with limit=$limit threads=$threads mthreads=$mthreads shards=$shards === |
8a27076c | 46 | ${DNSBULKTEST} --www=false -qe 127.0.0.1 $port $limit < ${CSV} > bulktest.results |
38645cdf OM |
47 | kill -USR1 $(cat pdns_recursor.pid) |
48 | ${RECCONTROL} --socket-dir=. --config-dir=. get-all | |
81cb91db OM |
49 | # rerun 2 with hot cache |
50 | echo | |
359d6c17 | 51 | echo === Third run with limit=$limit threads=$threads mthreads=$mthreads shards=$shards === |
81cb91db | 52 | ${DNSBULKTEST} --www=false -qe 127.0.0.1 $port $limit < ${CSV} > bulktest.results |
38645cdf OM |
53 | kill -USR1 $(cat pdns_recursor.pid) |
54 | ${RECCONTROL} --socket-dir=. --config-dir=. get-all | |
045e4577 | 55 | |
38645cdf | 56 | sleep 1 |
045e4577 OM |
57 | echo |
58 | echo "=== RECURSOR LOG ===" | |
6f556c33 | 59 | cat recursor.log |
045e4577 | 60 | echo "=== END RECURSOR LOG ===" |
38645cdf | 61 | kill $(cat pdns_recursor.pid) |
8e7b1ed4 | 62 | sleep 5 |
dfddcdaf PD |
63 | |
64 | . ./bulktest.results | |
65 | ||
66 | mkdir -p recursor-bulktest | |
67 | rm -f failed_tests passed_tests | |
68 | touch failed_tests passed_tests | |
4108e18b | 69 | : ${THRESHOLD:="95"} |
8a27076c | 70 | |
71 | ANANSWER=$[(100*(${DBT_QUEUED}-${DBT_ERRORS}-${DBT_TIMEOUTS}) )/${DBT_QUEUED}] | |
72 | ||
73 | if [ "$ANANSWER" -ge $THRESHOLD ] | |
dfddcdaf PD |
74 | then |
75 | echo recursor-bulktest >> passed_tests | |
be80e5f9 | 76 | RETVAL=0 |
dfddcdaf PD |
77 | else |
78 | echo recursor-bulktest >> failed_tests | |
be80e5f9 | 79 | RETVAL=1 |
dfddcdaf PD |
80 | fi |
81 | ||
82 | echo "$DBT_OKPERCENTAGE% of domains resolved" > recursor-bulktest/diff | |
6a6d742b | 83 | egrep 'PowerDNS.COM|^<measurement' recursor.log > recursor-bulktest/stdout |
5e94ec93 | 84 | echo "<measurement><name>% domains resolved</name><value>$DBT_OKPERCENTAGE</value></measurement>" >> recursor-bulktest/stdout |
dfddcdaf | 85 | |
dbe48e99 PD |
86 | : ${context:="recursor-bulktest"} |
87 | ||
88 | export context | |
89 | testsdir=. ./toxml | |
be80e5f9 KM |
90 | |
91 | exit $RETVAL |