Skip to content

Instantly share code, notes, and snippets.

@k-oguma
Created February 3, 2017 07:42
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save k-oguma/d80386d7caa3f6f0708c2c2390fe3ff6 to your computer and use it in GitHub Desktop.
DNS Benchmark (Child forks + Parallel support)
#!/bin/sh
set -m
hostname="ns1"
domain="example.local"
target_dns="dns-unbound01"
query_count=3
forks=200
for i in `seq $forks`
do
for ((i=1; i \<\= ${query_count};i++))
do
dig ${hostname}.${domain} @${target_dns}
done &
done
# Wait for all parallel jobs to finish
while [ 1 ]; do fg 2> /dev/null; [ $? == 1 ] && break; done
#!/bin/sh
set -m
hostname="ns2"
domain="example.local"
target_dns="dns-unbound01"
query_count=3
forks=200
for i in `seq $forks`
do
for ((i=1; i \<\= ${query_count};i++))
do
dig ${hostname}.${domain} @${target_dns}
done &
done
# Wait for all parallel jobs to finish
while [ 1 ]; do fg 2> /dev/null; [ $? == 1 ] && break; done
time parallel --gnu --eta -j $(lscpu | awk '$1~/CPU\(s\):/{print $2}') ::: ./dns-bench*.sh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment