HTTP Load Testing And Benchmarking Tool

GBench

Build Status Coverage Status Go Report Card GoDoc

HTTP Load Testing And Benchmarking Tool inspired by Apache Benchmark and Siege.

Requirements

You need Golang installed and ready on your system.

Installation

go install github.com/sasanrose/gbench

Usage:

Gbench has three main subcommands: exec, json and render. Exec is used, as the name suggests, to execute a benchmark based on a single url. While json subcommands runs benchmark based on a JSON configruation file and allows you to run benchmarks for different paths for a single host concurrently. This has the benefit of reproducing the same benchmark just by sharing the JSON file. Both exec and json subcommands store the result of benchmark in a JSON file (report.json in the current directy by default). And at last but not least, the render subcommand can convert the generated report to a more human readable format.

$ gbench -h
Usage:                                                                                                                                                                                       
  gbench [flags]
  gbench [command]

Available Commands:
  exec        Executes the benchmark                                                                                                                                                         
  help        Help about any command                                                                                                                                                         
  json        Executes the benchmark using json configuration                                                                                                                                
  render      Render the report generated by exec command                                                                                                                                    

Flags:
  -h, --help   help for gbench

Use "gbench [command] --help" for more information about a command.
$ gbench exec -h
Usage:                                                                                                                                                                                       
  gbench exec [flags]                                                                                                                                                                        

Flags:
  -c, --concurrency int             Number of concurrent requests. (default 1)
      --connect-timeout duration    Connection timeout (0 means no timeout).
  -b, --cookie string               A string to be sent as raw cookie (In the format of Set-Cookie HTTP header).
  -d, --data strings                Sends the specified data in a request. The format should be 'key=val' or 'key1=val1&key2=val2'. This can be used multiple times.
  -F, --force                       Force overwrite for the report file.
  -H, --header strings              HTTP header in format of 'key: value' or 'key: value;' or 'key;'. This can be used multiple times.
  -h, --help                        help for exec
  -o, --output string               The path to store the report of benchmark. (default "./report.json")
      --proxy string                HTTP proxy.
  -X, --request string              Specify a custom HTTP method. (default "GET")
      --response-timeout duration   Response timeout (0 means no timeout).
  -s, --status-codes ints           Define what should be considered as a successful status code. (default [200,202,201])
  -r, --total-requests int          Number of total requests to send. (default 1)
  -u, --user string                 Specify the user name and password to use for server authentication in the format of user:password. Currently only supports Basic Auth.
                                    The user name and passwords are split up on the first colon, as a result it is impossible to use a colon in the user name.
$ gbench json -h
Usage:                                                                                                                                                                                       
  gbench json [flags]                                                                                                                                                                        

Flags:
  -F, --force           Force overwrite for the report file.
  -h, --help            help for json
  -o, --output string   The path to store the report of benchmark. (default "./report.json")
$ gbench render -h
Sample usage:                                                                                                                                                                                
gbench render (Will use all the default values)
gbench render -i ./path/to/report.json
gbench render -i ./path/to/report.json --driver html
gbench render -i ./path/to/report.json --driver html -a 0.0.0.0 -p 7777

Usage:
  gbench render [flags]

Flags:
  -a, --address string   Address to access the html report. (default "localhost")
  -d, --driver string    Driver to use for rendering the report. Accepted values are 'cli'and 'html'. (default "cli")
  -h, --help             help for render
  -i, --input string     Path to the report file. (default "./report.json")
  -p, --port string      Port to access the html report. (default "8080")

The following is a sample JSON config file that can be used with json subcommand. Most of the keys are based on flags of exec subcommand. The only required keys are host and paths.

{                                                                                                                                                                                            
    "host": "http://localhost:8080",
    "concurrency": 5,
    "requests": 100,
    "status-codes": [200, 201],
    "user": "user:pass",
    "proxy": "http://proxy:3333",
    "connect-timeout": 1000000000,
    "response-timeout": 5000000000,
    "headers": ["X-Custome-Header: TestValue;"],
    "cookie": "some-raw-cookie",
    "paths": [
        {
            "path": "/"
        },
        {
            "path": "/test",
            "method": "post",
            "user": "user:pass",
            "headers": ["X-Custome-Header: TestValue;"],
            "cookie": "some-raw-cookie",
            "data": ["key1=val1&key2=val2", "key3=val3"]
        }
    ]
}

Disclaimer: Gbench is still beta version. The API may change in future.

Similar Resources

A golang tool which makes http requests and prints the address of the request along with the MD5 hash of the response.

Golang Tool This repository is a golang tool which makes http requests to the external server and prints the address of the request along with the MD5

Oct 17, 2021

This is a simple single-host reverse proxy that intercept and save HTTP requests and responses

