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
Serverless Performance 実測比較 / Serverless Perfor...
Search
Y. Sakamoto
August 01, 2019
Programming
1
1.3k
Serverless Performance 実測比較 / Serverless Performance Measured Comparison
AWS Lambdaの対応言語が増え、言語バージョンもアップデートされているため、改めてコールドスタート(アプリ起動)と通常処理の処理速度を計測してみた。
Y. Sakamoto
August 01, 2019
Tweet
Share
More Decks by Y. Sakamoto
See All by Y. Sakamoto
サーバーレスをJavaで組むためのSpring Cloud Function入門 / Introduction to Spring Cloud Function to build serverless in Java
phonypianist
2
3.9k
Other Decks in Programming
See All in Programming
250830 IaCの選定~AWS SAMのLambdaをECSに乗り換えたときの備忘録~
east_takumi
0
400
Improving my own Ruby thereafter
sisshiki1969
1
160
JSONataを使ってみよう Step Functionsが楽しくなる実践テクニック #devio2025
dafujii
1
630
Updates on MLS on Ruby (and maybe more)
sylph01
1
180
プロポーザル駆動学習 / Proposal-Driven Learning
mackey0225
2
1.3k
Swift Updates - Learn Languages 2025
koher
2
510
2025 年のコーディングエージェントの現在地とエンジニアの仕事の変化について
azukiazusa1
24
12k
Design Foundational Data Engineering Observability
sucitw
3
200
HTMLの品質ってなんだっけ? “HTMLクライテリア”の設計と実践
unachang113
4
2.9k
複雑なフォームに立ち向かう Next.js の技術選定
macchiitaka
2
220
🔨 小さなビルドシステムを作る
momeemt
4
690
チームのテスト力を鍛える
goyoki
3
890
Featured
See All Featured
実際に使うSQLの書き方 徹底解説 / pgcon21j-tutorial
soudai
PRO
188
55k
Understanding Cognitive Biases in Performance Measurement
bluesmoon
29
1.9k
Testing 201, or: Great Expectations
jmmastey
45
7.7k
Embracing the Ebb and Flow
colly
87
4.8k
Imperfection Machines: The Place of Print at Facebook
scottboms
268
13k
Evolution of real-time – Irina Nazarova, EuRuKo, 2024
irinanazarova
8
930
The Straight Up "How To Draw Better" Workshop
denniskardys
236
140k
[RailsConf 2023] Rails as a piece of cake
palkan
57
5.8k
The Art of Delivering Value - GDevCon NA Keynote
reverentgeek
15
1.7k
Designing for humans not robots
tammielis
253
25k
Done Done
chrislema
185
16k
Principles of Awesome APIs and How to Build Them.
keavy
126
17k
Transcript
1 Copyright © Acroquest Technology Co., Ltd. All rights reserved.
Serverless Performance 実測比較 2019-08-01 Acroquest Technology株式会社 阪本 雄一郎 Serverless Meetup Osaka
Copyright © Acroquest Technology Co., Ltd. All rights reserved. 2
阪本 雄一郎 @phonypianist アクロクエストテクノロジー株式会社 シニアアーキテクト兼大阪事業所所長 • IoT、サーバーレスアーキテクチャ - 社会インフラ向け制御システム - 公共交通向け設備管理システム • BCI • 「Java本格入門」執筆
Acroquestのミッション・ビジョン Copyright © Acroquest Technology Co., Ltd. All rights reserved.
3 テクノロジストチームとして ビジネスの革新的価値創出に挑戦する ビジョン Acroquestの創り出す技術で 地球を感動で進化させる ミッション
「働きがいのある会社(GPTW)」 ランキング(従業員25~99人部門) 1位 を 3回 受賞 1位 1位 1位
Copyright © Acroquest Technology Co., Ltd. All rights reserved. 5
Serverlessなプログラムを開発するとき 何の言語を使用しますか?
Copyright © Acroquest Technology Co., Ltd. All rights reserved. 6
Node.js Python Ruby Java C# Go PowerShell
Copyright © Acroquest Technology Co., Ltd. All rights reserved. 7
Serverlessで注意すべきポイントの1つ 「コールドスタート問題」
Copyright © Acroquest Technology Co., Ltd. All rights reserved. 8
リクエストが稀であれば、 WarmUpツール等を使う手はアリ
Copyright © Acroquest Technology Co., Ltd. All rights reserved. 9
リクエストがそれなりに多い場合 どうなるか?
Copyright © Acroquest Technology Co., Ltd. All rights reserved. 10
新たに対応が増えた言語、 新バージョンに対応した言語もあるため、 言語別に パフォーマンスをチェックしてみる
Copyright © Acroquest Technology Co., Ltd. All rights reserved. 11
言語 バージョン Python 3.7 / 3.6 / 2.7 Node.js 10.15 / 8.10 Ruby 2.5 Java 8 Go 1.x C# / PowerShell 2.1 (.NET Core) 2018/11/19 Python3.7に対応 2019/05/15 Node.js 10に対応 2018/09/11 PowerShellに対応 2018/01/15 Go言語に対応 ※2019/08/01現在
Copyright © Acroquest Technology Co., Ltd. All rights reserved. 12
計測に使用したサンプルプログラムは 以下の2つを連続して行う ① 500万件の要素の線形検索 ② スリープ100ms CPUを使う 処理の模倣 IO待ち 処理の模倣
Copyright © Acroquest Technology Co., Ltd. All rights reserved. 13
計測対象言語 Node.js Python Java Go ※守備範囲の言語だけ勝手にチョイス・・・ ネイティブ スクリプト コンパイル
Copyright © Acroquest Technology Co., Ltd. All rights reserved. 14
コード例(Node.js) exports.handler = (event, context, callback) => { const number = Number(event.pathParameters.number) let number_list = new Array(number); for (let i = 0; i < number; i++) { number_list[i] = i + 1; } let result = (number_list.find(e => e == number) == number); setTimeout(() => callback(null, { statusCode: 200, headers: { 'Content-Type': 'application/json’ }, body: JSON.stringify({result: result}) }), 100); }
Copyright © Acroquest Technology Co., Ltd. All rights reserved. 15
計測方法 ① Lambdaのメモリは256MB、512MB ② Karate-Gatlingで10ユーザ/s、100 ユーザ/sのリクエストを送信
Copyright © Acroquest Technology Co., Ltd. All rights reserved. 16
256MB 10ユーザ/s @Python リスト作成が 遅い
Copyright © Acroquest Technology Co., Ltd. All rights reserved. 17
256MB 10ユーザ/s @Node.js スクリプトでも 高速
Copyright © Acroquest Technology Co., Ltd. All rights reserved. 18
256MB 10ユーザ/s @Java Cold Start 4秒 スクリプト より高速
Copyright © Acroquest Technology Co., Ltd. All rights reserved. 19
256MB 10ユーザ/s @Go Javaと ほぼ同じ Cold Startが 速い
Copyright © Acroquest Technology Co., Ltd. All rights reserved. 20
512MB 100ユーザ/s @Python 速度が大きく 改善している
Copyright © Acroquest Technology Co., Ltd. All rights reserved. 21
512MB 100ユーザ/s @Node.js 少し高速化 大きな遅延なし
Copyright © Acroquest Technology Co., Ltd. All rights reserved. 22
512MB 100ユーザ/s @Java 少し高速化
Copyright © Acroquest Technology Co., Ltd. All rights reserved. 23
512MB 100ユーザ/s @Go Javaと ほぼ同じ
0 2000 4000 6000 8000 Min 50th 75th 95th 99th
Max レスポンスタイム(ms) Python Node.js Java Go Copyright © Acroquest Technology Co., Ltd. All rights reserved. 24 256MB 10ユーザ/s Pythonはメモリ 不足気味 JavaはCold Start の影響
0 2000 4000 6000 8000 Min 50th 75th 95th 99th
Max レスポンスタイム(ms) Python Node.js Java Go Copyright © Acroquest Technology Co., Ltd. All rights reserved. 25 512MB 10ユーザ/s メモリ/CPUが増えて 全体的にタイム改善
0 2000 4000 6000 8000 10000 Min 50th 75th 95th
99th Max レスポンスタイム(ms) Python Node.js Java Go Copyright © Acroquest Technology Co., Ltd. All rights reserved. 26 256MB 100ユーザ/s Pythonはメモリ 不足気味 Cold Startの割合が 相対的に減る かなり遅い奴が出てくる
0 2000 4000 6000 8000 10000 Min 50th 75th 95th
99th Max レスポンスタイム(ms) Python Node.js Java Go Copyright © Acroquest Technology Co., Ltd. All rights reserved. 27 512MB 100ユーザ/s メモリ/CPUが増えて 全体的にタイム改善 かなり遅い奴も 多少は改善
Copyright © Acroquest Technology Co., Ltd. All rights reserved. 28
まとめ ① GoはCold Startが速い ② Cold Startを除外するとJavaはGoと大して変 わらない ③ リクエストが多くなると、Cold Startに時間がか かる可能性がある ④ Pythonのlist生成はメモリを食う
Copyright © Acroquest Technology Co., Ltd. All rights reserved. 29
今のところの所感 安定したレスポンスを求める場合→Go スクリプトで手軽に書きたい場合→Node.js やっぱり非同期にしたい・・・
Copyright © Acroquest Technology Co., Ltd. All rights reserved. 30
追加資料 (ここからは発表していません)
Copyright © Acroquest Technology Co., Ltd. All rights reserved. 31
質疑応答のところで 「numpyだと速くないですか?」 と問われたので、 1パターン追加してみました。
0 2000 4000 6000 8000 10000 Min 50th 75th 95th
99th Max レスポンスタイム(ms) Python Python(numpy) Node.js Java Go Copyright © Acroquest Technology Co., Ltd. All rights reserved. 32 512MB 100ユーザ/s リスト生成も検索も Java並に高速になった Cold Startも Node.jsとほぼ同じ
Copyright © Acroquest Technology Co., Ltd. All rights reserved. 33
numpyはほぼnativeなので、 numpyが使える部分ではかなり高速 (今回の評価目的としては少し反則w)
Copyright © Acroquest Technology Co., Ltd. All rights reserved. 34
ご清聴ありがとうございました Evolve the Earth with Emotion of Technology