Test tool go-stress-testing/fortio/vegeta user experience

go-stress-testing

Introduction

go-stress-testing is a stress testing tool implemented by the go language. Its source code is open source and supports secondary development. It can stress test http, webSocket requests, and private rpc calls. It uses coroutines to simulate a single user and can use the CPU more efficiently. resource

Instructions

  • download link
  • Note that the project source code needs to be cloned to the $GOPATH directory
  • mac computer download as follows
  • image.png
  • Put it in the $GOPATH directory
  • image.png
    • empowerchmod +x go-stress-testing-mac
  • Execute in this directory ./go-stress-testing-macto view usage
  • image.png

Test request Baidu page

./go-stress-testing-mac -c 1 -n 100 -u https://www.baidu.com/

image.png

  • It's pretty easy to use, and it also supports secondary development

Summary of advantages

  • It is easy to use and only needs simple command line parameter settings to complete the stress test.
  • Multiple protocols are supported, including HTTP, TCP, UDP, etc.
  • The generated reports are intuitive and easy to analyze.

Shortcomings summary

  • It has relatively few functions and does not support many advanced features.

fortio

Introduction

Fortio runs at the specified queries per second (qps) and calculates the percentage by recording a histogram of the execution time. (ex: p99, the response time, means that 99% of requests take less than this number). Fortio supports running for a set duration, a fixed number of invocations, or until interrupted.
Fortio is also very fast, lightweight (its docker image is only 4MB, with minimal dependencies), and supports secondary development, supports embedded go libraries, and can be used in the form of command-line tools and server processes. Its services include a simple web UI and REST API for triggering runs and viewing graphical representations of results (including min, max, mean, qps and percentile plots for individual latency graphs and multiple result comparisons)
fortio (httpbin-like) server-side features to help with debugging and testing: request echo (including request headers), add delay or error codes with probability distributions, tcp echo, tcp proxy, http fanout/scatter and gather proxy Server, GRPC echo/health and http etc.

Use and install

  1. The minimum version of go is 1.18
  2. install commandgo install fortio.org/fortio@latest
    1. You can also use brew to installbrew install fortio
  3. start upfortio server
    1. In particular, this command needs to be run in the $GOPATH directory

problems encountered

  • Under the MAC system, use go install fortio.org/fortio@latestthe installation fortioto fortioinstall it to the $GOPATH/bin directory
  • Move it to binthe same level as the directory, run with ./fortio server, you can see the following output
  • image.png
  • The UI page is displayed as follows
  • image.png

test run

image.png

  • generated result

image.png

Summary of advantages

  • Easy to operate with UI interface
  • Active community, high attention, guaranteed quality
  • Also supports secondary development
  • Supports a variety of advanced features, such as distributed stress testing, persistent connection testing, TLS encryption support, etc.
  • Simple to use, provides a visual interface, easy to use and analyze.

Shortcomings summary

  • The threshold for using is relatively high, and it takes more time to learn and use all English
  • For some complex scenarios, it is necessary to write annotations to achieve.

vegeta

Introduction

Vegeta is a general purpose HTTP load testing tool that was built based on the need for an HTTP service with a constant request rate. Available both as a command line and as a library.

Use and install

Install

  • brew update && brew install vegeta
    • The command execution error
    • You can execute brew cleanupor close the window or wait for a while before installing
  • Install using go
    • go install github.com/tsenart/vegeta@latest
    • As follows, the installation is successful
    • image.png

test use

  1. After the installation is successful, $GOPATH/binyou can see the downloaded binary file in the directory
  2. Enter $GOPATH/binthe directory and execute ./vegetato view the help information of the command line

  1. Steps for usage
  2. Write test scripts
    1. Write a file containing all the requests to be tested, such as test.txt Each request occupies one line, the format is as follows
请求方法 URI1
请求方法 URL2
{"post请求": "请求参数"}
  1. run test
    1. echo "GET [https://www.baidu.com/"](https://www.baidu.com/) | vegeta attack -duration=5s | tee results.bin | vegeta report
    2. Explanation: [https://www.baidu.com/](https://www.baidu.com/)Initiate a 5-second GET request, record the result in the results.bin file, and then display a report on the request
    3. The test results are as follows
    4. image.png
    5. You can see the generated results.bin file in the current directory

Summary of advantages

  • It has strong flexibility and can realize stress testing of various complex scenarios through a simple configuration file.
  • Supports HTTP/1.1, HTTP/2 and TCP protocols.
  • The generated reports are detailed and easy to analyze.

Shortcomings summary

  • The learning curve is steep and requires a certain learning cost.
  • No visual interface, not very easy to use.

Summarize

Which stress testing tool to choose depends on specific needs and scenarios. If you need to support a variety of advanced features and distributed stress testing, fortio is more suitable. If you need a more flexible testing tool, you can choose vegeta; if your requirements are relatively simple, you can choose go-stress-testing

end flowering

  • I wish you a happy life

reference

https://github.com/link1st/go-stress-testing
https://github.com/fortio/fortio
https://github.com/tsenart/vegeta

Guess you like

Origin blog.csdn.net/GoNewWay/article/details/130887182