GithubHelp home page GithubHelp logo

tempbottle / drill-1 Goto Github PK

View Code? Open in Web Editor NEW

This project forked from fcsonline/drill

0.0 1.0 0.0 323 KB

Drill is a HTTP load testing application written in Rust inspired by Ansible syntax

License: GNU General Public License v3.0

Rust 95.10% JavaScript 4.90%

drill-1's Introduction

Drill

Drill is a HTTP load testing application written in Rust. The main goal for this project is to build a really lightweight tool as alternative to other that require JVM and other stuff.

You can write benchmark files, in YAML format, describing all the stuff you want to test.

It was inspired by Ansible syntax because it is really easy to use and extend.

Here is an example for benchmark.yml:

---

threads: 4
base: 'http://localhost:9000'
iterations: 5
rampup: 2

plan:
  - name: Include comments
    include: comments.yml

  - name: Fetch users
    request:
      url: /api/users.json

  - name: Fetch organizations
    request:
      url: /api/organizations

  - name: Fetch account
    request:
      url: /api/account
    assign: foo

  - name: Fetch manager user
    request:
      url: /api/users/{{ foo.manager_id }}

  - name: Assign values
    assign:
      key: bar
      value: "2"

  - name: Fetch user from assign
    request:
      url: /api/users/{{ bar }}

  - name: Fetch some users
    request:
      url: /api/users/{{ item }}
    with_items:
      - 70
      - 73
      - 75

  - name: Fetch some users by hash
    request:
      url: /api/users/{{ item.id }}
    with_items:
      - { id: 70 }
      - { id: 73 }
      - { id: 75 }

  - name: Fetch some users from CSV
    request:
      url: /api/users/contacts/{{ item.id }}
    with_items_from_csv: ./fixtures/users.csv

  - name: Fetch no relative url
    request:
      url: http://localhost:9000/api/users.json

  - name: Support for POST method
    request:
      url: /api/users
      method: POST
      body: foo=bar&arg={{ bar }}

  - name: Login user
    request:
      url: /login?user=example&password=3x4mpl3

  - name: Fetch counter
    request:
      url: /counter
    assign: memory

  - name: Fetch counter
    request:
      url: /counter
    assign: memory

  - name: Fetch endpoint
    request:
      url: /?counter={{ memory.counter }}

  - name: Reset counter
    request:
      method: DELETE
      url: /

  - name: Custom headers
    request:
      url: /admin
      headers:
        Authorization: Basic aHR0cHdhdGNoOmY=
        X-Foo: Bar

As you can see, you can play with interpolations in different ways. This will let you specify a benchmark with different requests and dependencies between them.

If you want to know more about the benchmark file syntax, read this

Install

The easiest way right now is to install with cargo:

cargo install drill
drill --benchmark benchmark.yml --stats

or download the source code and compile it:

git clone [email protected]:fcsonline/drill.git && cd drill
cargo build --release
./target/release/drill --benchmark benchmark.yml --stats

Note: You will need to install libssl-dev and pkg-config packages.

Demo

demo

Features

This is the list of all features supported by the current version of drill:

  • Multi thread: run your benchmarks setting as many concurrent threads as you want.
  • Multi iterations: specify the number of iterations you want to run the benchmark.
  • Ramp-up: specify the the amount of time it will take drill to start all threads.
  • Dynamic urls: execute requests with dynamic interpolations in the url, like /api/users/{{ item }}
  • Dynamic headers: execute requests with dynamic headers. Example: headers.yml
  • Request dependencies: create dependencies between requests with assign and url interpolations.
  • Split files: organize your benchmarks in multiple files and include them.
  • CSV support: read CSV files and build N requests fill dynamic interpolations with CSV data.
  • HTTP methods: build request with different http methods like GET, POST, PUT, PATCH, HEAD or DELETE.
  • Cookie support: create benchmarks with sessions because cookies are propagates between requests.
  • Stats: get nice statistics about all the requests. Example: cookies.yml
  • Thresholds: compare the current benchmark performance against a stored one session and fail if a threshold is exceeded.

Test it

Go to the example directory and you'll find a README how to test it in a safe environment.

Disclaimer: We really recommend not to run intensive benchmarks against production environments.

Command line interface

Full list of cli options, which is available under drill --help

drill 0.5.0
HTTP load testing application written in Rust inspired by Ansible syntax

USAGE:
    drill [OPTIONS] --benchmark <benchmark>

FLAGS:
    -h, --help       Prints help information
        --no-check-certificate    Disables SSL certification check. (Not recommended)
    -s, --stats      Shows request statistics
    -q, --quiet      Skips output of individual request statistics
    -n, --nanosec    Shows statistics in nanoseconds
    -V, --version    Prints version information

OPTIONS:
    -b, --benchmark <benchmark>    Sets the benchmark file
    -c, --compare <compare>        Sets a compare file
    -r, --report <report>          Sets a report file
    -t, --threshold <threshold>    Sets a threshold value in ms amongst the compared file

Roadmap

  • Complete and improve the interpolation engine
  • Add writing to a file support

Contribute

This project started as a side project to learn Rust, so I'm sure that is full of mistakes and areas to be improve. If you think you can tweak the code to make it better, I'll really appreciate a pull request. ;)

drill-1's People

Contributors

arnodb avatar atul9 avatar chills42 avatar fcsonline avatar iamjarvo avatar joern-ploennigs avatar manithree avatar spk avatar tzaeru avatar

Watchers

 avatar

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.