Skip to content

A powerful command-line tool for benchmarking HTTP endpoints, written in the Go programming language.

License

Notifications You must be signed in to change notification settings

SimonLariz/httpbench

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

httpbench

A powerful command-line tool for benchmarking HTTP endpoints.

Go Version License Go Report Card GitHub Stars

Table of Contents

Demo

httpbench Demo

Features

  • 🚀 Send concurrent HTTP requests to a specified URL
  • ⚙️ Customize the number of requests, concurrency level, and timeout duration
  • 📊 Measure response times and calculate average, minimum, and maximum values
  • 📈 Calculate throughput (requests per second)
  • 🌈 Display progress bar to track benchmarking progress
  • 💅 Generate colorful and formatted output for easy readability

Installation

To install httpbench, make sure you have Go installed on your system. Then, run the following command:

go get github.com/simonlariz/httpbench

Or you can clone the repository and build the binary manually:

git clone https://github.com/SimonLariz/httpbench.git
cd httpbench
go build -o ./bin/httpbench cmd/httpbench/main.go

Then you can run the binary:

./bin/httpbench

Usage

To start benchmarking an HTTP endpoint, run the following command:

httpbench -url "http://example.com/api" -n 1000 -c 10 -timeout 5s

This command sends 1000 requests to http://example.com/api with a concurrency level of 10 and a timeout of 5 seconds. You can customize these values based on your requirements.

  • -url: The URL of the HTTP endpoint to benchmark
  • -n: The total number of requests to send
  • -c: The concurrency level (number of requests to send concurrently)
  • -timeout: The duration to wait for a response from the server

For more information about the available options, run httpbench -h.

Example

httpbench Example

Customization

httpbench provides various customization options for the progress bar and output formatting. You can modify the following properties:

  • Progress bar width
  • Progress bar template string
  • Progress bar fill character
  • Progress bar empty character
  • Current and total count format
  • Progress bar color
  • Progress bar refresh rate

Refer to the source code and the github.com/cheggaaa/pb package documentation for more details on customization options.

Important Note

Please refrain from benchmarking, load testing, or performing any unauthorized tests on websites or applications without explicit permission from the site maintainers. Unauthorized testing can put unnecessary strain on the servers and may be considered a form of attack.

Roadmap

  • Support for POST request with request bodies
  • Integration with popular monitoring tools (e.g., Prometheus, Grafana)
  • Web-based dashboard for monitoring and analyzing benchmark results

Contributing

Contributions are welcome! If you find any issues or have suggestions for improvements, please open an issue or submit a pull request on the GitHub repository.

License

This project is licensed under the MIT License.

About

A powerful command-line tool for benchmarking HTTP endpoints, written in the Go programming language.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages