DEV Community

Discussion on: How AWS Lambda Works Under The Hood

Collapse
 
kappaj2 profile image
Andre Kapp

You are actually able to write to the /tmp folder from the Lambda code. Used it for processing big files. Rather than allocate lots and lots of memory and money, upload the big file to /tmp folder and read line-by-line and process. This gives you 512MByte data.
You are also able to share EFS file system between multiple Lambda's - very neat when you need to spin up more than one Lambda to process your workload.

Something interesting with the hot/cold Lambda's and running your own threads. When the main thread enters the Lambda and spins up other threads, you need to make 100% sure those threads ens before the main thread exits.
AWS will stop the Lambda when the main thread exits. When a new request comes in and the Lambda wakes up again, those old threads start running again. This is so difficult to trace until you actually realized what happened!

Great article!