負荷テストツールのvegetaをインストールする

マニュアルの通りにインストールすると下記のようなエラーが出てしまう

> ./go get -u  github.com/tsenart/vegeta       
go: go.mod file not found in current directory or any parent directory.
        'go get' is no longer supported outside a module.
        To build and install a command, use 'go install' with a version,
        like 'go install example.com/cmd@latest'
        For more information, see https://golang.org/doc/go-get-install-deprecation
        or run 'go help get' or 'go help install'.

エラーによると最近はgo getだと外部モジュールのインストールができなくなっている模様。
次のようにするとインストール出来た

> go install github.com/tsenart/vegeta@latest

なおpowershellでパイプで使おうとすると

 echo  'GET http://localhost:38081/' |vegeta attack -duration=1s |vegeta report
2022/07/12 00:30:25 encode: can't detect encoding of "stdin"

このようなエラーが出るので、いったんファイルに出力する。

echo "GET http://localhost:38081/"|vegeta attack -duration=1s -output result2.bin
vegeta report -type=json result2.bin
{"latencies":{"total":133301700,"mean":2666034,"50th":2515050,"95th":5193200,"99th":9292000,"max":9292000},"bytes_in":{"total":3350,"mean":67},"bytes_out":{"total":0,"mean":0},"earliest":"2022-07-12T00:38:53.8787855+09:00","latest":"2022-07-12T00:38:54.8613487+09:00","end":"2022-07-12T00:38:54.8638598+09:00","duration":982563200,"wait":2511100,"requests":50,"rate":50.88731187978544,"throughput":50.75759259986785,"success":1,"status_codes":{"200":50},"errors":[]}

どうもpowershellのパイプがバイナリ流せないもよう。
しかもLinuxのパイプのように並列動作せず、いったんバッファリングしてしまうのでメモリも速度もコスト高いという…
なんということでしょう…

参考

コメントを残す

メールアドレスが公開されることはありません。 * が付いている欄は必須項目です