Skip to content

solaoi/broly

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

35 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Broly

license GitHub release (latest by date) GitHub Sponsors

This is a high performance stub server.

Usage

broly target.json -p 9999

stub settings (JSON Format) is below.
see a sample here.

Field Type Required Default Sample
- (parent) JSONArray or JSONObject True - -
path string True - "/hello"
method string True - "GET"
contentType string False application/json "application/json"
statusCode string True - "200"
response string True - "{"name": "hello"}"
sleep number False 0 1000 (milliseconds)

Option is below.

Option Description
-p,--port specify the port you want to serve

Install

1. Mac

# Install
brew install solaoi/tap/broly
# Update
brew upgrade broly

2. BinaryRelease

# Install with wget or curl
## set the latest version on releases.
VERSION=v1.0.0
## set the OS you use. (linux or macos)
OS=linux
## case you use wget
wget https://github.com/solaoi/broly/releases/download/$VERSION/broly_${OS}.tar.gz
## case you use curl
curl -LO https://github.com/solaoi/broly/releases/download/$VERSION/broly_${OS}.tar.gz
## extract
tar xvf ./broly_${OS}.tar.gz
## move it to a location in your $PATH, such as /usr/local/bin.
mv ./broly /usr/local/bin/

3. Docker

RunOnly

# Specify the port you want to provide
HOST_PORT=80
# Specify the filename you want to serve
STUB_JSON=filename.json

# Run Container
docker run --init \
-p $HOST_PORT:8080 \
--mount type=bind,src=`pwd`/$STUB_JSON,dst=/target.json \
ghcr.io/solaoi/broly:latest

Local Build & Run

# Download this repo
git clone https://github.com/solaoi/broly.git
cd broly

# Specify the port you want to provide
HOST_PORT=80

# Edit stubs for serving
vi target.json

# Build DockerImage
docker build -t broly .

# Run Container
docker run --init \
-p $HOST_PORT:8080 \
-t broly

4. Nimble

# Install & Update
nimble install broly

Benchmark

  • Tool: Vegeta
  • Command:
    echo 'GET http://localhost:9999/hello' | vegeta attack -duration=60s | vegeta report
  • Environment: on DockerContainer

Broly

Requests      [total, rate, throughput]         3000, 50.02, 50.01
Duration      [total, attack, wait]             59.985s, 59.982s, 3.197ms
Latencies     [min, mean, 50, 90, 95, 99, max]  958.602µs, 2.906ms, 2.989ms, 3.334ms, 3.439ms, 3.682ms, 8.954ms
Bytes In      [total, mean]                     51000, 17.00
Bytes Out     [total, mean]                     0, 0.00
Success       [ratio]                           100.00%
Status Codes  [code:count]                      200:3000  
Error Set:

demo is here.

Requests      [total, rate, throughput]         3000, 50.02, 50.02
Duration      [total, attack, wait]             59.98s, 59.976s, 3.466ms
Latencies     [min, mean, 50, 90, 95, 99, max]  1.036ms, 6.185ms, 3.421ms, 4.056ms, 4.36ms, 34.511ms, 567.831ms
Bytes In      [total, mean]                     48000, 16.00
Bytes Out     [total, mean]                     0, 0.00
Success       [ratio]                           100.00%
Status Codes  [code:count]                      200:3000  
Error Set:

Affinity

Broly's JSON Format is compatible with co-metub.

co-metub is a GUI tool to manage stubs and export stubs in JSON Format.

If you manage stubs with GUI, you should use co-metub.

But if you switch some stubs or attack strongly a stub server, you should use Broly.