Serverless-offline: Possible to limit memory?

Created on 6 Dec 2018  路  4Comments  路  Source: dherault/serverless-offline

Is there a way to set or emulate a max memory limit of a lambda function execution?

Most of us are probably developing on 8GB+ memory machines, but to be cost effective most probably run lambdas with low as possible memory on AWS. For some data/computation intensive apps it would be nice to develop with low memory restrictions offline.

For instance, can we limit the NodeJS process memory itself that serverless-offline uses?

question

All 4 comments

Found this while I was looking for something else, but would V8's --max-old-space-size parameter help? Something like node --max-old-space-size=512 ./node_modules/bin/serverless offline. From what I read, Node will limit the memory. I can't find the exact number but I thought it was 1,5GB.

Thanks, I'll test it and report back. I noticed a couple NodeJS processes running so wasn't sure if it was spawning some child NodeJS process we couldn't tweak.

@petermorlion You are right, running it in that way does restrict the memory as desired.

@petermorlion If there is a cli option maybe an API method exist, so we could pass the max memory usage as a cli parameter and use it to hamper the handlers.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

dnalborczyk picture dnalborczyk  路  3Comments

aldofunes picture aldofunes  路  3Comments

davidroman0O picture davidroman0O  路  4Comments

stonebraker picture stonebraker  路  3Comments

balintpeak picture balintpeak  路  4Comments