1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

HTTP負荷ツールについて

Last updated at Posted at 2019-04-06

HTTPのリクエストを大量に送ってEC2に負荷を掛けたい

サーバの負荷テストのための、何百万ものHTTPリクエストを発生させる方法
↑色々な負荷ツールの解説がありとても分かりやすかったです。

httperfのインストール Apache Benchよりは強力

(合計10万の接続が毎秒2万の固定レートで生成できるみたい)
AmazonLinuxへのインストール

$ sudo yum --enablerepo=* search httperf
No matches found

AmazonLinuxの標準の状態ではhttperfの含まれたリポジトリはないようです
Dagリポジトリにあるので、次のようにDagリポジトリを追加, インストール

$ sudo tee /etc/yum.repos.d/dag.repo <<'EOF' >/dev/null
[dag]
name=Dag
baseurl=http://ftp.riken.jp/Linux/dag/redhat/el6/en/$basearch/dag/
enabled=0
gpgcheck=1
gpgkey=http://ftp.iij.ad.jp/pub/linux/repoforge/RPM-GPG-KEY.dag.txt
EOF
$ sudo yum --enablerepo=dag install httperf

Tsung(サン?サング?)のインストール 高負荷、分散、マルチプロトコルのテストツール

(数百万のリクエストを生成できる)
2017年版 負荷テストツールTsungをAWS EC2 AmazonLinuxでクラスタリング構築↑すごくわかりやすく丁寧にまとめられてますの、参考になります。

[注意]

  • インスタンス起動時のストレージ設定では節約のためにインスタンスストアは削除
  • stress-test.xmlの2行目 "/usr/local/share/tsung/tsung-1.0.dtd"を実際に合わせる
    -Tsungサーバアップロードする公開鍵はTsungの公開鍵なのか確認できていません。
    -セキュリティーグループのインバウンド設定は22だけではだめでtcp0-65535をすべて開かないとダメかも
    コマンドプロンプトのコマンド
    -一度テストでssh接続しておかないと負荷テストを実行できない
    -pemじゃないとssh localhostできない
    コマンドプロンプトの公開鍵のアップロードコマンド
    limits.conf変更は10240が最大にしないと不具合が起こる
pscp.exe C:\Users\hage\Downloads\test.pem ec2-user@(IP):/home/ec2-user/.ssh/

コマンドプロンプトでレポートのダウンロード

pscp.exe -r ec2-user@(IP):/home/ec2-user/work/logs/log.tar.gz C:\Users\hage\Downloads
pscp.exe -r ec2-user@(IP):/home/ec2-user/work/logs/20190404-1025 C:\Users\game\Downloads

windowsだからかtarでダウンロードするとうまく画像が表示できないので圧縮せずにダウンロードしました。

テスト実行とレポートの作成

tsung -l logs -f stress-test.xml start //Tsungテスト実行
cd logs/20170505-0532
/usr/local/lib/tsung/bin/tsung_stats.pl --stats tsung.log5 //グラフ作成

sudo yum -y install httpd
sudo service httpd start
cp -a /home/quaduser/.tsung/log/20190404-1026 /var/www/html/ //web公開
http://(IP)/20190404-1025/graph.html

注意

pemでid_rsaにファイル名を変更してアクセス権を0400に変更して、ssh localhost

1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?