diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index 0fcf980..d40e676 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -1,7 +1,8 @@ # Release History -## v0.2.1 (2021-11-26) +## v0.2.1 (2021-12-02) +- feat: push load testing metrics to Prometheus Pushgateway - feat: report events with Google Analytics ## v0.2.0 (2021-11-19) diff --git a/docs/boomer.md b/docs/boomer.md new file mode 100644 index 0000000..bbfa9f1 --- /dev/null +++ b/docs/boomer.md @@ -0,0 +1,67 @@ +# Load Test + +## Run load test + +`HttpRunner+` supports running load test without extra work. You can use `hrp boom` command to run YAML/JSON testcases in load testing mode. + +By default, hrp will print load testing results in console output, refreshed every 3 seconds. + +``` +$ hrp boom examples/demo.json --spawn-count 10 --spawn-rate 1 +6:09PM INF Set log to pretty console +6:09PM INF Set log level to INFO +6:09PM INF Set log level to WARN +2021/12/02 18:09:48 Spawning 10 clients immediately +Current time: 2021/12/02 18:09:51, Users: 10, Total RPS: 20, Total Fail Ratio: 0.0% ++--------------+-----------------+------------+---------+--------+---------+------+------+--------------+------------+-------------+ +| TYPE | NAME | # REQUESTS | # FAILS | MEDIAN | AVERAGE | MIN | MAX | CONTENT SIZE | # REQS/SEC | # FAILS/SEC | ++--------------+-----------------+------------+---------+--------+---------+------+------+--------------+------------+-------------+ +| request-GET | get with params | 10 | 0 | 2400 | 2423.00 | 2422 | 2424 | 300 | 10 | 0 | +| request-POST | post json data | 10 | 0 | 310 | 304.50 | 301 | 307 | 420 | 10 | 0 | ++--------------+-----------------+------------+---------+--------+---------+------+------+--------------+------------+-------------+ + +Current time: 2021/12/02 18:09:54, Users: 10, Total RPS: 16, Total Fail Ratio: 0.0% ++--------------+-----------------+------------+---------+--------+---------+------+------+--------------+------------+-------------+ +| TYPE | NAME | # REQUESTS | # FAILS | MEDIAN | AVERAGE | MIN | MAX | CONTENT SIZE | # REQS/SEC | # FAILS/SEC | ++--------------+-----------------+------------+---------+--------+---------+------+------+--------------+------------+-------------+ +| request-GET | get with params | 18 | 0 | 1200 | 1157.39 | 1083 | 1367 | 300 | 9 | 0 | +| request-POST | post json data | 10 | 0 | 290 | 290.20 | 287 | 293 | 420 | 10 | 0 | +| request-POST | post form data | 20 | 0 | 310 | 300.00 | 287 | 311 | 441 | 10 | 0 | ++--------------+-----------------+------------+---------+--------+---------+------+------+--------------+------------+-------------+ + +Current time: 2021/12/02 18:09:57, Users: 10, Total RPS: 17, Total Fail Ratio: 0.0% ++--------------+-----------------+------------+---------+--------+---------+------+------+--------------+------------+-------------+ +| TYPE | NAME | # REQUESTS | # FAILS | MEDIAN | AVERAGE | MIN | MAX | CONTENT SIZE | # REQS/SEC | # FAILS/SEC | ++--------------+-----------------+------------+---------+--------+---------+------+------+--------------+------------+-------------+ +| request-GET | get with params | 12 | 0 | 1100 | 1153.92 | 1081 | 1464 | 300 | 6 | 0 | +| request-POST | post json data | 20 | 0 | 270 | 279.70 | 269 | 337 | 420 | 6 | 0 | +| request-POST | post form data | 20 | 0 | 270 | 272.85 | 269 | 279 | 441 | 10 | 0 | ++--------------+-----------------+------------+---------+--------+---------+------+------+--------------+------------+-------------+ +``` + +If you want to disable console output, you can add a `--disable-console-output` flag. + +``` +$ hrp boom examples/demo.json --spawn-count 10 --spawn-rate 1 --disable-console-output +``` + +You can reference this [doc](cmd/hrp_boom.md) for all command arguments. + +## Report metrics to Prometheus Pushgateway + +Besides printing load testing results in console, you can also push metrics to [Prometheus Pushgateway][pushgateway_github], and then you can configure pretty graphs on [Grafana][Grafana]. + +``` +$ hrp boom examples/demo.json --spawn-count 10 --spawn-rate 1 --prometheus-gateway http://127.0.0.1:9091 +``` + +You can deploy the Pushgateway using the [prom/pushgateway][pushgateway_docker] Docker image at ease. + +``` +$ docker pull prom/pushgateway +$ docker run -d -p 9091:9091 prom/pushgateway +``` + +[pushgateway_github]: https://github.com/prometheus/pushgateway +[pushgateway_docker]: https://hub.docker.com/r/prom/pushgateway +[Grafana]: https://grafana.com/ diff --git a/docs/cmd/hrp.md b/docs/cmd/hrp.md index 897a216..d7c0b4e 100644 --- a/docs/cmd/hrp.md +++ b/docs/cmd/hrp.md @@ -22,4 +22,4 @@ Copyright 2021 debugtalk * [hrp har2case](hrp_har2case.md) - Convert HAR to json/yaml testcase files * [hrp run](hrp_run.md) - run API test -###### Auto generated by spf13/cobra on 26-Nov-2021 +###### Auto generated by spf13/cobra on 2-Dec-2021 diff --git a/docs/cmd/hrp_boom.md b/docs/cmd/hrp_boom.md index 54beeed..734db53 100644 --- a/docs/cmd/hrp_boom.md +++ b/docs/cmd/hrp_boom.md @@ -23,10 +23,12 @@ hrp boom [flags] ``` --cpu-profile string Enable CPU profiling. --cpu-profile-duration duration CPU profile duration. (default 30s) + --disable-console-output Disable console output. -h, --help help for boom --max-rps int Max RPS that boomer can generate, disabled by default. --mem-profile string Enable memory profiling. --mem-profile-duration duration Memory profile duration. (default 30s) + --prometheus-gateway string Prometheus Pushgateway url. --request-increase-rate string Request increase rate, disabled by default. (default "-1") --run-tasks string Run tasks without connecting to the master, multiply tasks is separated by comma. Usually, it's for debug purpose. --spawn-count int The number of users to spawn for load testing (default 1) @@ -37,4 +39,4 @@ hrp boom [flags] * [hrp](hrp.md) - One-stop solution for HTTP(S) testing. -###### Auto generated by spf13/cobra on 26-Nov-2021 +###### Auto generated by spf13/cobra on 2-Dec-2021 diff --git a/docs/cmd/hrp_har2case.md b/docs/cmd/hrp_har2case.md index 9c584e2..41c62b7 100644 --- a/docs/cmd/hrp_har2case.md +++ b/docs/cmd/hrp_har2case.md @@ -23,4 +23,4 @@ hrp har2case harPath... [flags] * [hrp](hrp.md) - One-stop solution for HTTP(S) testing. -###### Auto generated by spf13/cobra on 26-Nov-2021 +###### Auto generated by spf13/cobra on 2-Dec-2021 diff --git a/docs/cmd/hrp_run.md b/docs/cmd/hrp_run.md index 66391dc..9c38ebf 100644 --- a/docs/cmd/hrp_run.md +++ b/docs/cmd/hrp_run.md @@ -30,4 +30,4 @@ hrp run path... [flags] * [hrp](hrp.md) - One-stop solution for HTTP(S) testing. -###### Auto generated by spf13/cobra on 26-Nov-2021 +###### Auto generated by spf13/cobra on 2-Dec-2021 diff --git a/mkdocs.yml b/mkdocs.yml index a46a300..2f510c2 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -62,5 +62,6 @@ nav: - hrp_run: cmd/hrp_run.md - hrp_har2case: cmd/hrp_har2case.md - hrp_boom: cmd/hrp_boom.md + - Load Test: boomer.md - Sponsors: sponsors.md - Release History: CHANGELOG.md