httpmicrobench

module
v0.0.0-...-5eb588b Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 21, 2025 License: MIT

README

HTTP Response Body Drain Microbenchmark

This repository provides a microbenchmark suite to measure the impact of draining (reading to EOF) an HTTP response body before closing it in Go HTTP clients. The benchmark launches multiple client and server containers, varying the HTTP protocol version and whether the response body is drained, and collects timing and resource usage statistics.

Requirements for Running it

  • Go 1.25
  • Docker Engine 28.4

Running the Benchmark

To run the benchmark with a custom number of requests (default: 1000):

NUMBER_OF_REQUESTS=10000 go run ./cmd/bench/

This will build the client and server binaries, create Docker images, launch containers, and execute the benchmark. Results will be saved in a timestamped subdirectory under benchresults/.

Summarizing Results

To summarize the results after a benchmark run:

BENCH_RESULTS_DIRECTORY="benchresults/<timestamp>" go run ./cmd/stats/

Replace <timestamp> with the actual timestamped directory created by the benchmark (e.g., 20250920150626). The summary will include request timing statistics and resource usage for each client and server configuration.

Environment Variables

  • NUMBER_OF_REQUESTS: Number of requests each client sends (default: 1000).
  • BENCH_RESULTS_DIRECTORY: Directory containing benchmark results for summary.
  • Other variables are set internally by the benchmark runner for container configuration.

Results and Analysis

An analysis of the results of running this experiment can be found in this Blog post.

Directories

Path Synopsis
cmd
bench command
client command
server command
stats command
pkg

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL