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
サーバレス時代の負荷テスト戦略 / Load testing strategy for se...
Search
geeawa
January 22, 2020
Technology
18
4.5k
サーバレス時代の負荷テスト戦略 / Load testing strategy for serverless
geeawa
January 22, 2020
Tweet
Share
More Decks by geeawa
See All by geeawa
生成AIによる新しいUI/UX ~Generative UI の世界を感じよう~ / introducing-generative-ui
gawa
6
2k
実践的にAPIを開発していく - ソースコード管理とデリバリーを考えよう - / develop effective web api versioning
gawa
3
470
クラウドを駆使した開発〜AWS Lambda, Dev Tools, AppSync の革新的な最新アップデート〜 / reinvent2023-recap-serverless-meetup-tokyo-developer-experience
gawa
0
580
refactoring-serverless
gawa
1
1.8k
modern-frontend-design-pattern
gawa
9
5.6k
サーバレスブース展示物のアーキテクチャを語る / Serverless Booth Architecture at AWS Summit 2023
gawa
0
130
Effective AppSync ~ Serverless Framework を使用した AppSync の実践的な開発方法とテスト戦略 ~ / Effective AppSync
gawa
0
1.1k
オレをCI/CDする / my ci cd practice
gawa
6
2.5k
AWSのテスト技法とPolicy as Code / aws-testing-techniques-and-policy-as-a-code
gawa
4
1.2k
Other Decks in Technology
See All in Technology
Estrategias de escalabilidade para projetos web
jessilyneh
2
240
疎通2024
sadnessojisan
5
1k
「家族アルバム みてね」における運用管理・ オブザーバビリティの全貌 / Overview of Operation Management and Observability in FamilyAlbum
isaoshimizu
4
150
OCI で始める!! Red Hat OpenShift / Get Started OpenShift on OCI
oracle4engineer
PRO
1
160
Developer Experienceを向上させる基盤づくりの取り組み事例集
coconala_engineer
0
130
Jetpack Compose Modifier 徹底解説 / Jetpack Compose Modifier
wiroha
0
160
チームビルディングは"感性"で向き合おう / Team Building with Awareness
kohzas
0
170
四国のあのイベントの〇〇システムを45日間で構築した話 / cloudohenro2024_tachibana
biatunky
0
320
言葉は感情の近似値である。その感情と言葉の誤差を最小化しよう ~コミュニケーションにおけるアナログ/デジタル変換の課題に立ち向かう~
nktamago
0
150
Fediverse Discovery Providers overview
andypiper
0
160
自作Cコンパイラ 8時間の奮闘
soukouki
0
820
AI活用したくてもできなかった不動産SaaSの今とこれから
nealle
0
320
Featured
See All Featured
Designing the Hi-DPI Web
ddemaree
278
34k
Unsuck your backbone
ammeep
667
57k
Building Flexible Design Systems
yeseniaperezcruz
325
37k
For a Future-Friendly Web
brad_frost
174
9.3k
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
131
32k
Practical Orchestrator
shlominoach
185
10k
Designing Dashboards & Data Visualisations in Web Apps
destraynor
227
52k
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
28
8.9k
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
123
18k
How STYLIGHT went responsive
nonsquared
93
5.1k
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
41
6.5k
What’s in a name? Adding method to the madness
productmarketing
PRO
21
3k
Transcript
サーバレス時代 の 負荷テスト戦略 〜CircleCIで実現する継続的負荷テストとチューニングTips〜 2020.01.22 Serverless Meetup Tokyo #15
淡路⼤輔 / INTEC @gee0awa 好きな技術 Serverless / React Native
負荷テスト と サーバレス
Elasticity Performance, Scalability, Resilience
None
App
App EC2 r4.large × 1
App EC2 r4.large × 1 ApachBench
App EC2 r4.large × 1 ApachBench $ ab -n 100
-c 10 http://example.com
EC2 EC2 EC2 EC2 EC2 App r4.large × 5
EC2 EC2 EC2 EC2 EC2 App r4.large × 5
EC2 EC2 EC2 EC2 EC2 App r4.large × 5
Master EC2 EC2 EC2 EC2 App r4.large × 5
EC2 EC2 EC2 EC2 EC2 EC2 EC2 EC2 EC2 App
r4.large × 10 Master
EC2 EC2 EC2 EC2 EC2 EC2 EC2 EC2 EC2 EC2
EC2 EC2 EC2 EC2 App r4.large × 15 Master
・負荷に応じて Slave 台数をスケールさせたい ・サーバの⽤意に時間がかかる ・GUIでシナリオ作るとメンテしづらい ・EC2 ⾼い・・・ 課題
お⾦はかけたくない ⼤量リクエストを⽣成したい もっと簡単に導⼊したい Simple Performance Cost
⚡Artillery⚡
Node.js製のシンプルな負荷テストツール
Artillery scenario YAMLファイルに宣⾔的にシナリオを記述する 60秒間、20⼈の仮想ユーザがリクエスト
EC2 App ⚡Artillery⚡ $ artillery run senario.yml
CloudWatch, DataDog, aws-sigv4 etc..
EC2 App ⚡Artillery⚡ $ artillery run senario.yml
ECS Cluster App ⚡Artillery Pro⚡ $ artillery run senario.yml
Artillery + Lambda
None
serverless-artillery https://github.com/Nordstrom/serverless-artillery
None
InfluxDBに結果を保存、Grafanaで可視化
install deploy invoke remove serverless-artillery $ npm install -g serverless-artillery
$ slsart deploy —stage dev $ slsart invoke —stage dev $ slsart remove
Lambdaだから維持費ゼロ 負荷に応じたオートスケール YAMLによる宣⾔的シナリオ Simple Performance Cost
None
継続的負荷テスト 開発プロセスの早い段階から性能検証を⾏う
Github Developer commits yaml file 継続的負荷テスト CircleCIから負荷テストを実⾏する Invoke loadtest unittest
⚡ Serverless Artillery⚡
Github Developer commits yaml file 継続的負荷テスト unittest CircleCIから負荷テストを実⾏する loadtest Invoke
⚡ Serverless Artillery⚡ 処理が被ったらスキップされる
.circleci/config.yml シンプルなインタフェースで 実⾏できるようにしておく
None
None
プロダクションでは 様々なアクセスが想定される
負荷にランダム性を持たせる
Artillery scenario YAMLファイルに宣⾔的にシナリオを記述する 60秒間、20⼈の仮想ユーザがリクエスト この部分を ランダムに変化させる
シナリオファイルの負荷量を書き換える generateSenario.js duration, arrivalRate, phase数の最⼤・最⼩値だけ指定して ランダムな負荷を⽣成できるようにシナリオファイルを書き換える ChaosEngineering!!
負荷をランダムにする .circleci/config.yml
負荷テスト の 環境下 で アプリケーション を 開発する
App ⚡Serverless Artillery⚡
App ⚡Serverless Artillery⚡ get /todos get /todos/{{ id }} put
/todos/{{ id }} post /todos/{{ id }} delete /todos/{{ id }} TODOリスト アプリケーション https://github.com/serverless/examples/tree/master/aws-node-rest-api-with-dynamodb-and-offline
TODOリスト アプリケーション https://github.com/serverless/examples/tree/master/aws-node-rest-api-with-dynamodb-and-offline serverless examples の Node.js REST API
TODOリスト アプリケーション TODOリストに登録 Responseのjsonに含まれるidの値を保持 idを指定して1件取得 idを指定して1件更新 idを指定して1件削除 Artilleryのシナリオ
結果
キャパシティユニットが全然⾜りない DynamoDB
TODO⼀覧 ソース
全件スキャンになってる!! TODO⼀覧 ソース
AWS X-Ray 監視
PUT DELETE GET POST Lambdaの実⾏単位や DynamoDBへのリクエスト単位で 処理時間を計測
Lambda (cron) GetServiceGraph API Slack AWS X-Ray ALERT 監視 Response
time 4xx (error) 429 (throttling) 5xx (failure)
サーバレス時代 の 負荷テスト戦略 まとめ 宣⾔的シナリオ・低コスト・⾼負荷 継続的負荷テスト・ランダム性 分散トレーシング・監視 ⚡Serverless Artillery⚡ AWS
X-Ray CircleCI
ご静聴ありがとうございました