Free AWS DVA-C01 Actual Exam Questions - Question 11 Discussion
performance issues when it has to download a 50MB file from the Internet in every execution. This
function is called multiple times a second.
What solution would give the BEST performance increase?
D, because fetching from S3 is faster and consistent across all Lambda instances.
/tmp is ephemeral, so caching there only helps within one instance’s lifetime.
D imo, caching in S3 means the file is stored within AWS infrastructure, which is more stable and accessible across all Lambda instances compared to /tmp that’s limited to single container lifespan.
It’s A. Using /tmp avoids the overhead of going outside AWS every time, which is way slower. Even if the cache doesn’t persist across all instances, it still speeds up most calls significantly.
D, S3 caching is more reliable across instances than /tmp, which can get wiped.
A imo, caching in /tmp cuts out network calls almost completely for repeated executions on the same container, which happens a lot since the function runs multiple times a second.
D. Caching the file in Amazon S3 still beats downloading from an external internet source every time, and since S3 is inside AWS, it should be quicker and more reliable than hitting an outside URL. Also, S3 won’t get wiped out like the Lambda /tmp storage when containers spin up or down, so it’s a more stable cache overall. The downside is a slightly slower fetch than local disk, but way better than going outside AWS repeatedly.
A. Using /tmp to cache the file avoids repeated internet downloads and is way faster than fetching externally each time. Even if containers scale, most invocations will benefit from the cache.
A/D? The /tmp cache (A) is really fast since it’s local storage, and if the Lambda runs frequently on the same container, it won't redownload. But if AWS spins up new containers, the cache disappears. S3 (D) is more reliable and faster than fetching from the Internet but still slower than local disk. So if performance is the main goal, and the function calls are very frequent, local caching might give the best boost despite its limits. Increasing execution time or adding ELB doesn’t really help with download speed here.
A/D? Caching in /tmp is faster than re-downloading every time, but it’s ephemeral and might not persist if the function scales a lot. Storing it in S3 means a quick fetch inside AWS instead of external internet calls, which could also be faster. Between those two, I’d pick caching in /tmp for best speed since it avoids any network call after first download.