From ce39630bda121e0a533360da555897b120caf6ca Mon Sep 17 00:00:00 2001 From: Remi Gacogne Date: Fri, 11 May 2018 16:20:47 +0200 Subject: [PATCH] calidns: Add an option to stop once we drop below a minimum rate --- docs/manpages/calidns.1.rst | 22 ++++++++++--------- pdns/calidns.cc | 44 ++++++++++++++++++++++++++++++------- 2 files changed, 48 insertions(+), 18 deletions(-) diff --git a/docs/manpages/calidns.1.rst b/docs/manpages/calidns.1.rst index 98ffffe90..96ee6fa39 100644 --- a/docs/manpages/calidns.1.rst +++ b/docs/manpages/calidns.1.rst @@ -32,13 +32,15 @@ This is similar to Alexa top 1 million list. Options ------- ---ecs Add EDNS Client Subnet option to outgoing queries using random - addresses from the specified *SUBNET* range (IPv4 only). ---ecs-from-file Read IP or subnet values from the query file and add them as EDNS - Client Subnet option to outgoing queries. ---increment On every subsequent run, multiply the number of queries per second - by *NUM*. By default, this is 1.1. ---maximum-qps Stop incrementing once this rate has been reached, to provide a - stable load. ---plot-file Write results to the specified file. ---want-recursion Set this flag to send queries with the Recursion Desired flag set. +--ecs Add EDNS Client Subnet option to outgoing queries using random + addresses from the specified *SUBNET* range (IPv4 only). +--ecs-from-file Read IP or subnet values from the query file and add them as EDNS + Client Subnet option to outgoing queries. +--increment On every subsequent run, multiply the number of queries per second + by *NUM*. By default, this is 1.1. +--maximum-qps Stop incrementing once this rate has been reached, to provide a + stable load. +--minimum-success-rate Stop the test as soon as the success rate drops below this value, + in percent. +--plot-file Write results to the specified file. +--want-recursion Set this flag to send queries with the Recursion Desired flag set. diff --git a/pdns/calidns.cc b/pdns/calidns.cc index 0c1526041..90dbfa90c 100644 --- a/pdns/calidns.cc +++ b/pdns/calidns.cc @@ -225,6 +225,7 @@ try ("ecs-from-file", "Read IP or subnet values from the query file and add them as EDNS Client Subnet options to outgoing queries") ("increment", po::value()->default_value(1.1), "Set the factor to increase the QPS load per run") ("maximum-qps", po::value(), "Stop incrementing once this rate has been reached, to provide a stable load") + ("minimum-success-rate", po::value()->default_value(0), "Stop the test as soon as the success rate drops below this value, in percent") ("plot-file", po::value(), "Write results to the specific file") ("want-recursion", "Set the Recursion Desired flag on queries"); po::options_description alloptions; @@ -283,6 +284,12 @@ try maximumQps = g_vm["maximum-qps"].as(); } + double minimumSuccessRate = g_vm["minimum-success-rate"].as(); + if (minimumSuccessRate > 100.0 || minimumSuccessRate < 0.0) { + cerr<<"Minimum success rate must be between 0 and 100, not "<()); string line; @@ -388,6 +396,9 @@ try } } + double bestQPS = 0.0; + double bestPerfectQPS = 0.0; + for(qps=qpsstart;;) { double seconds=1; cout<<"Aiming at "< unknown.size()) { cerr<<"Not enough queries remaining (need at least "<*> toSend; unsigned int n; @@ -421,22 +432,39 @@ try sendPackets(&sockets, toSend, qps, dest, ecsRange); - auto udiff = dt.udiff(); - auto realqps=toSend.size()/(udiff/1000000.0); - cout<<"Achieved "< 0.0 && perc < minimumSuccessRate) { + cout<<"The latest success rate ("<= 100.0) { + bestPerfectQPS = std::max(bestPerfectQPS, realReceivedQPS); + } } if (plot) { -- 2.40.0