Skip to content
This repository has been archived by the owner on Nov 10, 2022. It is now read-only.

Latest commit

 

History

History
198 lines (139 loc) · 8.14 KB

README.md

File metadata and controls

198 lines (139 loc) · 8.14 KB

Squeeze

Build Status version License

Squeeze is a modern, easy-to-use, and highly capable load-testing tool. It uses the Master-Slave pattern to simulate any number of users hitting the target. In addition, Squeeze provides the command line and web-based tool to create tasks and show results.

Table of Contents

Features

  • Multiple Protocols: HTTP1.0, HTTP1.1, HTTP2.0, HTTPS, WEBSOCKET, UDP, TCP.
  • Cross-Platform: Linux, MacOSX, Windows
  • Scalability: With the Master-Slave model, Slave can be expanded indefinitely. In other words, you can simulate as many users as you want.

Project Status

Experimental. This project is still under development and not fully stable yet.

Architecture

Squeeze is composed of 4 components: Master, Slave, Client and Web(UI).

Squeeze uses the Master-Slave architecture model, it provides two modes to get results: synchronous and asynchronous. In synchronous mode, the client will wait for the result returned by the server. In asynchronous mode, the client needs to provide a callback address when executing, after the task is executed, the master will send the result that is returned in json format to this address.

Master is responsible for receiving client task request and assigning task to the slave. The result generated by the slave is reported to the master, the master summarizes the result and returns it to client.

Slave is responsible for performing tasks and can be expanded as needed, this allows you to simulate any number of clients to hit your target. In addition, squeeze also provides command line tool and WEB UI for creating tasks and show test results.

Client is a command line tool that have the ability to interact with the master. How to use the client please refer to Usage

Web(UI) provides more friendly way to create test tasks and show test results.

Documentation

Prerequisite

Installation

1. From source

Squeeze use the golang module mechanism to manage dependencies. We just need to type make build, it will automatically download dependencies and generate binary.

If you are a mainland China user, you may compile binary using golang vendor mechanism, type make build-vendor.

2. From a pre-built binary

We provide release binary for three platforms: Linux, OSX and Windows. You can download an appropriate release binary for your operating system. The list of binary releases is available for download from the Release Pages. If the binary doesn't work for you, you'll have to build from source.

3. With Docker or Kubernetes

Squeeze provides a corresponding docker image for each version and hosted on Docker Hub. Therefore we can use docker-compose to quickly build a squeeze cluster to experience all the features.

Deploying with docker-compose:

Starting squeeze cluster:

$ docker-compose up -d

Scaling the slave:

$ docker-compose up -d --scale slave=3

Stoping squeeze cluster:

$ docker-compose down

Deploying on Kubernetes:

If you have installed helm, you can deploy the squeeze with the following command:

helm upgrade --install squeeze squeeze \
  --namespace squeeze --create-namespace

or you can also use a YAML manifest:

kubectl apply -f https://raw.githubusercontent.com/agile6v/squeeze/v0.1.1/tools/deploy/deploy.yaml

Usage

Squeeze provides two ways to start a task.

1. Squeeze Client Tool

Squeeze provide client-side tool that can interact with the squeeze cluster to start or cancel task and provide both synchronous and asynchronous modes. After the squeeze cluster is built, we can start a task. Squeeze supports a variety of protocols and each protocol need to provide different parameters. Use http protocol as the example.

First, Have a look at http protocol need to provide parameters.

$ squeeze client http --help

http protocol benchmark

Usage:
  squeeze client http [flags]

Flags:
  -d, --body string           Request body string
  -D, --bodyfile string       Request body from file
  -c, --concurrency int       Number of multiple requests to make at a time (default 1)
  -T, --content-type string   Content-type header to use for POST/PUT data (default "text/plain")
      --disable-compression   Disable compression of body received from the server.
      --disable-keepalive     Disable keepalive, connection will use keepalive by default.
  -z, --duration int          Duration of application to send requests. if duration is specified, n is ignored.
      --header strings        Custom HTTP header.(Repeatable)
  -h, --help                  help for http
      --http2                 Enable http2
      --maxResults int        The maximum number of response results that can be used (default 1000000)
  -m, --method string         Method name (default "GET")
  -x, --proxy string          HTTP Proxy address as host:port
  -q, --rateLimit int         Rate limit, in queries per second (QPS). Default is no rate limit
  -n, --requests int          Number of requests to perform (default 2147483647)
  -s, --timeout int           Seconds to max. wait for each response(Default is 30 seconds) (default 30)

Global Flags:
      --alsologtostderr                  log to standard error as well as files
      --callback string                  If this call is asynchronous then stress result will be sent to the address.
      --httpAddr string                  The address and port of the Squeeze master or slave. (default "http://127.0.0.1:9998")
      --log_backtrace_at traceLocation   when logging hits line file:N, emit a stack trace (default :0)
      --log_dir string                   If non-empty, write log files in this directory
      --logtostderr                      log to standard error instead of files
      --stderrthreshold severity         logs at or above this threshold go to stderr (default 2)
  -v, --v Level                          log level for V logs
      --vmodule moduleSpec               comma-separated list of pattern=N settings for file-filtered logging

Second, Initiate 100 requests to www.baidu.com using 10 concurrency.

$ ./squeeze client http http://www.baidu.com -n 100 -c 10

Summary:
  Requests:	100
  Total:	1.3025 secs
  Slowest:	1.0686 secs
  Fastest:	0.0089 secs
  Average:	0.1260 secs
  Requests/sec:	76.7757

  Total data:	8100 bytes
  Size/request:	81 bytes

Latency distribution:
  10% in 0.0104 secs
  25% in 0.0170 secs
  50% in 0.0228 secs
  75% in 0.0309 secs
  90% in 1.0503 secs
  95% in 1.0662 secs
  99% in 1.0686 secs

Details (average, fastest, slowest):
  DNS+dialup:	0.1260 secs, 0.0089 secs, 1.0686 secs
  DNS-lookup:	0.1016 secs, 0.0000 secs, 1.0159 secs
  req write:	0.0001 secs, 0.0000 secs, 0.0027 secs
  resp wait:	0.0213 secs, 0.0000 secs, 0.0436 secs
  resp read:	0.0005 secs, 0.0000 secs, 0.0148 secs

Status code distribution:
  [200]	100 responses

2. Squeeze UI

still under development.

Contributing

If you are interested in contributing to the Squeeze project, welcome to submit a PR.

Future Works

We use Project Board to track future works. If you are interested in the feature in the TODO list, please feel free to submit an issue.

License

Squeeze is released under the Apache 2.0 license. See LICENSE for details.