DEV Community

Discussion on: Make your lambda functions lightweight

Collapse
 
rdpravin1895 profile image
Pravin Kumar Damodaran

How do layers make lambda lightweight? Does it cause any improvement in lambda performance, other than making the code visible in the lambda console?

Collapse
 
cemdev profile image
Cesar Muñoz

Hi Pravin, it will be the same performance
The goal here is to make your lambda more consistent, to only have the code that needs to be run (everything else must be excluded)
Assume we have 100 lambdas and all of them need a dependency to MySQL.
Each function will have the node_modules with MySQL on it.
If you're deploying each artifact will package the node_modules, it will take so much time to deploy everything and upload to s3.
In the way I explain in the article, it will create a zip file with the modules and that's it.
All the functions will only have the code (and it will weigh nothing), so it will be fast in deployment time, and with configuration saying this lambda needs this layer