yab

command module
v0.6.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 22, 2016 License: MIT Imports: 29 Imported by: 0

README

yab Build Status Coverage Status

======

yab (Yet Another Benchmarker) is tool to benchmark YARPC services. It currently supports making Thrift requests to both HTTP and TChannel services.

yab is currently in beta status.

Installing

If you have go installed, simply run the following to install the latest version:

go get -u -f github.com/yarpc/yab

This will install yab to $GOPATH/bin/yab.

Optionally, you can get precompiled binaries from Releases.

Usage
Usage:
  yab [<service> <method> <body>] [OPTIONS]

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.


Application Options:
      --version                  Displays the application version

Request Options:
  -e, --encoding=                The encoding of the data, options are: Thrift,
                                 JSON, raw. Defaults to Thrift if the method
                                 contains '::' or a Thrift file is specified
  -t, --thrift=                  Path of the .thrift file
  -m, --method=                  The full Thrift method name (Svc::Method) to
                                 invoke
  -r, --request=                 The request body, in JSON or YAML format
  -f, --file=                    Path of a file containing the request body in
                                 JSON or YAML
      --headers=                 The headers in JSON or YAML format
      --headers-file=            Path of a file containing the headers in JSON
                                 or YAML
      --health                   Hit the health endpoint, Meta::health
      --timeout=                 The timeout for each request. E.g., 100ms,
                                 0.5s, 1s. If no unit is specified,
                                 milliseconds are assumed. (default: 1s)
      --disable-thrift-envelope  Disables Thrift envelopes (disabled by default
                                 for TChannel)
      --multiplexed-thrift       Enables the Thrift TMultiplexedProtocol used
                                 by services that host multiple Thrift services
                                 on a single endpoint.

Transport Options:
  -s, --service=                 The TChannel/Hyperbahn service name
  -p, --peer=                    The host:port of the service to call
  -P, --peer-list=               Path of a JSON or YAML file containing a list
                                 of host:ports
      --caller=                  Caller will override the default caller name
                                 (which is yab-$USER).
      --topt=                    Custom options for the specific transport
                                 being used

Benchmark Options:
  -n, --max-requests=            The maximum number of requests to make
                                 (default: 1000000)
  -d, --max-duration=            The maximum amount of time to run the
                                 benchmark for (default: 0s)
      --cpus=                    The number of OS threads
      --connections=             The number of TCP connections to use
      --warmup=                  The number of requests to make to warmup each
                                 connection (default: 10)
      --concurrency=             The number of concurrent calls per connection
                                 (default: 1)
      --rps=                     Limit on the number of requests per second.
                                 The default (0) is no limit. (default: 0)
      --statsd=                  Optional host:port of a StatsD server to
                                 report metrics

Help Options:
  -h, --help                     Show this help message
Making a single request

The following examples assume that the Thrift service running looks like:

service KeyValue {
  string get(1: string key)
}

If a TChannel service was running with name keyvalue on localhost:12345, you can make a call to the get method by running:

yab -t ~/keyvalue.thrift -p localhost:12345 keyvalue KeyValue::get -r '{"key": "hello"}'

This specifies a single host:port using -p, but you can also specify multiple peers by passing the -p flag multiple times:

yab -t ~/keyvalue.thrift -p localhost:12345 -p localhost:12346 keyvalue KeyValue::get -r '{"key": "hello"}'

If you have a file containing a list of host:ports (either JSON or new line separated), you can specify the file using -P:

yab -t ~/keyvalue.thrift -P ~/hosts.json keyvalue KeyValue::get -r '{"key": "hello"}'

yab also supports HTTP, instead of the peer being a single host:port, you would use a URL:

yab -t ~/keyvalue.thrift -p "http://localhost:8080/rpc" keyvalue KeyValue::get -r '{"key": "hello"}'
Benchmarking

To benchmark an endpoint, you need all the command line arguments to describe the request, followed by benchmarking options. You need to set at least --maxDuration (or -d) to set the maximum amount of time to run the benchmark.

You can set values such as 3s for 3 seconds, or 1m for 1 minute. Valid time units are:

  • ms for milliseconds
  • s for seconds
  • m for minutes.

You can also control rate limit the benchmark (--rps), or customize the number of connections (--connections) or control the amount of concurrent calls per connection (--concurrency).

yab -t ~/keyvalue.thrift -p localhost:12345 keyvalue KeyValue::get -r '{"key": "hello"}' -d 5s --rps 100 --connections 4

Documentation

Overview

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.

For usage information, check out the man page: http://yarpc.github.io/yab/man.html

Directories

Path Synopsis
internal
thrifttest
Package thrifttest contains utilities to help test THrift serialization.
Package thrifttest contains utilities to help test THrift serialization.
Package sorted contains sort related utilities.
Package sorted contains sort related utilities.
Package thrift contains functionality for converting generic data structures to and from Thrift payloads.
Package thrift contains functionality for converting generic data structures to and from Thrift payloads.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL