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
GitHubとGitLabとAWS CodePipelineでCI/CDを組み比べてみた
satoshi256kbyte
4
230
Ruby×iOSアプリ開発 ~共に歩んだエコシステムの物語~
temoki
0
320
Cache Me If You Can
ryunen344
2
740
基礎から学ぶ大画面対応(Learning Large-Screen Support from the Ground Up)
tomoya0x00
0
460
Navigation 2 を 3 に移行する(予定)ためにやったこと
yokomii
0
230
Introducing ReActionView: A new ActionView-compatible ERB Engine @ Rails World 2025, Amsterdam
marcoroth
0
690
1から理解するWeb Push
dora1998
7
1.9k
Performance for Conversion! 分散トレーシングでボトルネックを 特定せよ
inetand
0
160
アルテニア コンサル/ITエンジニア向け 採用ピッチ資料
altenir
0
100
さようなら Date。 ようこそTemporal! 3年間先行利用して得られた知見の共有
8beeeaaat
3
1.4k
はじめてのMaterial3 Expressive
ym223
2
390
複雑なドメインに挑む.pdf
yukisakai1225
5
1.2k
Featured
See All Featured
Into the Great Unknown - MozCon
thekraken
40
2k
The Web Performance Landscape in 2024 [PerfNow 2024]
tammyeverts
9
810
jQuery: Nuts, Bolts and Bling
dougneiner
64
7.9k
Done Done
chrislema
185
16k
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
333
22k
Embracing the Ebb and Flow
colly
87
4.8k
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
34
6k
YesSQL, Process and Tooling at Scale
rocio
173
14k
How to Think Like a Performance Engineer
csswizardry
26
1.9k
XXLCSS - How to scale CSS and keep your sanity
sugarenia
248
1.3M
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
31
2.5k
Facilitating Awesome Meetings
lara
55
6.5k
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