github 地址:https://github.com/DNS-OARC/dnsperfgit
mac安裝:brew install dnsperfgithub
參數詳解服務器
Dnsperf 支持下面的這些命令行參數:併發
-s 用來指定DNS服務器的IP地址,默認值是127.0.0.1
-p 用來指定DNS服務器的端口,默認值是53
-d 用來指定DNS消息的內容文件,該文件中包含要探測的域名和資源記錄類型,見下文
-t 用來指定每一個請求的超時時間,默認值是3000ms
-Q 用來指定本次壓測的最大請求數,默認值是1000
-c 用來指定併發探測數,默認值是100. dnsperf會從-d指定的文件中隨機選取100個座位探測域名來發送DNS請求.
-l 用來指定本次壓測的時間,默認值是無窮大。
-e 本選項經過EDNS0,在OPT資源記錄中運用edns-client-subnet來指定真實的client ip. app
-P 指定用哪一個傳輸層協議發送DNS請求,udp或者tcp。默認值是udp
-f 指定用什麼地址類型發送DNS請求,inet或者inet6。默認值是inet
-v 除了標準的輸出外,還輸出每一個相應碼的個數。
-h 打印幫助socket
-f address family of DNS transport, inet or inet6 (default: any)
-s the server to query (default: 127.0.0.1)
-p the port on which to query the server (default: 53)
-a the local address from which to send queries
-x the local port from which to send queries (default: 0)
-d the input data file (default: stdin)
-c the number of clients to act as
-T the number of threads to run
-n run through input at most N times
-l run for at most this many seconds
-b socket send/receive buffer size in kilobytes
-t the timeout for query completion in seconds (default: 5)
-e enable EDNS 0
-E send EDNS option
-D set the DNSSEC OK bit (implies EDNS)
-y the TSIG algorithm, name and secret
-q the maximum number of queries outstanding (default: 100)
-Q limit the number of queries per second
-S print qps statistics every N seconds
-u send dynamic updates instead of queries
-v verbose: report each query to stdouttcp
數據文件示例:性能
上文中提到,-d選項指定數據文件名,數據文件示例以下:this
1
2
3
|
# This is a comment and is ommited
# The columns after column 2 will be ommited if one line contains more than 3 colums.
www.app1.com A
|
數據文件中以「#」開頭的行被認爲是註釋行,會被dnsperf忽略。spa
其中有效數據由兩列組成,第一列是查詢域名,第二列是查詢的資源類型,dnsperf支持的資源類型以下:
A
,NS
,MD
,MF
,CNAME
,SOA
,MB
,MG
,MR
,NULL
,WKS
,PTR
,HINFO
,MINFO
,MX
,TXT
,AAAA
,SRV
,NAPTR
,A6
,ASFR
,MAILB
,MAILA
,ANY
.
若是請求不少次,要寫入很是多域名,如
性能評測指標
下圖是一個示例輸出:
1
2
3
4
5
6
7
8
9
10
11
12
13
|
DNS Performance Testing Tool
[Status] Processing query data
[Status] Sending queries to 127.0.0.1:53
time
up
[Status]DNS Query Performance Testing Finish
[Result]Quries sent: 35650
[Result]Quries completed: 35578
[Result]Complete percentage: 99.80%
[Result]Elapsed
time
(s): 1.00000
[Result]Queries Per Second: 35650.0000
|
標準輸出中,queies sent是指本次探測發送的總請求數,queries completed是指本次探測收到響應的請求數,complete percentage是指本次探測的成功率(queies_completed/queries_sent),elapsed time是指本次探測的時間,queries per second是指本次探測的QPS。