Hacker News new | past | comments | ask | show | jobs | submit login

Why does AWS allow /tmp/ to hold data across executions? (just for speed?)

user@host:~ ls /tmp/

user@host:~ ls /tmp/

test

user@host:~ ls /tmp/

user@host:~ ls /tmp/

at_everyone__WHO_IS_MONITORING_THIS_QUESTIONMARK

aws.tgz

file.txt

foo

foo.txt

sshd-tar.gz

test

user@host:~ cat /tmp/egg.js

console.log(process.getuid())

user@host:~ cat /tmp/egg.js

Command failed: cat /tmp/egg.js

cat: /tmp/egg.js: No such file or directory




Exactly, it allows your function to cache state between executions if that state won't fit in RAM (up to 500MB). I use this to cache objects from S3 so I can avoid the latency of a round-trip for popular objects.


Yes. It's a common trick to speed up execution. If you have to download a big chunk of data to make your lambda work, you download it to /tmp, and then when you run you first check for it there.


So you can download and cache locally some resources then reuse them on next call while the function is still active (20 to 40 minutes based on my tests.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: