Skip to content

Commit d58c627

Browse files
committed
Switched to lts/ubuntu
1 parent 58fbd90 commit d58c627

File tree

3 files changed

+25
-120
lines changed

3 files changed

+25
-120
lines changed

Dockerfile

+14-31
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,20 @@
1-
FROM public.ecr.aws/docker/library/alpine:3.21
1+
# Release info:
2+
# - https://github.com/DNS-OARC/dnsperf/releases/tag/v2.14.0
3+
# - https://dev.dns-oarc.net/packages/
4+
# - https://launchpad.net/~dns-oarc/+archive/ubuntu/dnsperf
25

3-
ENV CONCURRENCY_KIT_VERSION 0.7.2
4-
ENV DNSPERF_VERSION 2.14.0
6+
FROM public.ecr.aws/lts/ubuntu:24.04_stable AS builder
57

6-
RUN apk add --no-cache \
7-
bind \
8-
bind-dev \
9-
g++ \
10-
json-c-dev \
11-
krb5-dev \
12-
libcap-dev \
13-
libxml2-dev \
14-
make \
15-
nghttp2-dev \
16-
openssl-dev
8+
ENV DEBIAN_FRONTEND=noninteractive
9+
ENV TZ="Etc/UTC"
1710

18-
WORKDIR /opt
19-
20-
# http://concurrencykit.org/
21-
ADD https://github.com/concurrencykit/ck/archive/refs/tags/${CONCURRENCY_KIT_VERSION}.tar.gz /opt/
22-
RUN tar -zxf /opt/${CONCURRENCY_KIT_VERSION}.tar.gz -C /opt/ \
23-
&& cd ck-${CONCURRENCY_KIT_VERSION} \
24-
&& ./configure && make install clean && cd .. \
25-
&& rm -rvf ck-${CONCURRENCY_KIT_VERSION} \
26-
&& rm -rvf /opt/${CONCURRENCY_KIT_VERSION}.tar.gz
27-
28-
# https://www.dns-oarc.net/tools/dnsperf
29-
ADD https://www.dns-oarc.net/files/dnsperf/dnsperf-${DNSPERF_VERSION}.tar.gz /opt/
30-
RUN tar -zxf /opt/dnsperf-${DNSPERF_VERSION}.tar.gz -C /opt/ \
31-
&& cd /opt/dnsperf-${DNSPERF_VERSION} \
32-
&& ./configure && make install distclean && cd .. \
33-
&& rm -rvf /opt/dnsperf-${DNSPERF_VERSION} \
34-
&& rm -rvf /opt/dnsperf-${DNSPERF_VERSION}.tar.gz
11+
RUN apt update \
12+
&& apt install software-properties-common --no-install-recommends -y \
13+
&& add-apt-repository ppa:dns-oarc/dnsperf \
14+
&& apt update \
15+
&& apt install dnsperf --no-install-recommends -y \
16+
&& apt clean
3517

3618
ADD entrypoint.sh /
19+
3720
ENTRYPOINT ["/entrypoint.sh"]

entrypoint.sh

+7-66
Original file line numberDiff line numberDiff line change
@@ -1,60 +1,8 @@
11
#!/bin/sh
22

3-
DNSPERF_BINARY="/usr/local/bin/dnsperf"
3+
DNSPERF_BINARY="/usr/bin/dnsperf"
44

