[perryl@ made mentioned it can be done easier still, no tail
needed]
As I was curious what as112 would do in the queries-per-second department I asked a friend to run it on his super duper Macbook Pro (spec++) (of course running Ubuntu).
So I needed him to run the binary as112
, queryperf
and a data file called d
. After copying the files to his laptop, we could benchmark it. But wouldn't it be nicer to download just one binary run it and get the number?
After some Googling I got the following going. First create a shell fragment:
#!/bin/bash
unzip -o $0
( ./as112 &) && sleep 1 && \
./queryperf -s 127.0.0.1 -p 8053 -l 10 -d d && kill -HUP -$$
exit
This has to be specific to your needs (i.e. the names of the files) but the gist is, unzip the zip start the as112
daemon, run queryperf on it and kill the lot. This shell fragment is saved as ~/self
.
To make it work, I go to a directory with queryperf
, as112
and d
in it.
% zip as112.zip as112 queryperf d
adding: as112 (deflated 75%)
adding: queryperf (deflated 63%)
adding: d (deflated 33%)
Concatenate the shell fragment and the zip file.
% cat ~/self as112.zip > a; mv a as112.zip ; chmod +x as112.zip
Sample Run
In an empty directory:
% ./as112.zip
Archive: xx
inflating: as112
inflating: queryperf
inflating: d
DNS Query Performance Testing Tool
Version: $Id: queryperf.c,v 1.12 2007/09/05 07:36:04 marka Exp $
[Status] Processing input data
[Status] Sending queries (beginning with 127.0.0.1)
[Status] Testing complete
Statistics:
Parse input file: multiple times
Run time limit: 10 seconds
Ran through file: 362734 times
Queries sent: 725469 queries
Queries completed: 725469 queries
Queries lost: 0 queries
Queries delayed(?): 0 queries
RTT max: 0.012138 sec
RTT min: 0.000008 sec
RTT average: 0.000207 sec
RTT std deviation: 0.000226 sec
RTT out of range: 0 queries
Percentage completed: 100.00%
Percentage lost: 0.00%
Started at: Sun Jun 23 19:26:13 2013
Finished at: Sun Jun 23 19:26:23 2013
Ran for: 10.000072 seconds
Queries per second: 72546.377666 qps
zsh: hangup ./as112.zip
Download
If you are feeling lucky (bold?), here is the zip (compiled on 64 bit Intel): as112.zip.
See this gist for a small bash script, that implements this.