update
This commit is contained in:
28
dns/test_dns_perf.sh
Executable file
28
dns/test_dns_perf.sh
Executable file
@@ -0,0 +1,28 @@
|
||||
#!/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 "所有查询已完成!"
|
||||
Reference in New Issue
Block a user