Optimizing Lambda performance using /tmp directory caching

A company has a website that displays a daily newsletter. When a user visits the website, an AWS Lambda function processes the browser's request and queries the company's on-premises database to obtain the current newsletter. The newsletters are stored in English. The Lambda function uses the Amazon Translate TranslateText API operation to translate the newsletters, and the translation is displayed to the user. Due to an increase in popularity, the website's response time has slowed. The database is overloaded. The company cannot change the database and needs a solution that improves the response time of the Lambda function. Which solution meets these requirements?

  1. Change to asynchronous Lambda function invocation.
  2. Cache the translated newsletters in the Lambda/tmp directory. Source Reference Answer
  3. Enable TranslateText API caching.
  4. Change the Lambda function to use parallel processing.

Community Votes

B
100%

100% of anonymous learners picked answer B. Votes are pick records left by other test-takers — they are not the verified answer.

Community Insight

This question tests the use of Lambda's ephemeral /tmp storage for performance optimization, while the common trap is assuming the Amazon Translate API offers a built-in caching feature.

Caching translated content in the Lambda /tmp directory significantly reduces database load and API latency for recurring requests. The community consensus identifies this as the only viable option among the choices to improve response time without modifying the database.

Selecting "Enable TranslateText API caching" is a common mistake because it assumes a feature that does not exist in the Amazon Translate service.

Community Discussion (4 comments)

CloudChingon 👍 1 Selected: B
A company has a website that displays a daily newsletter. When a user visits the website, an AWS Lambda function processes the browser's request and queries the company's on-premises database to obtain the current newsletter. The newsletters are stored in English. The Lambda function uses the Amazon Translate TranslateText API operation to translate the newsletters, and the translation is displayed to the user. Due to an increase in popularity, the website's response time has slowed. The database is overloaded. The company cannot change the database and needs a solution that improves the response time of the Lambda function. Which solution meets these requirements? A. Change to asynchronous Lambda function invocation. B. Cache the translated newsletters in the Lambda/tmp directory. C. Enable TranslateText API caching. D. Change the Lambda function to use parallel processing.
wh1t4k3r 👍 2 Selected: B
B is correct. Why? All others make no sense. But using /tmp to cache this content is far from being optimal. AWS itself proposes using S3 or dynamo for caching of this kind: https://aws.amazon.com/pt/blogs/machine-learning/maximize-your-amazon-translate-architecture-using-strategic-caching-layers/ https://aws.amazon.com/pt/blogs/machine-learning/translating-your-website-or-application-automatically-with-amazon-translate-in-your-ci-cd-pipeline/ Using lambda's /tmp will solve the DB overload but create problems of performance by its own, AND probably increase costs.
KennethNg923 👍 3 Selected: B
B is correct. Caching the translated newsletters in the Lambda /tmp directory would significantly improve response times and reduce the load on the database. C is Wrong as Amazon Translate doesn't offer an API-level caching feature.
komorebi 👍 1
B. Cache the translated newsletters in the Lambda/tmp directory.

Comments & Corrections

No comments yet — spotted an error or have a note? Share it below.

Log in to comment, report an error, or add a note about this question.

Submitted for moderation before publishing. Keep it helpful and respectful.

Expert Analysis

Why the Answer Is Correct

Option B is correct because caching the translated output in the /tmp directory allows subsequent Lambda invocations within the same execution context to retrieve data instantly without querying the database or calling the Translate API. Since the newsletter is updated daily, the content remains static for extended periods, making repeated processing inefficient. This approach directly addresses the requirement to improve response time and reduce database load without altering the database infrastructure.

Why the Other Options Are Wrong

Option A is incorrect because asynchronous invocation is not suitable for a synchronous website request where the user expects an immediate response. Option C is incorrect because Amazon Translate does not provide a native, toggleable API-level caching feature. Option D is incorrect because the workflow is linear (fetch then translate), and parallel processing would not reduce the inherent latency of the database query or translation service.

Community Comment Notes

Commenters confirm that B is the only logical choice, noting that while /tmp is ephemeral, it is the only caching mechanism available among the options. One commenter pointed out that while AWS recommends S3 or DynamoDB for more robust caching layers, using /tmp is the intended answer within the constraints of the provided options.

Official Reference

Exam Strategy

When facing performance bottlenecks involving static or slowly changing data, prioritize caching strategies. Be skeptical of options that suggest enabling non-existent service features, such as native caching for Amazon Translate.

Related Analysis

Practice All DVA-C02 Questions

Access 100 questions with complete answers and detailed explanations.

View Full DVA-C02 Practice Test →

← Back to DVA-C02 Study Guide