[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년 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