Repository navigation
Expand file tree
/
Copy pathyab.html
More file actions
629 lines (433 loc) · 17.8 KB
/
Copy pathyab.html
File metadata and controls
629 lines (433 loc) · 17.8 KB
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
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
<!-- Creator : groff version 1.19.2 -->
<!-- CreationDate: Thu Sep 5 16:51:11 2019 -->
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta name="generator" content="groff -Thtml, see www.gnu.org">
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
<meta name="Content-Style" content="text/css">
<style type="text/css">
p { margin-top: 0; margin-bottom: 0; }
pre { margin-top: 0; margin-bottom: 0; }
table { margin-top: 0; margin-bottom: 0; }
</style>
<title>yab</title>
</head>
<body>
<h1 align=center>yab</h1>
<a href="#NAME">NAME</a><br>
<a href="#SYNOPSIS">SYNOPSIS</a><br>
<a href="#DESCRIPTION">DESCRIPTION</a><br>
<a href="#OPTIONS">OPTIONS</a><br>
<hr>
<a name="NAME"></a>
<h2>NAME</h2>
<p style="margin-left:11%; margin-top: 1em">yab − yet
another benchmarker</p>
<a name="SYNOPSIS"></a>
<h2>SYNOPSIS</h2>
<p style="margin-left:11%; margin-top: 1em"><b>yab</b>
[<service> <method> <body>] [OPTIONS]</p>
<a name="DESCRIPTION"></a>
<h2>DESCRIPTION</h2>
<p style="margin-left:11%; margin-top: 1em">yab is a
benchmarking tool for TChannel and HTTP applications.
It’s primarily intended for Thrift applications but
supports other encodings like JSON and binary (raw). It can
be used in a curl-like fashion when benchmarking features
are disabled.</p>
<p style="margin-left:11%; margin-top: 1em">yab includes a
full man page (man yab), which is also available online:
http://yarpc.github.io/yab/man.html</p>
<p style="margin-left:11%; margin-top: 1em">Default options
can be specified in a ~/.config/yab/defaults.ini file (or
~/Library/Preferences/yab/defaults.ini on Mac) with contents
similar to this:</p>
<p style="margin-left:22%; margin-top: 1em">[request] <br>
timeout = 2s</p>
<p style="margin-left:22%; margin-top: 1em">[transport]
<br>
peer-list = "/path/to/peer/list.json"</p>
<p style="margin-left:22%; margin-top: 1em">[benchmark]
<br>
warmup = 10</p>
<a name="OPTIONS"></a>
<h2>OPTIONS</h2>
<p style="margin-left:11%; margin-top: 1em"><b>Application
Options</b></p>
<table width="100%" border=0 rules="none" frame="void"
cellspacing="0" cellpadding="0">
<tr valign="top" align="left">
<td width="11%"></td>
<td width="3%">
<p valign="top"><b>−v</b></p></td>
<td width="8%"></td>
<td width="78%">
<p valign="top">Enable more detailed logging. Repeats
increase the verbosity, ie. -vvv</p></td>
</table>
<p style="margin-left:11%;"><b>−−version</b></p>
<p style="margin-left:22%;">Displays the application
version</p>
<p style="margin-left:11%; margin-top: 1em"><b>Request
Options</b> <br>
Configures the request data and the encoding.</p>
<p style="margin-left:11%; margin-top: 1em">To make Thrift
requests, specify a Thrift file and pass the Thrift service
and procedure to the method argument (-m or --method) as
Service::Method.</p>
<p style="margin-left:22%; margin-top: 1em">$ yab -p
localhost:9787 kv -t kv.thrift -m KeyValue::Count -r
’{}’</p>
<p style="margin-left:11%; margin-top: 1em">You can also
use positional arguments to specify the method and body:</p>
<p style="margin-left:22%; margin-top: 1em">$ yab -p
localhost:9787 -t kv.thrift kv KeyValue::Count
’{}’</p>
<p style="margin-left:11%; margin-top: 1em">The TChannel
health endpoint can be hit without specifying a Thrift file
by passing --health.</p>
<p style="margin-left:11%; margin-top: 1em">Thrift requests
can be specified as JSON or YAML. For example, for a method
defined as:</p>
<p style="margin-left:22%; margin-top: 1em">void addUser(1:
string name, 2: i32 age)</p>
<p style="margin-left:11%; margin-top: 1em">You can pass
the request as JSON: {"name":
"Prashant", age: 100} or as YAML:</p>
<p style="margin-left:22%; margin-top: 1em">name: Prashant
<br>
age: 100</p>
<p style="margin-left:11%; margin-top: 1em">The request
body can be specified on the command line using -r or
--request:</p>
<p style="margin-left:22%; margin-top: 1em">$ yab -p
localhost:9787 -t kv.thrift kv \ <br>
KeyValue::Get -r ’{"key":
"hello"}’</p>
<p style="margin-left:11%; margin-top: 1em">Or it can be
loaded from a file using -f or --file:</p>
<p style="margin-left:22%; margin-top: 1em">$ yab -p
localhost:9787 -t kv.thrift kv KeyValue::Get --file
req.yaml</p>
<p style="margin-left:11%; margin-top: 1em">To make a proto
requrest, specify a compiled FileDescriptorSet and pass the
fully qualified service an method name as procedure.</p>
<p style="margin-left:22%; margin-top: 1em">$ yab -p
localhost:5435 --file-descriptor-set-bin proto.bin \ <br>
service package.Service/Method -r ’{"key":
"value"}’</p>
<p style="margin-left:11%; margin-top: 1em">A
FileDescriptorSet can be generated using the
8000
--descriptor_set_out= flag in protoc.</p>
<p style="margin-left:11%; margin-top: 1em">Request options
can also be specified in a YAML file, e.g., get.yab:</p>
<p style="margin-left:22%; margin-top: 1em">service: kv
<br>
peer: localhost:9787 <br>
method: KeyValue::get <br>
thrift: kv.thrift <br>
request: <br>
key: hello</p>
<p style="margin-left:11%; margin-top: 1em">The above YAML
file represents the same request as the command above, and
can be run using yab -y get.yab.</p>
<p style="margin-left:11%; margin-top: 1em">You can make
the request by directly executing the file (./get.yab) if
you add a shebang and mark the file as executable:</p>
<p style="margin-left:22%; margin-top: 1em">#!/usr/bin/env
yab</p>
<p style="margin-left:22%; margin-top: 1em">service: kv
<br>
peer: localhost:9787 <br>
method: KeyValue::get <br>
thrift: kv.thrift <br>
request: <br>
key: hello</p>
<p style="margin-left:11%; margin-top: 1em">YAML templates
can use arguments using ${ARGNAME:default_value} in the
body, which can be specified on the command line using -A.
If an argument is not specified on the command line, then
the default value is used. For example, we can update the
YAML template to take an argument for the key:</p>
<p style="margin-left:22%; margin-top: 1em">#!/usr/bin/env
yab</p>
<p style="margin-left:22%; margin-top: 1em">service: kv
<br>
peer: localhost:9787 <br>
method: KeyValue::get <br>
thrift: kv.thrift <br>
request: <br>
key: ${key:hello}</p>
<p style="margin-left:11%; margin-top: 1em">If no key is
specified on the command line, the default value of
"hello" is used as the key. However we can specify
the key on the command line:</p>
<p style="margin-left:22%; margin-top: 1em">$ ./get.yab -A
key:world</p>
<p style="margin-left:11%; margin-top: 1em">A YAML template
may have multiple keys and multiple keys can be specified on
the command line:</p>
<p style="margin-left:22%; margin-top: 1em">$ ./set.yab -A
key:hello -A value:world</p>
<p style="margin-left:11%; margin-top: 1em">Binary data can
be specified in one of many ways:</p>
<table width="100%" border=0 rules="none" frame="void"
cellspacing="0" cellpadding="0">
<tr valign="top" align="left">
<td width="11%"></td>
<td width="1%">
<p style="margin-top: 1em" valign="top">•</p></td>
<td width="10%"></td>
<td width="78%">
<p style="margin-top: 1em" valign="top">As a string or an
array of bytes: "data" or [100, 97, 116, 97]</p></td>
<tr valign="top" align="left">
<td width="11%"></td>
<td width="1%">
<p style="margin-top: 1em" valign="top">•</p></td>
<td width="10%"></td>
<td width="78%">
<p style="margin-top: 1em" valign="top">As base64:
{"base64": "ZGF0YQ=="}</p></td>
<tr valign="top" align="left">
<td width="11%"></td>
<td width="1%">
<p style="margin-top: 1em" valign="top">•</p></td>
<td width="10%"></td>
<td width="78%">
<p style="margin-top: 1em" valign="top">Loaded from a file:
{"file": "data.bin"}</p></td>
</table>
<p style="margin-left:11%; margin-top: 1em">Examples:</p>
<p style="margin-left:22%; margin-top: 1em">$ yab -p
localhost:9787 -t kv.thrift kv -m KeyValue::Set \ <br>
-r ’{"key": "hello",
"value": [100, 97, 116, 97]}’</p>
<p style="margin-left:22%; margin-top: 1em">$ yab -p
localhost:9787 -t kv.thrift kv KeyValue::Set \ <br>
-r ’{"key": "hello",
"value": {"file":
"data.bin"}}’</p>
<p style="margin-left:11%;"><b>−e</b>,
<b>−−encoding</b></p>
<p style="margin-left:22%;">The encoding of the data,
options are: Thrift, proto, JSON, raw. Defaults to Thrift if
the method contains ’::’ or a Thrift file is
specified. Defaults to proto if the method contains
’/’ or a proto filedescriptorset is
specified</p>
<p style="margin-left:11%;"><b>−t</b>,
<b>−−thrift</b></p>
<p style="margin-left:22%;">Path of the .thrift file</p>
<p style="margin-left:11%;"><b>−F</b>,
<b>−−file-descriptor-set-bin</b></p>
<p style="margin-left:22%;">A binary file containing a
compiled protobuf FileDescriptorSet.</p>
<p style="margin-left:11%;"><b>−−procedure</b></p>
<p style="margin-left:22%;">The full method name to invoke
(Thrift: Svc::Method, Proto: package.Service/Method).</p>
<p style="margin-left:11%;"><b>−m</b>,
<b>−−method</b></p>
<p style="margin-left:22%;">Alias for procedure</p>
<p style="margin-left:11%;"><b>−r</b>,
<b>−−request</b></p>
<p style="margin-left:22%;">The request body, in JSON or
YAML format</p>
<p style="margin-left:11%;"><b>−f</b>,
<b>−−file</b></p>
<p style="margin-left:22%;">Path of a file containing the
request body in JSON or YAML</p>
<p style="margin-left:11%;"><b>−H</b>,
<b>−−header</b></p>
<p style="margin-left:22%;">Individual application header
as a key:value pair per flag</p>
<p style="margin-left:11%;"><b>−−headers</b></p>
<p style="margin-left:22%;">The headers in JSON or YAML
format</p>
<p style="margin-left:11%;"><b>−−headers-file</b></p>
<p style="margin-left:22%;">Path of a file containing the
headers in JSON or YAML</p>
<p style="margin-left:11%;"><b>−B</b>,
<b>−−baggage</b></p>
<p style="margin-left:22%;">Individual context baggage
header as a key:value pair per flag</p>
<p style="margin-left:11%;"><b>−−health</b></p>
<p style="margin-left:22%;">Hit the health endpoint,
Meta::health</p>
<p style="margin-left:11%;"><b>−−timeout</b></p>
<p style="margin-left:22%;">The timeout for each request.
E.g., 100ms, 0.5s, 1s. If no unit is specified, milliseconds
are assumed.</p>
<p style="margin-left:11%;"><b>−y</b>,
<b>−−yaml-template</b></p>
<p style="margin-left:22%;">Send a tchannel request
specified by a YAML template</p>
<p style="margin-left:11%;"><b>−A</b>,
<b>−−arg</b></p>
<p style="margin-left:22%;">A list of key-value template
arguments, specified as -A foo:bar -A user:me</p>
<p style="margin-left:11%;"><b>−−disable-thrift-envelope</b></p>
<p style="margin-left:22%;">Disables Thrift envelopes
(disabled by default for TChannel and gRPC)</p>
<p style="margin-left:11%;"><b>−−multiplexed-thrift</b></p>
<p style="margin-left:22%;">Enables the Thrift
TMultiplexedProtocol used by services that host multiple
Thrift services on a single endpoint.</p>
<p style="margin-left:11%; margin-top: 1em"><b>Transport
Options</b> <br>
Configures the network transport used to make requests.</p>
<p style="margin-left:11%; margin-top: 1em">yab can target
both TChannel and HTTP endpoints. To specify a TChannel
endpoint, specify the peer’s host and port:</p>
<p style="margin-left:22%; margin-top: 1em">$ yab -p
localhost:9787 [options]</p>
<p style="margin-left:11%; margin-top: 1em">or</p>
<p style="margin-left:22%; margin-top: 1em">$ yab -p
tchannel://localhost:9787 [options]</p>
<p style="margin-left:11%; margin-top: 1em">For HTTP
endpoints, specify the URL as the peer,</p>
<p style="margin-left:22%; margin-top: 1em">$ yab -p
http://localhost:8080/thrift [options]</p>
<p style="margin-left:11%; margin-top: 1em">The
Thrift-encoded body will be POSTed to the specified URL.</p>
<p style="margin-left:11%; margin-top: 1em">Multiple peers
can be specified using a peer list using -P or --peer-list.
When making a single request, a single peer from this list
is selected randomly. When benchmarking, connections will be
established in a round-robin fashion, starting with a random
peer.</p>
<p style="margin-left:22%; margin-top: 1em">$ yab
--peer-list hosts.json [options]</p>
<p style="margin-left:11%;"><b>−s</b>,
<b>−−service</b></p>
<p style="margin-left:22%;">The TChannel/Hyperbahn service
name</p>
<p style="margin-left:11%;"><b>−p</b>,
<b>−−peer</b></p>
<p style="margin-left:22%;">The host:port of the service to
call</p>
<p style="margin-left:11%;"><b>−P</b>,
<b>−−peer-list</b></p>
<p style="margin-left:22%;">Path or URL of a JSON, YAML, or
flat file containing a list of host:ports. -P? for supported
protocols.</p>
<p style="margin-left:11%;"><b>−−caller</b></p>
<p style="margin-left:22%;">Caller will override the
default caller name (which is yab-$USER).</p>
<table width="100%" border=0 rules="none" frame="void"
cellspacing="0" cellpadding="0">
<tr valign="top" align="left">
<td width="11%"></td>
<td width="6%">
<p style="margin-top: 1em" valign="top"><b>−−rk</b></p> </td>
<td width="5%"></td>
<td width="78%">
<p style="margin-top: 1em" valign="top">The routing key
overrides the service name traffic group for proxies.</p></td>
<tr valign="top" align="left">
<td width="11%"></td>
<td width="6%">
<p style="margin-top: 1em" valign="top"><b>−−rd</b></p> </td>
<td width="5%"></td>
<td width="78%">
<p style="margin-top: 1em" valign="top">The routing
delegate overrides the routing key traffic group for
proxies.</p> </td>
<tr valign="top" align="left">
<td width="11%"></td>
<td width="6%">
<p style="margin-top: 1em" valign="top"><b>−−sk</b></p> </td>
<td width="5%"></td>
<td width="78%">
<p style="margin-top: 1em" valign="top">The shard key is a
transport header that clues where to send a request within a
clustered traffic group.</p></td>
</table>
<p style="margin-left:11%;"><b>−−jaeger</b></p>
<p style="margin-left:22%;">Use the Jaeger tracing client
to send Uber style traces and baggage headers</p>
<p style="margin-left:11%;"><b>−T</b>,
<b>−−topt</b></p>
<p style="margin-left:22%;">Transport options for TChannel,
protocol headers for HTTP</p>
<p style="margin-left:11%;"><b>−−http-method</b></p>
<p style="margin-left:22%;">The HTTP method to use</p>
<p style="margin-left:11%; margin-top: 1em"><b>Benchmark
Options</b> <br>
Configures benchmarking, which is disabled by default.</p>
<p style="margin-left:11%; margin-top: 1em">By default, yab
will only make a single request. To enable benchmarking,
specify the maximum duration for the benchmark by passing -d
or --max-duration.</p>
<p style="margin-left:11%; margin-top: 1em">yab will make
requests until either the maximum requests (-n or
--max-requests) or the maximum duration is reached.</p>
<p style="margin-left:11%; margin-top: 1em">You can control
the rate at which yab makes requests using the --rps
flag.</p>
<p style="margin-left:11%; margin-top: 1em">An example
benchmark command might be:</p>
<p style="margin-left:22%; margin-top: 1em">$ yab -p
localhost:9787 moe --health -n 100000 -d 10s --rps 1000</p>
<p style="margin-left:11%; margin-top: 1em">This would make
requests at 1000 RPS until either the maximum number of
requests (100,000) or the maxi
BD0
mum duration (10 seconds) is
reached.</p>
<p style="margin-left:11%; margin-top: 1em">By default, yab
will create multiple connections (defaulting to the number
of CPUs on the machine), but will only have one concurrent
call per connection. The number of connections and
concurrent calls per connection can be controlled using
--connections and --concurrency. <b><br>
−n</b>, <b>−−max-requests</b> <default:
<i>"0"</i>></p>
<p style="margin-left:22%;">The maximum number of requests
to make. 0 implies no limit.</p>
<p style="margin-left:11%;"><b>−d</b>,
<b>−−max-duration</b> <default:
<i>"0s"</i>></p>
<p style="margin-left:22%;">The maximum amount of time to
run the benchmark for. 0 implies no duration limit.</p>
<table width="100%" border=0 rules="none" frame="void"
cellspacing="0" cellpadding="0">
<tr valign="top" align="left">
<td width="11%"></td>
<td width="9%">
<p style="margin-top: 1em" valign="top"><b>−−cpus</b></p> </td>
<td width="2%"></td>
<td width="36%">
<p style="margin-top: 1em" valign="top">The number of OS
threads</p> </td>
<td width="42%">
</td>
</table>
<p style="margin-left:11%;"><b>−−connections</b></p>
<p style="margin-left:22%;">The number of TCP connections
to use</p>
<p style="margin-left:11%;"><b>−−warmup</b>
<default: <i>"10"</i>></p>
<p style="margin-left:22%;">The number of requests to make
to warmup each connection</p>
<p style="margin-left:11%;"><b>−−concurrency</b>
<default: <i>"1"</i>></p>
<p style="margin-left:22%;">The number of concurrent calls
per connection</p>
<p style="margin-left:11%;"><b>−−rps</b>
<default: <i>"0"</i>></p>
<p style="margin-left:22%;">Limit on the number of requests
per second. The default (0) is no limit.</p>
<p style="margin-left:11%;"><b>−−statsd</b></p>
<p style="margin-left:22%;">Optional host:port of a StatsD
server to report metrics</p>
<p style="margin-left:11%;"><b>−−per-peer-stats</b></p>
<p style="margin-left:22%;">Whether to emit stats by peer
rather than aggregated</p>
<p style="margin-left:11%; margin-top: 1em"><b>Help Options
<br>
−h</b>, <b>−−help</b></p>
<p style="margin-left:22%;">Show this help message</p>
<hr>
</body>
</html>