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
AI時代のソフトウェア開発を考える(2025/07版) / Agentic Software Engineering Findy 2025-07 Edition
twada
PRO
91
30k
Azure AI Foundryではじめてのマルチエージェントワークフロー
seosoft
0
180
Discover Metal 4
rei315
2
140
Quand Symfony, ApiPlatform, OpenAI et LangChain s'allient pour exploiter vos PDF : de la théorie à la production…
ahmedbhs123
0
200
Flutterで備える!Accessibility Nutrition Labels完全ガイド
yuukiw00w
0
160
効率的な開発手段として VRTを活用する
ishkawa
0
140
設計やレビューに悩んでいるPHPerに贈る、クリーンなオブジェクト設計の指針たち
panda_program
6
2.2k
MDN Web Docs に日本語翻訳でコントリビュートしたくなる
ohmori_yusuke
1
130
AI時代の『改訂新版 良いコード/悪いコードで学ぶ設計入門』 / ai-good-code-bad-code
minodriven
19
7.5k
#QiitaBash MCPのセキュリティ
ryosukedtomita
1
1.4k
GitHub Copilot and GitHub Codespaces Hands-on
ymd65536
2
150
VS Code Update for GitHub Copilot
74th
2
650
Featured
See All Featured
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
30
2.1k
How to Ace a Technical Interview
jacobian
278
23k
Making the Leap to Tech Lead
cromwellryan
134
9.4k
The World Runs on Bad Software
bkeepers
PRO
69
11k
Java REST API Framework Comparison - PWX 2021
mraible
31
8.7k
Bash Introduction
62gerente
613
210k
Dealing with People You Can't Stand - Big Design 2015
cassininazir
367
26k
We Have a Design System, Now What?
morganepeng
53
7.7k
Stop Working from a Prison Cell
hatefulcrawdad
271
21k
Understanding Cognitive Biases in Performance Measurement
bluesmoon
29
1.8k
How to train your dragon (web standard)
notwaldorf
96
6.1k
Rails Girls Zürich Keynote
gr2m
95
14k
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