![](https://tgfile.tg-static.com/static/web/img/placeholder.gif)
サーバーレスアンチパターン今昔物語 第2夜
![](https://tgfile.tg-static.com/static/web/img/placeholder.gif)
Pre Warming をするためには、本番で必要となる同時実行数分をリクエストし続ける必要があり、あまり意味があるものではない #serverless_newworld
2020-07-21 21:16:51![](https://tgfile.tg-static.com/static/web/img/placeholder.gif)
cold start引いた時の時間を短くする話がむしろ聞きたかったり #serverless_newworld
2020-07-21 21:17:25![](https://tgfile.tg-static.com/static/web/img/placeholder.gif)
LambdaをVPCモードで起動するとき、コールドスタートの時間を短縮するために、定期的にリクエストを発火してPre Warmingすることは良くありましたね (LambdaのVPCモード起動時間のエンハンスが入る前はよくあった話) #serverless_newworld
2020-07-21 21:17:34![](https://tgfile.tg-static.com/static/web/img/placeholder.gif)
予めLambdaを実行してwarm start 環境を作る。 Lambda初期はよく出た話ではないがおすすめでない。 事前に同時実行してPre-warmingを続けるのはキリがない。(処理分課金あるし) 設定変更してもコールドに戻るし。 ---- やりがちな対応な気がします。。。 #serverless_newworld
2020-07-21 21:17:36![](https://tgfile.tg-static.com/static/web/img/placeholder.gif)
SLI /SLOを明確にして、100%を目指すことを前提にするサービスにすべきじゃないってところかな。 #serverless_newworld
2020-07-21 21:18:38![](https://tgfile.tg-static.com/static/web/img/placeholder.gif)
#serverless_newworld Lambdaの同時実行数のバーストにも制限があるのか......緩和申請でなんとかなるもんだと思ってた。😨
2020-07-21 21:18:57![](https://tgfile.tg-static.com/static/web/img/placeholder.gif)
なるほどー。確かに事前にリクエストを送っても、リクエスト送ったやつしかコンテナ起動しないのか。言われれば腑に落ちるけど、気づいてなかった… #serverless_newworld
2020-07-21 21:18:58![](https://tgfile.tg-static.com/static/web/img/placeholder.gif)
同時実行数1,000以上にLimit Increaseしても、1,000まではすぐにさばいてくれるが、それ以降は1分ごとに500ずつ起動していく。スパイクが発生する場合は見落としがち。 #serverless_newworld
2020-07-21 21:19:54![](https://tgfile.tg-static.com/static/web/img/placeholder.gif)
バーストの制限については、忘れがち。。。確かに。 バーストの制限は、制限緩和もできない。 #serverless_newworld
2020-07-21 21:21:07![](https://tgfile.tg-static.com/static/web/img/placeholder.gif)
Lambdaのバースト制限は知らなかったな。同時に起動できるLambdaの数は最初は1000で1分ごとに500しか増えない #serverless_newworld
2020-07-21 21:21:45![](https://tgfile.tg-static.com/static/web/img/placeholder.gif)
Lambda functionに対する、実行リクエストのバースト制限は、東京リージョンで1,000リクエスト #serverless_newworld
2020-07-21 21:22:12![](https://tgfile.tg-static.com/static/web/img/placeholder.gif)
Lambdaの同時実行バーストは東京リージョンの場合は1,000まで。ハードリミットなので緩和できない。 #serverless_newworld
2020-07-21 21:22:20![](https://tgfile.tg-static.com/static/web/img/placeholder.gif)
急に同時実行のリクエストが来ても、Lambdaの動くコンテナはバースト制限の数分しか増えない。 (最初1000リクエスト、その後は500/分) Lambdaの動きの説明がすごいわかりやすい!! #serverless_newworld
2020-07-21 21:22:21![](https://tgfile.tg-static.com/static/web/img/placeholder.gif)
許可された同時実行数が30,000だとして、全然リクエストが来てない状態で、10,000リクエストが同時に来た場合、一気にその分コールドスタートするわけではなく、最初の段階では1,000リクエスト分までで、その後1分毎に500コンテナずつ起動される(東京リージョンの場合)。 #serverless_newworld
2020-07-21 21:22:46![](https://tgfile.tg-static.com/static/web/img/placeholder.gif)
Lambdaの最初のバーストは1000 その後は500/分ずつ増えていく てことは1000/sec以上受け付けるようなAPIは作れない・・・? #serverless_newworld
2020-07-21 21:22:49![](https://tgfile.tg-static.com/static/web/img/placeholder.gif)
Lambda のバーストリミットはリージョンによって異なる。#serverless_newworld
2020-07-21 21:22:56![](https://tgfile.tg-static.com/static/web/img/placeholder.gif)
上限緩和していても、一発目のスケーリングは1000までしかしないのか。んで、1分ごとに500増える。 (東京リージョンの場合) #serverless_newworld
2020-07-21 21:23:15![](https://tgfile.tg-static.com/static/web/img/placeholder.gif)
東京リージョンだと、バースト制限は1000, 他リージョンだと異なる docs.aws.amazon.com/ja_jp/lambda/l… #serverless_newworld
2020-07-21 21:23:22