All Projects → linkxzhou → http_bench

linkxzhou / http_bench

Licence: other
golang HTTP stress test tool, support single and distributed

Programming Languages

go
31211 projects - #10 most used programming language

Projects that are alternatives of or similar to http bench

Awesome Http Benchmark
HTTP(S) benchmark tools, testing/debugging, & restAPI (RESTful)
Stars: ✭ 2,236 (+1474.65%)
Mutual labels:  benchmark, http2, http3
Phantomas
Headless Chromium-based web performance metrics collector and monitoring tool
Stars: ✭ 2,191 (+1442.96%)
Mutual labels:  http2, http3
Vulcain
Fast and idiomatic client-driven REST APIs.
Stars: ✭ 3,190 (+2146.48%)
Mutual labels:  http2, http3
Golang Tls
Simple Golang HTTPS/TLS Examples
Stars: ✭ 857 (+503.52%)
Mutual labels:  http2, httpclient
gost
GO Simple Tunnel - a simple tunnel written in golang
Stars: ✭ 154 (+8.45%)
Mutual labels:  http2, http3
Algernon
🎩 Small self-contained pure-Go web server with Lua, Markdown, HTTP/2, QUIC, Redis and PostgreSQL support
Stars: ✭ 1,880 (+1223.94%)
Mutual labels:  http2, http3
Nghttp2
nghttp2 - HTTP/2 C Library and tools
Stars: ✭ 3,868 (+2623.94%)
Mutual labels:  http2, http3
gobench
A benchmark framework based on Golang
Stars: ✭ 50 (-64.79%)
Mutual labels:  benchmark, distributed
Curlsharp
CurlSharp - .Net binding and object-oriented wrapper for libcurl.
Stars: ✭ 153 (+7.75%)
Mutual labels:  http2, httpclient
Labench
Latency Benchmarking tool
Stars: ✭ 75 (-47.18%)
Mutual labels:  benchmark, http2
esa-httpclient
An asynchronous event-driven HTTP client based on netty.
Stars: ✭ 82 (-42.25%)
Mutual labels:  http2, httpclient
async-websocket
Asynchronous WebSocket client and server, supporting HTTP/1 and HTTP/2 for Ruby.
Stars: ✭ 111 (-21.83%)
Mutual labels:  http2, http1
ssltun
simple secure http proxy server with automic https
Stars: ✭ 33 (-76.76%)
Mutual labels:  http2
krun
High fidelity benchmark runner
Stars: ✭ 70 (-50.7%)
Mutual labels:  benchmark
SciMLBenchmarks.jl
Benchmarks for scientific machine learning (SciML) software and differential equation solvers
Stars: ✭ 195 (+37.32%)
Mutual labels:  benchmark
HeCBench
software.intel.com/content/www/us/en/develop/articles/repo-evaluating-performance-productivity-oneapi.html
Stars: ✭ 85 (-40.14%)
Mutual labels:  benchmark
iris
Distributed streaming key-value storage
Stars: ✭ 55 (-61.27%)
Mutual labels:  distributed
latenz
JavaScript HTTP latency analyzer
Stars: ✭ 18 (-87.32%)
Mutual labels:  benchmark
dtm
A distributed transaction framework that supports multiple languages, supports saga, tcc, xa, 2-phase message, outbox patterns.
Stars: ✭ 6,110 (+4202.82%)
Mutual labels:  distributed
hyper2web
Super Fast Backend Framework (Educational Purpose)
Stars: ✭ 28 (-80.28%)
Mutual labels:  http2

a HTTP(HTTP/1, HTTP/2) stress test tool, support single and distributed.

http_bench is a tiny program that sends some load to a web application, support single and distributed mechine, http/1 and http/2.

English Document
中文文档

  • HTTP/1 stress
  • HTTP/2 stress
  • Distributed stress
  • Support functions
  • Support variable
  • HTTP/3 stress
  • Websocket stress
  • Show UI Metrics

Installation

go get github.com/linkxzhou/http_bench

OR

git clone [email protected]:linkxzhou/http_bench.git
cd http_bench
go build http_bench.go

Architecture

avatar

Basic Usage

./http_bench http://127.0.0.1:8000 -c 1000 -d 60s
Running 1000 connections, @ http://127.0.0.1:8000

Summary:
  Total:        63.031 secs
  Slowest:      0.640 secs
  Fastest:      0.000 secs
  Average:      0.072 secs
  Requests/sec: 12132.423
  Total data:   8.237 GB
  Size/request: 11566 bytes

Status code distribution:
  [200] 764713 responses

Latency distribution:
  10% in 0.014 secs
  25% in 0.030 secs
  50% in 0.060 secs
  75% in 0.097 secs
  90% in 0.149 secs
  95% in 0.181 secs
  99% in 0.262 secs

Command Line Options

-n  Number of requests to run.
-c  Number of requests to run concurrently. Total number of requests cannot
  be smaller than the concurency level.
-q  Rate limit, in seconds (QPS).
-d  Duration of the stress test, e.g. 2s, 2m, 2h
-t  Timeout in ms.
-o  Output type. If none provided, a summary is printed.
  "csv" is the only supported alternative. Dumps the response
  metrics in comma-seperated values format.
