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.8k
Other Decks in Programming
See All in Programming
GitHub Copilotの全体像と活用のヒント AI駆動開発の最初の一歩
74th
7
2.6k
DataformでPythonする / dataform-de-python
snhryt
0
160
Constant integer division faster than compiler-generated code
herumi
2
610
パスタの技術
yusukebe
1
370
Bedrock AgentCore ObservabilityによるAIエージェントの運用
licux
9
640
Nuances on Kubernetes - RubyConf Taiwan 2025
envek
0
150
0から始めるモジュラーモノリス-クリーンなモノリスを目指して
sushi0120
0
280
CEDEC 2025 『ゲームにおけるリアルタイム通信への QUIC導入事例の紹介』
segadevtech
3
850
リッチエディターを安全に開発・運用するために
unachang113
1
380
WebAssemblyインタプリタを書く ~Component Modelを添えて~
ruccho
1
790
なぜ今、Terraformの本を書いたのか? - 著者陣に聞く!『Terraformではじめる実践IaC』登壇資料
fufuhu
4
580
『リコリス・リコイル』に学ぶ!! 〜キャリア戦略における計画的偶発性理論と変わる勇気の重要性〜
wanko_it
1
510
Featured
See All Featured
Typedesign – Prime Four
hannesfritz
42
2.8k
Making Projects Easy
brettharned
117
6.3k
Gamification - CAS2011
davidbonilla
81
5.4k
Fireside Chat
paigeccino
38
3.6k
Adopting Sorbet at Scale
ufuk
77
9.5k
Intergalactic Javascript Robots from Outer Space
tanoku
272
27k
VelocityConf: Rendering Performance Case Studies
addyosmani
332
24k
The Cost Of JavaScript in 2023
addyosmani
52
8.8k
Done Done
chrislema
185
16k
The Web Performance Landscape in 2024 [PerfNow 2024]
tammyeverts
8
760
Mobile First: as difficult as doing things right
swwweet
223
9.9k
Producing Creativity
orderedlist
PRO
347
40k
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