Enhancing Web Performance Testing in GoLang: The Bombardier Blueprint

A Practical Tutorial on How to Use Bombardier

4 min readOct 20, 2023
Enhancing Web Performance Testing in GoLang: The Bombardier Blueprint

One tool that has garnered attention in golang is Bombardier, a versatile and efficient HTTP bench marking tool that can help you assess and optimize your Go applications.

In this article, we’ll delve into the world of Bombardier and explore how it can be leveraged in GoLang projects.

What is Bombardier?

Bombardier is an open-source, command-line HTTP bench marking tool that is designed for testing the performance of HTTP services, including web servers, proxies, and other HTTP-based applications.

This has become a popular choice for developers looking to measure the scalability and speed of their HTTP endpoints.

The power of Bombardier

  • Fast and Efficient: Bombardier is built using the fasthttp library, which provides excellent performance compared to Go’s default http library. This allows Bombardier to handle a high number of requests with minimal resource usage.
  • Customizable Request Parameters: With Bombardier, we can easily customize request parameters such as headers, payload, and query strings. This flexibility allows us to test different aspects of our web application’s functionality and performance.
  • Real-Time Metrics: Provides real-time metrics for our requests, including the number of requests completed, the number of requests failed, and the average response time. This information helps us to monitor the performance of our web application during the benchmarking process.
  • Integration with Go’s net/http Library: Starting from version 1.1, Bombardier supports the use of Go’s net/http client, allowing us to test HTTP/2.x services or use a more RFC-compliant HTTP client. This integration makes Bombardier even more versatile for testing different types of web applications.


You can grab binaries in the releases section. Alternatively, to get latest

go install github.com/codesenberg/bombardier@latest

Getting started

Let’s create a simple example of how to use Bombardier to test a Go HTTP server. First, you’ll need to have a GoLang HTTP server running. Here’s a basic example with echo

Now, you can run the following command to run the bench mark test for the endpoint health

bombardier -c 200 -n 500 http://localhost:8080/health

and which will have an output as

The Bombardier Commands

Here is some of the most commonly used Bombardier commands and options

- c , — connections

Specifies the number of concurrent connections (clients) to use during the test.
Example : -c 200 or connection=200 sets 200 connections

-d, — duration

Defines the test duration. You can specify it as a number followed by a unit, such as ‘s’ for seconds, ‘m’ for minutes, or ‘h’ for hours
Example : -d 10s or duration=10s sets the test duration to 10 second

- m, — method

Sets the HTTP request method to use for the test. Common methods include GET, POST, PUT, DELETE
Example : -m GET or --method=GET

- H, — header

Allows you to specify custom HTTP headers. You can use this option to send headers with your requests.
Example : -H "x-api-key: demoapikey" or --header="x-api-key: demoapikey"

-b, — body

Enables you to include a request body in POST or PUT requests.
Example : -b "{'name':'John Doe'}" or --body="{'name':'John Doe'}" sets the request body.

-r, — rate

Specifies the request rate per second. You can use this option to control the request rate, especially when running with a fixed number of connections.

-o, — format

Specifies which format to use to output the result.

Formats understood by bombardier are:
— plain-text (short: pt)
— json (short: j)
Example : -o j or --format=j

-l, —latencies

Specifies to print latency statistics
Example : -l or --latencies

try bombardier — help to see more commands

A complete Sample

Let’s create a server wich Echo web framework to create a simple RESTful API. And includes a middleware for API key validation and handles JSON request.

then run the command in terminal

bombardier -c 200 -n 500 -d 10s \
-H 'Content-Type: application/json' \
-H 'x-api-key:test' \
-m POST -b '{"name":"john doe"}' -l http://localhost:8080/ping

let’s get the request body from a file. Create file named as request-body.json with this content in it.

"name":"John Doe"

then run this command

bombardier -c 200 -n 500 -d 10s \
-H 'Content-Type: application/json' \
-H 'x-api-key:test' -m POST -f request-body.json -l http://localhost:8080/ping

and we will have an output as this


Bombardier offers a wide range of options for more advanced use cases. You can customize headers, set a specific HTTP method, and much more. For a complete list of options and usage examples, refer to the official documentation.

It is a valuable tool for any developer working with GoLang who wants to assess and optimize the performance of their HTTP services. It allows us to simulate various scenarios and stress-test your applications effectively. Whether you’re building a high-performance web server, a RESTful API, or a microservice, Bombardier can help ensure your project meets the demands of real-world usage.

I hope this article helps. Thank you so much for reading. :)

Some other packages for load testing and bench marking web applications




Hey there! I'm a software developer and I'm absolutely in love with building things with technology.