Add --skip option: By default, mutilate tries to maintain a long-term QPS average by issuing requests as quickly as possible until it catches up with where it 'ought' to be. If you give the --skip option, it will instead just skip sending requests that are already late.

This commit is contained in:
Jacob Leverich 2013-03-12 15:27:29 -07:00
parent a8168f28dc
commit 7ca3e57c6d
5 changed files with 27 additions and 8 deletions

View File

@ -6,6 +6,7 @@ class AgentStats {
public:
uint64_t rx_bytes, tx_bytes;
uint64_t gets, sets, get_misses;
uint64_t skips;
double start, stop;
};

View File

@ -256,7 +256,16 @@ void Connection::drive_write_machine(double now) {
issue_something(now);
stats.log_op(op_queue.size());
next_time += iagen->generate();
if (args.skip_given && op_queue.size() >= (size_t) options.depth) {
next_time += iagen->generate();
while (next_time < now) {
stats.skips++;
next_time += iagen->generate();
}
} else {
next_time += iagen->generate();
}
break;

View File

@ -29,7 +29,7 @@ class ConnectionStats {
get_sampler(200), set_sampler(200), op_sampler(100),
#endif
rx_bytes(0), tx_bytes(0), gets(0), sets(0),
get_misses(0), sampling(_sampling) {}
get_misses(0), skips(0), sampling(_sampling) {}
#ifdef USE_ADAPTIVE_SAMPLER
AdaptiveSampler<Operation> get_sampler;
@ -47,6 +47,7 @@ class ConnectionStats {
uint64_t rx_bytes, tx_bytes;
uint64_t gets, sets, get_misses;
uint64_t skips;
double start, stop;
@ -103,6 +104,7 @@ class ConnectionStats {
gets += cs.gets;
sets += cs.sets;
get_misses += cs.get_misses;
skips += cs.skips;
start = cs.start;
stop = cs.stop;
@ -114,6 +116,7 @@ class ConnectionStats {
gets += as.gets;
sets += as.sets;
get_misses += as.get_misses;
skips += as.skips;
start = as.start;
stop = as.stop;

View File

@ -40,17 +40,20 @@ By default, each thread connects to every server."
option "iadist" i "Inter-arrival distribution (distribution). Note: \
The distribution will automatically be adjusted to match the QPS given \
by --qps." string default="exponential"
option "skip" S "Skip transmissions if previous requests are late. This \
harms the long-term QPS average, but reduces spikes in QPS after \
long latency requests."
option "noload" - "Skip database loading."
option "loadonly" - "Load database and then exit."
option "blocking" B "Use blocking epoll(). May increase latency."
option "no_nodelay" D "Don't use TCP_NODELAY."
option "no_nodelay" - "Don't use TCP_NODELAY."
option "warmup" w "Warmup time before starting measurement." int
option "wait" W "Time to wait after startup to start measurement." int
option "search" S "Search for the QPS where N-order statistic < Xus. \
option "search" - "Search for the QPS where N-order statistic < Xus. \
(i.e. --search 95:1000 means find the QPS where 95% of requests are \
faster than 1000us)." string typestr="N:X"
option "scan" - "Scan latency across QPS rates from min to max."
@ -65,7 +68,7 @@ option "measure_connections" C "Master client connections per server, \
overrides --connections." int
option "measure_qps" Q "Explicitly set master client QPS, \
spread across threads and connections." int
option "measure_depth" - "Set master client depth." int
option "measure_depth" D "Set master client connection depth." int
text "
The --measure_* options aid in taking latency measurements of the

View File

@ -210,6 +210,7 @@ void agent() {
as.get_misses = stats.get_misses;
as.start = stats.start;
as.stop = stats.stop;
as.skips = stats.skips;
string req = s_recv(socket);
// V("req = %s", req.c_str());
@ -570,16 +571,18 @@ int main(int argc, char **argv) {
int total = stats.gets + stats.sets;
printf("\nTotal QPS = %.1f (%d / %.1fs)\n\n",
printf("\nTotal QPS = %.1f (%d / %.1fs)\n",
total / (stats.stop - stats.start),
total, stats.stop - stats.start);
if (args.search_given && peak_qps > 0.0)
printf("Peak QPS = %.1f\n\n", peak_qps);
printf("Peak QPS = %.1f\n\n", peak_qps);
printf("Misses = %" PRIu64 " (%.1f%%)\n\n", stats.get_misses,
printf("Misses = %" PRIu64 " (%.1f%%)\n", stats.get_misses,
(double) stats.get_misses/stats.gets*100);
printf("Skipped TXs = %" PRIu64 "\n\n", stats.skips);
printf("RX %10" PRIu64 " bytes : %6.1f MB/s\n",
stats.rx_bytes,
(double) stats.rx_bytes / 1024 / 1024 / (stats.stop - stats.start));