-m  HTTP method, one of GET, POST, PUT, DELETE, HEAD, OPTIONS.
-H  Custom HTTP header. You can specify as many as needed by repeating the flag.
  for example, -H "Accept: text/html" -H "Content-Type: application/xml", 
  but "Host: ***", replace that with -host.
-http  Support HTTP/1 HTTP/2, default HTTP/1.
-body  Request body, default empty.
-a  Basic authentication, username:password.
-x  HTTP Proxy address as host:port.
-disable-compression  Disable compression.
-disable-keepalive    Disable keep-alive, prevents re-use of TCP
          connections between different HTTP requests.
-cpus                 Number of used cpu cores.
          (default for current machine is %d cores).
-url 		Request single url.
-verbose 	Print detail logs, default 2(0:TRACE, 1:DEBUG, 2:INFO ~ ERROR).
-url-file 	Read url list from file and random stress test.
-body-file  Request body from file.
-listen 	Listen IP:PORT for distributed stress test and worker mechine (default empty). e.g. "127.0.0.1:12710".
-W  Running distributed stress test worker mechine list.
      for example, -W "127.0.0.1:12710" -W "127.0.0.1:12711".

Example stress test for url(print detail info "-verbose 1"):

./http_bench -n 1000 -c 10 -m GET -url "http://127.0.0.1/test1"
./http_bench -n 1000 -c 10 -m GET "http://127.0.0.1/test1"

Example stress test for file(print detail info "-verbose 1"):

./http_bench -n 1000 -c 10 -m GET "http://127.0.0.1/test1" -url-file urls.txt
./http_bench -d 10s -c 10 -m POST -body "{}" -url-file urls.txt

Example stress test for http/2:

./http_bench -d 10s -c 10 -http http2 -m POST "http://127.0.0.1/test1" -body "{}"

Example distributed stress test(print detail info "-verbose 1"):

(1) First step:
./http_bench -listen "127.0.0.1:12710" -verbose 1
./http_bench -listen "127.0.0.1:12711" -verbose 1

(2) Second step:
./http_bench -c 1 -d 10s "http://127.0.0.1:18090/test1" -body "{}" -W "127.0.0.1:12710" -W "127.0.0.1:12711" -verbose 1

Support Function and Variable

(1) intSum

Function: 
  intSum number1 number2 number3 ...

Example:  
== Client Request Example:
./http_bench -c 1 -n 1 "https://127.0.0.1:18090?data={{ intSum 1 2 3 4}}" -verbose 0
== Body Request Example:
./http_bench -c 1 -n 1 "https://127.0.0.1:18090" -body "data={{ intSum 1 2 3 4 }}" -verbose 0

(2) random

Function: 
  random min_value max_value 

Example:  
== Client Request Example:
./http_bench -c 1 -n 1 "https://127.0.0.1:18090?data={{ random 1 100000}}" -verbose 0
== Body Request Example:
./http_bench -c 1 -n 1 "https://127.0.0.1:18090" -body "data={{ random 1 100000 }}" -verbose 0

(3) randomDate

Function: 
  randomDate format(random date string: YMD = yyyyMMdd, HMS = HHmmss, YMDHMS = yyyyMMdd-HHmmss)

Example:  
== Client Request Example:
./http_bench -c 1 -n 1 "https://127.0.0.1:18090?data={{ randomDate \"YMD\"}}" -verbose 0
== Body Request Example:
./http_bench -c 1 -n 1 "https://127.0.0.1:18090" -body "data={{ randomDate \"YMD\" }}" -verbose 0

(4) randomString

Function: 
  randomString count(random string: 0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ)

Example:  
== Client Request Example:
./http_bench -c 1 -n 1 "https://127.0.0.1:18090?data={{ randomString 10}}" -verbose 0
== Body Request Example:
./http_bench -c 1 -n 1 "https://127.0.0.1:18090" -body "data={{ randomString 10 }}" -verbose 0

(5) randomNum

Function: 
  randomNum count(random string: 0123456789)

Example:  
== Client Request Example:
./http_bench -c 1 -n 1 "https://127.0.0.1:18090?data={{ randomString 10}}" -verbose 0
== Body Request Example:
./http_bench -c 1 -n 1 "https://127.0.0.1:18090" -body "data={{ randomString 10 }}" -verbose 0

(6) date

Function: 
  date format(YMD = yyyyMMdd, HMS = HHmmss, YMDHMS = yyyyMMdd-HHmmss) 

Example:  
== Client Request Example:
./http_bench -c 1 -n 1 "https://127.0.0.1:18090?data={{ date \"YMD\" }}" -verbose 0
== Body Request Example:
./http_bench -c 1 -n 1 "https://127.0.0.1:18090" -body "data={{ date \"YMD\" }}" -verbose 0

(7) UUID

Function: 
  UUID 

Example:  
== Client Request Example:
./http_bench -c 1 -n 1 "https://127.0.0.1:18090?data={{ UUID | escape }}" -verbose 0
== Body Request Example:
./http_bench -c 1 -n 1 "https://127.0.0.1:18090" -body "data={{ UUID }}" -verbose 0

(8) escape

Function: 
  escape str(pipeline with other functions)

Example:  
== Client Request Example:
./http_bench -c 1 -n 1 "https://127.0.0.1:18090?data={{ UUID | escape }}" -verbose 0
== Body Request Example:
./http_bench -c 1 -n 1 "https://127.0.0.1:18090" -body "data={{ UUID | escape }}" -verbose 0
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].