[Absolute beginner] - [Lambda Functions] - How large should a Function be?

0

My app uses lots of libraries (I am writing python 3.9, sklearn, numpy, plotly).

When I import them locally - I end up with 800Mb worth of content!

Documentation recommends far less and I was thinking if I should I break my app up into literally functions. The 'lean-ness' of function are really very appealing to me.

Do Lamba Functions get it their names literally as they shouldn't really be more than a function? How 'big' should a function be or should I be using a container instead? Can anyone give me some guidance?

質問済み 2年前355ビュー
2回答
1
承認された回答

In the Lambda documentation it talks to the limits on function size (50 MB zipped; 250 MB unzipped) so if your function needs to be larger than that then you'll need to go to a container.

That said: The smaller your function (usually through less dependencies) the better. It will load faster and (most probably) initialise quicker as well.

Otherwise, the only other advice is that functions should be (more or less) "single purpose" - that's the whole concept behind building microservices. But you can go too far down that path too. So it's a "how long is a piece of string" question - the best thing is to do what is manageable for you.

profile pictureAWS
エキスパート
回答済み 2年前
0

You're right I think I should break it down.

I wanted to respond and say it's so refreshing to hear someone respond with a real "there isn't really a right or wrong answer"... how far do you go with the division? 100% understand what you are saying here

I will re-evaluate my use case and rearchitect it - TBH I may even use a combination of function and container. Much appreciated.

回答済み 2年前

ログインしていません。 ログイン 回答を投稿する。

優れた回答とは、質問に明確に答え、建設的なフィードバックを提供し、質問者の専門分野におけるスキルの向上を促すものです。

質問に答えるためのガイドライン

関連するコンテンツ