5-
# -----------------------------------------------------------------------------
6-
# Command output of "dnsperf --help"
7-
# -----------------------------------------------------------------------------
8-
#
9-
# DNS Performance Testing Tool
10-
# Version 2.14.0
11-
#
12-
# Usage: dnsperf [-f family] [-m mode] [-s server_addr] [-p port]
13-
# [-a local_addr] [-x local_port] [-d datafile] [-c clients]
14-
# [-T threads] [-n maxruns] [-l timelimit] [-b buffer_size]
15-
# [-t timeout] [-e] [-E code:value] [-D]
16-
# [-y [alg:]name:secret] [-q num_queries] [-Q max_qps]
17-
# [-S stats_interval] [-u] [-B] [-v] [-W] [-h] [-H] [-O]
18-
# -f address family of DNS transport, inet or inet6 (default: any)
19-
# -m set transport mode: udp, tcp, dot or doh (default: udp)
20-
# -s the server to query (default: 127.0.0.1)
21-
# -p the port on which to query the server (default: udp/tcp 53, DoT 853 or DoH 443)
22-
# -a the local address from which to send queries
23-
# -x the local port from which to send queries (default: 0)
24-
# -d the input data file (default: stdin)
25-
# -c the number of clients to act as
26-
# -T the number of threads to run
27-
# -n run through input at most N times
28-
# -l run for at most this many seconds
29-
# -b socket send/receive buffer size in kilobytes
30-
# -t the timeout for query completion in seconds (default: 5)
31-
# -e enable EDNS 0
32-
# -E send EDNS option
33-
# -D set the DNSSEC OK bit (implies EDNS)
34-
# -y the TSIG algorithm, name and secret (base64)
35-
# -q the maximum number of queries outstanding (default: 100)
36-
# -Q limit the number of queries per second
37-
# -S print qps statistics every N seconds
38-
# -u send dynamic updates instead of queries
39-
# -B read input file as TCP-stream binary format
40-
# -v verbose: report each query and additional information to stdout
41-
# -W log warnings and errors to stdout instead of stderr
42-
# -h print this help
43-
# -H print long options help
44-
# -O set long options: <name>=<value>
45-
#
46-
# -----------------------------------------------------------------------------
47-
48-
ADDRESS_FAMILY="${ADDRESS_FAMILY:-any}"
49-
TRANSPORT_MODE="${TRANSPORT_MODE:-udp}"
50-
DNS_SERVER_ADDR="${DNS_SERVER_ADDR:-10.100.0.10}"
51-
DNS_SERVER_PORT=${DNS_SERVER_PORT:-53}
52-
DNSPERF_RECORDS_INPUT="/opt/records.txt"
53-
MAX_CLIENTS="${MAX_CLIENTS:-1}"
54-
MAX_THREADS="${MAX_THREADS:-1}"
55-
MAX_TEST_SECONDS="${MAX_TEST_SECONDS:-60}"
56-
TIMEOUT_FOR_QUERY="${TIMEOUT_FOR_QUERY:-5}"
57-
MAX_QPS="${MAX_QPS:-1000}"
5+
DNS_SERVER_ADDR=$(/usr/bin/awk '/^nameserver/{print$2}' /etc/resolv.conf)
586

597
${DNSPERF_BINARY} -h 2>&1 | head -n 2
608

@@ -63,18 +11,11 @@ if [ ! -f "${DNSPERF_RECORDS_INPUT}" ]; then
6311
exit 1
6412
fi
6513

66-
echo "[debug] bench start"
14+
echo "[debug] dnsperf benchmark start"
15+
echo "[debug] DNS_SERVER_ADDR -> ${DNS_SERVER_ADDR}"
16+
echo "[debug] EXTRA_ARGS -> ${EXTRA_ARGS}"
17+
echo "[debug] DNSPERF_RECORDS_INPUT -> ${DNSPERF_RECORDS_INPUT}"
6718

6819
while true; do
69-
${DNSPERF_BINARY} \
70-
-f ${ADDRESS_FAMILY} \
71-
-m ${TRANSPORT_MODE} \
72-
-s ${DNS_SERVER_ADDR} \
73-
-p ${DNS_SERVER_PORT} \
74-
-d ${DNSPERF_RECORDS_INPUT} \
75-
-c ${MAX_CLIENTS} \
76-
-T ${MAX_THREADS} \
77-
-l ${MAX_TEST_SECONDS} \
78-
-t ${TIMEOUT_FOR_QUERY} \
79-
-Q ${MAX_QPS}
20+
${DNSPERF_BINARY} -s ${DNS_SERVER_ADDR} -d ${DNSPERF_RECORDS_INPUT} ${EXTRA_ARGS}
8021
done

k8s-dnsperf-bench.yaml

+4-23
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ metadata:
2020
name: dnsperf
2121
namespace: default
2222
spec:
23-
progressDeadlineSeconds: 600
2423
replicas: 1
2524
selector:
2625
matchLabels:
@@ -31,30 +30,12 @@ spec:
3130
app: dnsperf
3231
spec:
3332
containers:
34-
- env:
35-
# please replace the DNS_SERVER_ADDR/DNS_SERVER_PORT according to the command output
36-
# - kubectl get -n kube-system svc kube-dns -o go-template='{{.spec.clusterIP}}{{"\n"}}'
37-
- name: ADDRESS_FAMILY
38-
value: "any"
39-
- name: TRANSPORT_MODE
40-
value: "udp"
41-
- name: DNS_SERVER_ADDR
42-
value: "10.100.0.10"
43-
- name: DNS_SERVER_PORT
44-
value: "53"
45-
- name: MAX_CLIENTS
46-
value: "1"
47-
- name: MAX_THREADS
48-
value: "1"
49-
- name: MAX_TEST_SECONDS
50-
value: "30"
51-
- name: TIMEOUT_FOR_QUERY
52-
value: "5"
53-
- name: MAX_QPS
54-
value: "100000"
33+
- name: dnsperf
5534
image: guessi/dnsperf
5635
imagePullPolicy: Always
57-
name: dnsperf
36+
env:
37+
- name: EXTRA_ARGS
38+
value: ""
5839
volumeMounts:
5940
- mountPath: /opt/
6041
name: dns-records-volume

0 commit comments

Comments
 (0)