This is a simple single-host reverse proxy that intercept and save HTTP requests and responses

HTTP Telescope Debug HTTP requests using a reverse proxy. Description This is a simple single-host reverse proxy that intercept and save HTTP requests

Mar 20, 2022

Goget will send a http request, and show the request time, status, response, and save response to a file

Goget will send a http request, and show the request time, status, response, and save response to a file

Feb 9, 2022

Go (golang) http calls with retries and backoff

pester pester wraps Go's standard lib http client to provide several options to increase resiliency in your request. If you experience poor network co

Dec 28, 2022

Simple HTTP and REST client library for Go

Resty Simple HTTP and REST client library for Go (inspired by Ruby rest-client) Features section describes in detail about Resty capabilities Resty Co

Jan 1, 2023

A Go HTTP client library for creating and sending API requests

A Go HTTP client library for creating and sending API requests

Sling Sling is a Go HTTP client library for creating and sending API requests. Slings store HTTP Request properties to simplify sending requests and d

Jan 7, 2023

httpreq is an http request library written with Golang to make requests and handle responses easily.

httpreq is an http request library written with Golang to make requests and handle responses easily. Install go get github.com/binalyze/http

Feb 10, 2022

Basic repository with HTTP ping api and db setup

Simple API Simple REST API with database (postgres) integration HighLevel Agenda Integrating with postgres (few concepts) Live code walkthrough Detail

Jan 27, 2022

Benzinga Backend Challenge, A HTTP receiver and webhook forwarder

benzinga-backend-challenge Benzinga Backend Challenge, a simple webhook receiver and forwarder. The application should be a basic webhook receiver tha

Jan 3, 2022
Comments
  • Average Response Time incorrect

    Average Response Time incorrect

    The calculation for Average Response Time is incorrect. See the data below. How can the Average response time be .086 seconds when the shortest response time was .582? I would like for the Average response time to be the average of each of the responses. For example, if I had three responses with times of 2.0, 5.0 and 10 then the average response time would be 5.66 seconds.

    $ ./gbench -url 'GET|http://test6.pioneeringevolution.com/laravel-perf/index.php/simplepdo/100' -r 24 -c 1 Start benchmarking...

    Benchmark Result: Total Transactions: 24 Failed Transactions: 0 Availability: 100.000000 % Elapsed Time: 2.073000 secs Transaction Rate: 11.577424 Average Response Time: 0.086375 secs Longest Response Time: 2.066000 secs Shortest Response Time: 0.582000 secs

Related tags
Replacement of ApacheBench(ab), support for transactional requests, support for command line and package references to HTTP stress testing tool.

stress stress is an HTTP stress testing tool. Through this tool, you can do a stress test on the HTTP service and get detailed test results. It is ins

Aug 23, 2022
An HTTP performance testing tool written in GoLang

Gonce A HTTP API performance testing tool written in GoLang Description Installation Usage Description A performance testing tool written in GoLang. S

Jan 28, 2022
Go Supertest is minimalize HTTP Client Testing only for Gin Framework

Go Supertest is minimalize HTTP Client Testing only for Gin Framework, inspired by Supertest package library HTTP Client Testing for Express.js Framework.

May 22, 2022
Fast HTTP package for Go. Tuned for high performance. Zero memory allocations in hot paths. Up to 10x faster than net/http
Fast HTTP package for Go. Tuned for high performance. Zero memory allocations in hot paths. Up to 10x faster than net/http

fasthttp Fast HTTP implementation for Go. Currently fasthttp is successfully used by VertaMedia in a production serving up to 200K rps from more than

Jan 2, 2023
Speak HTTP like a local. (the simple, intuitive HTTP console, golang version)

http-gonsole This is the Go port of the http-console. Speak HTTP like a local Talking to an HTTP server with curl can be fun, but most of the time it'

Jul 14, 2021
Http client call for golang http api calls

httpclient-call-go This library is used to make http calls to different API services Install Package go get

Oct 7, 2022
fhttp is a fork of net/http that provides an array of features pertaining to the fingerprint of the golang http client.

fhttp The f stands for flex. fhttp is a fork of net/http that provides an array of features pertaining to the fingerprint of the golang http client. T

Jan 1, 2023
NATS HTTP Round Tripper - This is a Golang http.RoundTripper that uses NATS as a transport.

This is a Golang http.RoundTripper that uses NATS as a transport. Included is a http.RoundTripper for clients, a server that uses normal HTTP Handlers and any existing http handler mux and a Caddy Server transport.

Dec 6, 2022
Simple HTTP package that wraps net/http

Simple HTTP package that wraps net/http

Jan 17, 2022
Http-conection - A simple example of how to establish a HTTP connection using Golang

A simple example of how to establish a HTTP connection using Golang

Feb 1, 2022