Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions bench/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
data/
results/
22 changes: 22 additions & 0 deletions bench/00_dnspyre_blocky.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/usr/bin/env bash
# Benchmark blocky (pod published UDP port, see pod.yaml)
set -euo pipefail

# renovate: datasource=docker depName=ghcr.io/tantalor93/dnspyre
DNSPYRE_VER=v3.12.0

args=(
# getent hosts host.containers.internal
--server "169.254.1.2:8053"
--concurrency 1
--duration 60s
--no-distribution
--probability 0.33
https://raw.githubusercontent.com/Tantalor93/dnspyre/master/data/10000-domains
)
podman run \
--name dnspyre \
--interactive \
--tty \
--rm \
"ghcr.io/tantalor93/dnspyre:$DNSPYRE_VER" "${args[@]}"
3 changes: 1 addition & 2 deletions scripts/benchmark.sh → bench/01_dnspyre_upstream.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/usr/bin/env bash
# Benchmark providers
# Benchmark upstream providers
set -euo pipefail

# renovate: datasource=docker depName=ghcr.io/tantalor93/dnspyre
Expand All @@ -24,7 +24,6 @@ for provider in "${providers[@]}"; do
--probability 0.33
https://raw.githubusercontent.com/Tantalor93/dnspyre/master/data/1000-domains
)

podman run \
--name dnspyre \
--interactive \
Expand Down
72 changes: 72 additions & 0 deletions bench/pod.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
---
apiVersion: v1
kind: Pod
metadata:
name: blocky-bench
spec:
initContainers:
- name: config
image: docker.io/mikefarah/yq:4.54.3
securityContext:
runAsUser: 0
command: [sh, -c]
args:
- |
yq '
.upstreams.groups.default = ["127.0.0.1:5301"]
| del(.bootstrapDns)
| del(.blocking)
| del(.dnssec)
| del(.caching)
| .queryLog.type = "none"
' /in/config.yaml > /out/config.yml
volumeMounts:
- name: in-config
mountPath: /in/config.yaml
readOnly: true
- name: config
mountPath: /out
containers:
- name: blocky
image: ghcr.io/0xerr0r/blocky:v0.36.0
env:
- name: GOMAXPROCS
value: "2"
- name: BLOCKY_CONFIG_FILE
value: /config/config.yml
ports:
- name: dns
containerPort: 5353
hostPort: 8053
protocol: UDP
resources:
limits:
cpu: "2"
volumeMounts:
- name: config
mountPath: /config
readOnly: true
# Stub upstream: answers every A query with 10.0.0.1, TTL 1h (so blocky can cache)
- name: stub
image: docker.io/library/alpine:latest
command: [ash, -c]
args:
- |
apk add dnsmasq
exec dnsmasq \
--keep-in-foreground \
--listen-address=127.0.0.1 \
--port=5301 \
--no-resolv \
--no-hosts \
--bind-interfaces \
--cache-size=0 \
--local-ttl=3600 \
--address=/#/10.0.0.1
volumes:
- name: in-config
hostPath:
path: ../config.yaml
type: File
- name: config
emptyDir: {}
18 changes: 18 additions & 0 deletions justfile
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,21 @@ clean:
**/.pytest_cache \
**/.pytype \
**/.mypy_cache

# Start environment to benchmark
[group("benchmark")]
[working-directory: "./bench"]
bench-env:
podman kube play pod.yaml --replace

# Start benchmark
[group("benchmark")]
[working-directory: "./bench"]
bench-run:
bash 00_dnspyre_blocky.sh

# Stop pod used for benchmark
[group("benchmark")]
[working-directory: "./bench"]
bench-stop:
podman kube down pod.yaml
5 changes: 4 additions & 1 deletion renovate.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json"
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"kubernetes": {
"managerFilePatterns": ["/^bench/pod\\.yaml$/"]
}
}
Loading