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 Performance Measured Comparison
Search
Y. Sakamoto
August 01, 2019
Programming
1
1.1k
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.1k
Other Decks in Programming
See All in Programming
Micro Frontends for Java Microservices - Devnexus 2024
mraible
PRO
0
490
Behind VS Code Extensions for JavaScript / TypeScript Linnting and Formatting
unvalley
5
920
Apache Hive 4 on Treasure Data
ryukobayashi
0
340
GraphQLサーバの構成要素を整理する #ハッカー鮨 #tsukijigraphql / graphql server technology selection
izumin5210
4
840
try!Swift Tokyo 2024 参加報告 LT
akidon0000
1
220
GitHub Actionsで泣かないためにやっておきたい設定 / Recommended GHA settings to avoid crying
pinkumohikan
3
540
Azure OpenAI Serviceのプロンプトエンジニアリング入門
tomokusaba
3
710
Anthropic Cookbook のおすすめレシピ
schroneko
7
980
見た目から始める生産性向上
ikumatadokoro
7
850
Ruby Pattern Matching
bkuhlmann
0
930
OpenAPIを中心に考えるAPI開発入門 / Introduction to API Development with a Focus on OpenAPI
seike460
PRO
2
170
二郎系ラーメンのコールで学ぶ AST 解析
memory1994
PRO
7
1.7k
Featured
See All Featured
Faster Mobile Websites
deanohume
299
30k
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
60
14k
Testing 201, or: Great Expectations
jmmastey
28
6.4k
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
34
8.9k
[Rails World 2023 - Day 1 Closing Keynote] - The Magic of Rails
eileencodes
2
1.3k
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
17
1.4k
XXLCSS - How to scale CSS and keep your sanity
sugarenia
241
1.2M
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
9
8.3k
Happy Clients
brianwarren
92
6.4k
Into the Great Unknown - MozCon
thekraken
10
990
Designing for humans not robots
tammielis
248
25k
Building Adaptive Systems
keathley
31
1.9k
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