forked from facebookarchive/treadmill
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Treadmill.cpp
141 lines (111 loc) · 4.19 KB
/
Treadmill.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
/*
* Copyright (c) 2014, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
*/
#include <string>
#include <folly/init/Init.h>
#include <gflags/gflags.h>
#include <glog/logging.h>
// The path to the workload configuration file
DEFINE_string(config_file,
"./examples/flat.json",
"The path to the workload configuration file.");
// The hostname of the server
DEFINE_string(hostname,
"localhost",
"The host to load test.");
DEFINE_string(counter_name,
"",
"Counter to compare against threshold (e.g, foo.bar.count).");
DEFINE_int32(counter_threshold,
-1,
"counter_name value > counter_threshold before sending requests.");
// The number of connections each worker thread handles
DEFINE_int32(number_of_connections,
4,
"The number of connections for each thread worker.");
// The total number of workers
DEFINE_int32(number_of_workers,
1,
"The number of workers.");
// The number of keys in the workload
DEFINE_int64(number_of_keys,
1024,
"The number of keys in the workload.");
// The port number to connect
DEFINE_int32(port,
11211,
"The port on the host to connect to.");
DEFINE_int32(control_port,
23456,
"Port for TreadmillService remote control.");
// The request per second trying to send
DEFINE_int32(request_per_second,
1024,
"The request per second to send.");
// The total testing time in second
DEFINE_int32(runtime,
120,
"The total runtime in seconds.");
// The file to store the JSON output statistics
DEFINE_string(output_file,
"",
"Where to print the json output of statistics.");
// The max number of requests to have outstanding per worker
DEFINE_int32(max_outstanding_requests,
1000,
"The max number of requests to have outstanding per worker.");
// Config filename to pass into the workload in JSON format
DEFINE_string(config_in_file,
"",
"Config filename to pass into the workload in JSON format.");
DEFINE_string(config_in_json,
"",
"Configuration string to be parsed as JSON for the workload. "
"If --config_in_file is also specified, "
"the configs are merged.");
// Config filename to export from the workload in JSON format
DEFINE_string(config_out_file,
"",
"Config filename to export from the workload in JSON format.");
// Comma-separated list of CPU IDs to pin the workers
DEFINE_string(cpu_affinity,
"",
"Comma-separated list of CPU IDs to pin the workers.");
// Default number of calibration samples for continuous statistics
DEFINE_int32(default_calibration_samples,
10,
"Default number of calibration samples for continuous statistics.");
// Default number of warm-up samples for continuous statistics
DEFINE_int32(default_warmup_samples,
10,
"Default number of warm-up samples for continuous statistics.");
// Number of calibration samples for latency statistics
DEFINE_int32(latency_calibration_samples,
1000,
"Number of calibration samples for latency statistics.");
// Number of warm-up samples for latency statistics
DEFINE_int32(latency_warmup_samples,
1000,
"Number of warm-up samples for latency statistics.");
DEFINE_int32(server_port, -1, "Port for fb303 server");
DEFINE_int32(worker_shutdown_delay,
0,
"Seconds to allow for workers to gracefully shutdown");
namespace facebook {
namespace windtunnel {
namespace treadmill {
void init(int argc, char* argv[]) {
// Set the usage information
std::string usage("Treadmill loadtester");
gflags::SetUsageMessage(usage);
folly::init(&argc, &argv);
}
} // namespace treadmill
} // namespace windtunnel
} // namespace facebook