Skip to content

rickferrdev/Httgo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🚀 httgo

A lightweight, concurrent HTTP benchmarking tool written in Go.

Go Version License

httgo is a Command Line Interface (CLI) tool designed for HTTP load testing. Leveraging Go's native Goroutines and Channels, it spawns concurrent workers to fire requests and processes real-time metrics through a modular Producer-Consumer architecture.

📋 Table of Contents


📦 Installation

Since this project is written in Go, you can build the binary directly from the source.

Prerequisites

  • Go 1.25+ installed.

Building

# Clone the repository
git clone https://github.com/rickferrdev/httgo.git
cd httgo

# Build the binary
go build -o httgo cmd/httgo/main.go

# (Optional) Move to your PATH
mv httgo /usr/local/bin/

🚀 Usage

The basic command syntax is:

httgo [flags] <URL>

Available Flags

Flag Type Default Description
--concurrency int 5 Sets the number of concurrent workers (goroutines) sending requests.
--method string get Sets the HTTP method to be used (GET, POST, etc.).
--verbose bool false Enables detailed logging for every request (status, duration, error).

Examples

1. Simple test with default settings: Sends requests using 5 concurrent workers via GET.

./httgo https://example.com

2. High concurrency test: Sends requests using 50 simultaneous workers.

./httgo --concurrency 50 https://api.example.com/v1/health

3. Test with POST method and verbose mode: Useful for debugging individual request latency or errors.

./httgo --method post --verbose https://api.example.com/submit

🏗 Architecture

httgo uses a Producer-Consumer pattern to ensure high performance and avoid race conditions when aggregating metrics.

  1. Args Parsing: The program starts by parsing user-provided flags.
  2. Sender (Producer): The main.go initializes N goroutines (based on the --concurrency flag). Each Sender loops through request logic and writes the result (metrics.Metrics) to a shared channel (chan).
  3. Consumer: A single consumer function reads from this channel. It orchestrates a list of actions (such as logging or calculating averages).
    • Hooks: Actions have lifecycle hooks: Before (initialization), Run (per metric), and After (summary/cleanup).
  4. Sync: A sync.WaitGroup ensures the program waits for all Senders to complete their tasks before shutting down the Consumer.

🛠 Development

To run the project in development mode without compiling a final binary:

go run cmd/httgo/main.go --concurrency 2 --verbose https://google.com

Adding New Actions

The system is designed to be extensible. To create a new metrics processor (e.g., to save results to a JSON file), implement the Action interface found in internal/actions:

type Action interface {
    Before(args *args.Args)
    Run(metrics *metrics.Metrics, args *args.Args)
    After(metrics *[]metrics.Metrics, args *args.Args)
}

📄 License

Distributed under the MIT License. See LICENSE for more information.

About

A lightweight, concurrent HTTP benchmarking tool written in Go.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages