Lock in $30 Savings on PRO—Offer Ends Soon! ⏳
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
ISUCON で使えるツールを作った
Search
kanata
May 10, 2022
Technology
0
1.4k
ISUCON で使えるツールを作った
社内 LT で話した資料です。
紹介するツールは公開しておりますが、動作の保証はいたしかねます。
*
isucontinuous
*
デモ動画
*
デモで利用したリポジトリ
kanata
May 10, 2022
Tweet
Share
More Decks by kanata
See All by kanata
今 SLI/SLO の監視をするなら Sloth が良さそうという話
shotakitazawa
2
1.2k
CloudNative Days を支える CI/CD ワークフローの変遷
shotakitazawa
2
1.9k
OpenFlow について
shotakitazawa
0
85
Kubernetes で Pod ができるまで
shotakitazawa
3
1.1k
Spinnaker で Blue-Green Deployment やってみた
shotakitazawa
1
1.4k
Other Decks in Technology
See All in Technology
特別捜査官等研修会
nomizone
0
580
「図面」から「法則」へ 〜メタ視点で読み解く現代のソフトウェアアーキテクチャ〜
scova0731
0
510
AWS運用を効率化する!AWS Organizationsを軸にした一元管理の実践/nikkei-tech-talk-202512
nikkei_engineer_recruiting
0
170
Knowledge Work の AI Backend
kworkdev
PRO
0
270
日本の AI 開発と世界の潮流 / GenAI Development in Japan
hariby
1
480
ActiveJobUpdates
igaiga
1
320
Bedrock AgentCore Memoryの新機能 (Episode) を試してみた / try Bedrock AgentCore Memory Episodic functionarity
hoshi7_n
2
1.9k
松尾研LLM講座2025 応用編Day3「軽量化」 講義資料
aratako
7
3.9k
Bedrock AgentCore Evaluationsで学ぶLLM as a judge入門
shichijoyuhi
2
250
ソフトウェアエンジニアとAIエンジニアの役割分担についてのある事例
kworkdev
PRO
0
270
業務の煩悩を祓うAI活用術108選 / AI 108 Usages
smartbank
9
12k
AR Guitar: Expanding Guitar Performance from a Live House to Urban Space
ekito_station
0
230
Featured
See All Featured
Unsuck your backbone
ammeep
671
58k
Making Projects Easy
brettharned
120
6.5k
Unlocking the hidden potential of vector embeddings in international SEO
frankvandijk
0
130
Embracing the Ebb and Flow
colly
88
4.9k
Done Done
chrislema
186
16k
Sam Torres - BigQuery for SEOs
techseoconnect
PRO
0
150
Building Flexible Design Systems
yeseniaperezcruz
330
39k
The untapped power of vector embeddings
frankvandijk
1
1.5k
Google's AI Overviews - The New Search
badams
0
870
Put a Button on it: Removing Barriers to Going Fast.
kastner
60
4.1k
The Spectacular Lies of Maps
axbom
PRO
1
400
The Organizational Zoo: Understanding Human Behavior Agility Through Metaphoric Constructive Conversations (based on the works of Arthur Shelley, Ph.D)
kimpetersen
PRO
0
200
Transcript
ISUCON で使えるツールを 作った 北澤 祥太 / kanata 1
$ whoami 北澤 祥太 / kanata / かなた @kanatakita ShotaKitazawa
所属: LINE 株式会社 Verda 室ネットワーク開発チーム (2022/04〜) 趣味: ラーメン、スノボ、自宅鯖構築、イベント裏方 ISUCON歴: ISUCON6〜 • ISUCON11 予選作問担当, ISUCON9・7 本戦出場 (7は学生枠) 2 よく使う アイコン
突然ですが ISUCON 知ってますか? 3
「ISUCON」は、LINE株式会社の商標または登録商標です。(https://isucon.net) ISUCON とは、LINE株式会社が運営窓口となって開催している 「お題となる Web サービスを決められたレギュレーションの中で 限界まで高速化を図るチューニングバトル」です。 (Twitter より) 4
5 web サービスが動いているサーバの ssh アクセス情報が競技者に渡される 競技者がベンチマークを実行するとベンチ用マシン から競技者用マシンへ沢山のリクエストが飛ぶ リクエストが捌けた数等で算出される点数を競う 様々なミドルウェアや特定の言語 (Go,
Python, Ruby, ...) で書かれた Web アプリケーションが配置されている 雑な紹介
ツールの誕生背景 • ISUCON で勝つためには「実装→ベンチマーク→プロファイリング」の フィードバックループを限りなく高速に回すことが必要 • もともと弊チームでは以下のデプロイスクリプトを実装し利用していた ◦ 開発用ソフトウェアのインストール ◦
git リポジトリ上のソースコードをデプロイ ◦ プロファイルデータを Slack に POST (プロファイリングは手動) • 競技中、上記スクリプトに困らせられることが多々... ◦ スクリプト内に環境依存な処理がある (eg. web サーバは nginx 前提) ▪ ISUCON10f は Envoy ◦ プロファイルデータ収集スクリプトが複数台構成に対応していない ◦ 複数人でのデプロイが考慮されていない ▪ 「デプロイしまーす」「いいよー」 6
isucontinuous https://github.com/ShotaKitazawa/isucontinuous • 「開発→デプロイ→ベンチマーク→プロファイリング」の一連の流れを 複数人で行いやすくするためのツール • 8 種のサブコマンドを提供 ◦ init,
setup, import, push, sync, deploy, profiling, afterbench • 各種コマンドは設定ファイル (isucontinuous.yaml) を元に動作 7
init 8 isucontinuous local-repo └─── isucontinuous.yaml setup Git local repository
host01 host02 host03
setup 9 isucontinuous host01 host02 host03 install some software (eg.
Docker) based on isucontinuous.yaml local-repo └─── isucontinuous.yaml
import 10 host01 host02 host03 /etc/nginx /etc/mysql ... /etc/nginx /etc/mysql
... /etc/nginx /etc/mysql ... isucontinuous local-repo ├──── isucontinuous.yaml ├──── host01/… ├──── host02/… └──── host03/… download some files from servers based on isucontinuous.yaml
push 11 isucontinuous host01 host02 host03 local-repo ├──── isucontinuous.yaml ├────
host01/… ├──── host02/… └──── host03/… push to remote repository
sync 12 isucontinuous host01 host02 host03 local-repo ├──── isucontinuous.yaml ├────
host01/… ├──── host02/… └──── host03/… fetch & merge from remote repository
deploy 13 isucontinuous host01 host02 host03 local-repo ├──── isucontinuous.yaml ├────
host01/… ├──── host02/… └──── host03/… fetch & switch to detached branch deploy some files to servers based on isucontinuous.yaml /etc/nginx /etc/mysql ... /etc/nginx /etc/mysql ... /etc/nginx /etc/mysql ...
profiling 14 isucontinuous host01 host02 host03 execute profiling command via
ssh based on isucontinuous.yaml
afterbench 15 isucontinuous host01 host02 host03 execute analyze command via
ssh based on isucontinuous.yaml post profile data
isucontinuous.yaml (1/3) setup: docker: netdata: version: latest public_port: 19999 alp:
version: v1.0.8 slack: default_channel_id: "C012BGJSJMC" hosts: - host: localhost user: &user root key: &key /root/.ssh/id_rsa 16
isucontinuous.yaml (2/3) hosts: - … (省略) deploy: &deploy slack_channel_id: ""
pre_command: >- rm -f "{{.Env.ACCESSLOG_PATH}}"; rm -f "{{.Env.SLOWLOG_PATH}}"; post_command: >- sudo systemctl restart mysql nginx && sudo systemctl restart isucondition.go.service targets: - src: nginx target: /etc/nginx - src: mysql target: /etc/mysql - src: go target: /home/isucon/webapp/go compile: make 17
isucontinuous.yaml (3/3) hosts: - … (省略) profiling: &profiling command: >-
PPROF_TMPDIR=/pprof/{{.Git.Revision}} /home/isucon/local/go/bin/go tool pprof /home/isucon/webapp/go/isucondition http://localhost:6060/debug/fgprof?seconds=90 after_bench: &after_bench slack_channel_id: "" target: /profile/{{.Git.Revision}}/ command: >- mkdir -p /profile/{{.Git.Revision}}; PPROF_FILENAME=$(ls /root/pprof/tmp/ -tr | tail -n1); if [ -f "/root/pprof/tmp/$PPROF_FILENAME" ]; then /home/isucon/local/go/bin/go tool pprof -top -cum /root/pprof/tmp/$PPROF_FILENAME > /profile/{{.Git.Revision}}/pprof_top_cum; fi; cat "{{.Env.ACCESSLOG_PATH}}" | alp ltsv -r --sort sum > /profile/{{.Git.Revision}}/accesslog; cat "{{.Env.SLOWLOG_PATH}}" | docker run -i --rm matsuu/pt-query-digest > /profile/{{.Git.Revision}}/slowlog; 18
ユースケース1: 初期セットアップ 1. init : ローカルリポジトリの新規作成 2. isucontinuous.yaml の編集 3.
setup : 各種開発用ソフトウェアのインストール 4. import : 各種設定ファイルやソースコードを Git で管理 5. push : GitHub に push 19
ユースケース2: 開発・デプロイ 1. GitHub に push したリポジトリを元に各メンバーが各ブランチで作業 ※ 開発用ローカルリポジトリは isucontinuous
により作成されたものとは別に用意 2. deploy : 特定リビジョンの各ファイルを各サーバにデプロイ 3. profiling : 各サーバにてプロファイリング用コマンドを実行 4. afterbench : プロファイルデータを収集し Slack に送信 20
ユースケース3: 開発中サーバ上の新たなファイルを Git 管理 1. redis 等、サーバーに新たなミドルウェアがインストールされる 2. sync :
ローカルリポジトリを remotes/origin/master と同期 3. isucontinuous.yaml に新たな import/deploy 対象を追記 4. import : 各種設定ファイルやソースコードを Git で管理 5. push : GitHub に push 21
デモ (ユースケース2) https://drive.google.com/file/d/1exHR5T5_WDEHCfncA7RWrQoejPxHIRl0/view?usp=sharing 22
最後に ISUCON12, 勝ちたい!!! まずは参加枠争奪戦と0次予選 (当日時間通りに起きる) をがんばります。 予選参加確定プランは間に合わなかった... 23
参考 • isucontinuous ◦ https://github.com/ShotaKitazawa/isucontinuous • デモで利用したリポジトリ ◦ https://github.com/ShotaKitazawa/isucon11q-20220505 24