Macでbrewを使ってinstallしたsiegeを実行したかったのですが、"Lifting the server siege..."というところで止まり、テストが最後まで進まないことが多くありました。
siege自体のバージョンが古かったのですが、Dockerで環境を作ると、とりあえずうまくいったのでメモしておきます。
1.Docker定義ファイルをクローン
git clone https://github.com/yokogawa-k/docker-siege.git
2.Docker Buildを実行
$ docker build -t yokogawa/siege .
3.DockerのUbuntuに入る
$ ./run bash
4.siege.configを実行
# siege.config
5.apt-get updateしてvimを入れる
# apt-get update
# apt-get install vim
6.basic認証を設定
# vi /root/.siegerc
7.作業内容をsaveしておく(別ウインドウで実行)
$ docker ps -a
$ docker commit <container_id> test:test
8.siegeを実行する
# siege -c50 -t60S -v https://www.testtest.jp
** SIEGE 3.0.8
** Preparing 10 concurrent users for battle.
The server is now under siege...
HTTP/1.1 401 0.30 secs: 188 bytes ==> GET /
:
(省略)
:
Lifting the server siege... done.
Transactions: 376 hits
Availability: 100.00 %
Elapsed time: 59.59 secs
Data transferred: 3.24 MB
Response time: 0.21 secs
Transaction rate: 6.31 trans/sec
Throughput: 0.05 MB/sec
Concurrency: 1.31
Successful transactions: 376
Failed transactions: 0
Longest transaction: 0.57
Shortest transaction: 0.03
FILE: /var/log/siege.log
You can disable this annoying message by editing
the .siegerc file in your home directory; change
the directive 'show-logfile' to false.
9.またいつか実行したい時
$ docker run -it test:test
# siege -c50 -t60S -v https://www.testeest.jp
$ docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
e52708193580 test:test "/bin/bash" 15 minutes ago Exited (127) About a minute ago nervous_hermann
2bc32c231d7b ubuntu "/bin/bash" About an hour ago Exited (0) 17 minutes ago jolly_volhard
bbd1b38a6a0e yokogawa/siege "siege /bin/bash" About an hour ago Exited (0) About an hour ago sleepy_saha
$ docker start e52708193580
$ docker attach e52708193580
# siege -c50 -t60S -v https://www.testeest.jp