Git Product home page Git Product logo

trunks's Introduction

Trunks

Trunks is a lightweight, template-based load testing tool built upon vegeta. Trunks combined the power of Vegeta and Golang Template to generate randomized data, mimics the pattern of real-life traffic.

If you like my work, consider buy me a coffee :D

Buy Me A Coffee

Installation

Pre-built binary

Please checkout Release page

Source

You need go installed and GOBIN in your PATH. Once that is done, run the command:

$ go get -u github.com/vanhtuan0409/trunks

Example

$ trunks -rate 10 -duration 20 -target targets.sample.yml | vegeta report

Usage manual

Usage of trunks:
  -debug string
        Write debug log to file (default discard)
  -duration int
        Duration to run the request (in seconds)
  -output string
        Output file (default "stdout")
  -rate int
        Request per second to send (default 5)
  -target string
        Targets config file path (default "targets.yml")

-debug

Specifies the path of debug log file. It defauls to be discarded (/dev/null)

-duration

Specifies the amount of time to issue request to the targets. The internal concurrency structure's setup has this value as a variable. The actual run time of the test can be longer than specified due to the responses delay. Use 0 for an infinite attack.

-output

Specifies the output file to which the binary results will be written to. Made to be piped to the report command input. Defaults to stdout.

For more details about load test analytics, please refer to vegeta attack

-rate

Specifies the request rate per time unit to issue against the targets. The actual request rate can vary slightly due to things like garbage collection, but overall it should stay very close to the specified. If no time unit is provided, 1s is used.

-target

Specifies the file config for targets. Refer to Targets format

Targets format

meta:
  headers:
    Accept: application/json
targets:
  - url: "http://localhost:8080/api1?lat={{ randNumeric 3 }}&long={{ randNumeric 3 }}"
    method: GET
    repeat: 2
    headers:
      Authorization: "Bearer xxx"
  - url: "http://localhost:8080/api2?token={{ randAlphaNum 12 }}"
    method: POST
    repeat: 3
    body: |
      {
        "timestamp": {{ now | unixEpoch }},
      }

Go template functions are powered by Sprig

meta.headers

Specifies common Header for all targets. Not allow templating

targets[].url

Specifies target URL for load test request. Allow templating

targets[].method

Specifies HTTP Method for load test request.

targets[].body

Specifies HTTP Body for load test request. Allow templating and only taken into affect when Method is not GET

targets[].headers

Request-specific headers, will override meta.headers if duplicated.

targets[].repeat

Number of repeated time for a request (default to 1). Used for balancing request distribution among apis

trunks's People

Contributors

vanhtuan0409 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

tingtingisgood

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.