0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

isucon練習記録

Last updated at Posted at 2025-02-08

途中経過の個人的な記録

参考:達人が教えるWebパフォーマンスチューニング 技術評論社

環境構築

チュートリアルどおりに進める

  1. git clone git@github.com:{{フォークした自分のユーザー名}}/private-isu.git
  2. cd webapp/sql
  3. curl -L -O https://github.com/catatsuy/private-isu/releases/download/img/dump.sql.bz2
  4. bunzip2 dump.sql.bz2
  5. docker compose up

ここで問題2つ発生

  1. 別pjで 3306 ポートを使っておりエラーとなった
    Error response from daemon: driver failed programming external connectivity on endpoint private-isu-mysql-1 (c0082d1461c3e9632461292ee5c07485f7afdfc7ae45c40017c8e1ba2ccded4e): Bind for 0.0.0.0:3306 failed: port is already allocated
    shimakura@shimakuraMacBookAir webapp % docker compose up
    
  2. mysqlサービスのポート割当を3306→3366に修正
        ports:
          - "3366:3306"
    
  3. 改めて docker compsoe up 実行し localhost:80 にアクセスするもusersテーブルが無いと出る
  4. DBの状況を確認するためmysqlに入って調査委
    1. docker compose exec -it mysql bash
    2. mysql -uroot -proot
    3. mysql> use isuconp
    4. mysql> show tables;
    5. 確かにusersテーブルが無いのでinitに失敗したのだろう
       +-------------------+
       | Tables_in_isuconp |
       +-------------------+
       | comments          |
       | posts             |
       +-------------------+
      
  5. ボリューム消してリトライ docker compose down
  6. docker volume rm private-isu_mysql
  7. docker compose up
  8. 改めて80番にアクセスすると期待しているtopページ見が見られたので解決

ベンチマーク実行

ベンチマーク用のコンテナ作成

  1. cd benchmarker/userdata
  2. curl -L -O https://github.com/catatsuy/private-isu/releases/download/img/img.zip
  3. unzip img.zip
  4. rm img.zip
  5. cd ../
  6. docker build -t private-isu-benchmarker .

ベンチマーク実行

  1. cd benchmarker
  2. docker run --network host -i private-isu-benchmarker /bin/benchmarker -t http://localhost -u /opt/userdata
  3. 上記実行時に docker stats 実行すると private-isu-mysl-1 コンテナのCPU使用率が90%超えとなり、mysqlに負荷かかっている事がわかる
  4. しばらくして以下の結果得られた
    {"pass":true,"score":1241,"success":1066,"fail":0,"messages":[]}
    
0
0
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
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?