Files
dns-server/test_dns_perf.sh
Alex Yang cdac4fcf43 update
2026-01-16 11:09:11 +08:00

29 lines
549 B
Bash
Executable File

#!/bin/bash
# DNS性能测试脚本
SERVER="127.0.0.1"
DOMAIN="example.com"
THREADS=10
QUERIES=1000
# 创建临时文件存储进程ID
pids=()
# 运行并发查询
for ((i=1; i<=THREADS; i++)); do
for ((j=1; j<=$((QUERIES/THREADS)); j++)); do
dig @$SERVER $DOMAIN A +short > /dev/null &
pids+=($!)
done
echo "线程 $i 已启动,将执行 $((QUERIES/THREADS)) 个查询"
done
echo "所有查询已启动,等待完成..."
# 等待所有查询完成
for pid in "${pids[@]}"; do
wait $pid
done
echo "所有查询已完成!"