DVA-C02 Question 380
Select 2You are developing a serverless application using AWS Lambda. The application processes high volumes of image files uploaded to an S3 bucket. During peak hours, you notice increased latency and Lambda function timeouts. How can you optimize the application to handle these workloads more efficiently?
- A
Use Amazon SQS to decouple the image processing workload and process messages asynchronously.
- B
Enable AWS Lambda Provisioned Concurrency to handle sudden spikes in traffic.
- C
Compress the images in the S3 bucket to reduce processing time for the Lambda function.
- D
Increase the Lambda function timeout to accommodate longer processing times during peak hours.
- E
Use Amazon DynamoDB to store metadata about processed images for faster retrieval.
Show answer and explanation
Correct answers: A, B
Explanation
To optimize the serverless application for processing high volumes of image files, you can use Amazon SQS to decouple the workload, enabling asynchronous processing, and reduce the risk of Lambda timeouts. Additionally, enabling AWS Lambda Provisioned Concurrency helps handle sudden spikes in traffic by reducing startup latency. These approaches improve scalability and efficiency without requiring significant changes to the application architecture or logic.
- A. Correct.
Using Amazon SQS allows you to decouple the image processing workload by queuing the image processing tasks, enabling the Lambda function to process messages asynchronously and reducing the chance of timeouts.
- B. Correct.
Enabling AWS Lambda Provisioned Concurrency ensures that a specific number of function instances are ready to handle traffic, reducing cold start latency during sudden spikes.
- C. Incorrect.
Compressing images in the S3 bucket does not directly solve the issue of increased latency and timeouts. It might reduce the size of the images but does not address workload optimization.
- D. Incorrect.
Increasing the Lambda function timeout might temporarily avoid timeouts, but it does not optimize the application to handle large workloads efficiently.
- E. Incorrect.
Using Amazon DynamoDB for metadata storage is beneficial for faster metadata retrieval but does not directly optimize the image processing workload or reduce latency.