Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
APIサーバのレスポンス速度をふわっと把握したかった
Search
ramo798
January 23, 2024
Programming
0
220
APIサーバのレスポンス速度をふわっと把握したかった
若手・学生サーバーサイドエンジニアLT会
ラクーンホールディングス x ゆめみ のコラボLT会です!
https://yumemi.connpass.com/event/301942/
ramo798
January 23, 2024
Tweet
Share
Other Decks in Programming
See All in Programming
What We Can Learn From OSS
inouehi
0
430
Apache Hive 4 on Treasure Data
ryukobayashi
1
420
Komplexe Oberflächen mit SVG und der Web Animation API
joergneumann
0
680
SIMD Parallel Programming with the Vector API
josepaumard
0
230
Introducing Kotlin Multiplatform in an existing mobile app - Workshop Edition | AndroidMakers Paris
prof18
0
150
はてなにおける CSS Modules、及び CSS Modules に足りないもの / CSS Modules in Hatena, and CSS Modules missing parts
mizdra
7
970
SwiftUIで使いやすいToastの作り方 / How to build a Toast system which is easy to use in SwiftUI
lovee
3
170
Sheets API使ってみた
toshi0383
2
160
Micro Frontends for Java Microservices - Utah JUG 2024
mraible
PRO
1
110
MicrosoftのPlatform Engineeringガイドを読んで実際になにかやってみた
ymd65536
1
500
Ruby GitHub Packages
bkuhlmann
0
640
DMMプラットフォームがTiDB Cloudを採用した背景
pospome
9
4.2k
Featured
See All Featured
Rebuilding a faster, lazier Slack
samanthasiow
74
8.2k
WebSockets: Embracing the real-time Web
robhawkes
59
7k
Fireside Chat
paigeccino
22
2.6k
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
20
1.7k
The Language of Interfaces
destraynor
151
23k
The Invisible Side of Design
smashingmag
294
49k
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
65
14k
Six Lessons from altMBA
skipperchong
22
3k
The World Runs on Bad Software
bkeepers
PRO
61
6.7k
Raft: Consensus for Rubyists
vanstee
133
6.3k
Embracing the Ebb and Flow
colly
80
4.2k
Happy Clients
brianwarren
92
6.4k
Transcript
APIサーバのレスポンス速度 をふわっと把握したかった ramo
目次 • 自己紹介 • やりたいこと • きっかけ • 技術選定の話 •
使い方 • 結果
自己紹介 ramo 仕事→ URIHOというサービス開発。 好きなフレームワーク→ remix, sveltekit マイブーム→ cloudflare workers
最近matzさんとツーショット撮りました
URIHOについて 販売企業 URIHOは企業間取引において発生する 売掛金の未払い・倒産に備える保証サービスです。 購入企業
やりたいこと バックエンドのAPIサーバのレスポンス速度を計測したい
きっかけとか → 社内の人がISUCONを楽しそうにやってて羨ましかった →→ 来年はでる → そういえば自分のやってるサービスはどうなっているのか? →→ いろんなパターンで測定してみたい →→→ データがいっぱあるときとか
きっかけとか 「推測するな、計測せよ」と常々言われいていますので 計測することにしました。
今回やろうと思ったこと ローカルで動くもので測れるようにしたい → 既存機能の改修したときのベンチマークしたい → テストデータを多くした場合に速度の低下が起きないか等を気づきたい バックエンドAPIのレスポンス速度の計測から始める → ミニマムに始める → システムの構成的に、ボトルネックはそこになりがち
技術選定 Locustというpythonのライブラリを使うことにしました。 テストシナリオをコードで記述ができる → pythonで前処理等が書ける →→ ログイン処理が楽。共有が楽。テストデータの挿入ができる
Locustの使い方 from locust import HttpUser, task, between class ApiUser(HttpUser): wait_time
= between(1, 5) def on_start(self): self.client.post("/accounts/sign_in", { "account[email]": "email", "account[password]": "password" }) @task def load_test_api_endpoint(self): self.client.get("/endpoint")
使い方 locust -f your_script_name.py
結果
結果と展望 → ローカルサーバなので実際の数値ではないですが、大まかに傾向が把握で きました。 → 定期的に測るようにして機能が増えていくごとにどのように変化していく かを測定できると面白そう → 大量のテストデータを作成しての挙動も確認できるので未来のしんどくな るポイントを発見できる可能性がある
以上です。