Amazon ElastiCache vs API gateway edge-optimized endpoint

0

A car rental company has built a serverless REST API to provide data to its mobile app. The app consists of an Amazon API Gateway API with a Regional endpoint, AWS Lambda functions, and an Amazon Aurora MySQL Serverless DB cluster. The company recently opened the API to mobile apps of partners. A significant increase in the number of requests resulted, causing sporadic database memory errors.

Analysis of the API traffic indicates that clients are making multiple HTTP GET requests for the same queries in a short period of time. Traffic is concentrated during business hours, with spikes around holidays and other events.

The company needs to improve its ability to support the additional usage while minimizing the increase in costs associated with the solution.

Which strategy meets these requirements?

A. Convert the API Gateway Regional endpoint to an edge-optimized endpoint. Enable caching in the production stage.

B. Implement an Amazon ElastiCache for Redis cache to store the results of the database calls. Modify the Lambda functions to use the cache.

C. Modify the Aurora Serverless DB cluster configuration to increase the maximum amount of available memory.

D. Enable throttling in the API Gateway production stage. Set the rate and burst values to limit the incoming calls.

  • A. Convert the API Gateway Regional endpoint to an edge-optimized endpoint. Enable caching in the production stage.

    Here's why:

    Edge-optimized endpoint: This will bring the API Gateway closer to the clients, reducing latency and improving response times. Caching: This will store frequently accessed data in memory at the edge, reducing the load on the database and improving performance.

1 Answer
2

The correct answer is B. Implement an Amazon ElastiCache for Redis cache to store the results of the database calls. Modify the Lambda functions to use the cache.

This strategy meets the requirements for several reasons:

  1. Caching reduces database queries: By storing frequently accessed data in the cache, you can minimize the number of database calls, reducing the load on the Aurora Serverless DB cluster and alleviating memory errors.
  2. Improved performance: Caching provides faster response times, as Lambda functions can retrieve data from the cache instead of querying the database.
  3. Cost-effective: Implementing a cache is more cost-effective than increasing database resources or modifying the API Gateway endpoint.
  4. Scalability: ElastiCache for Redis is a scalable solution that can handle increased traffic during business hours, holidays, and events.
profile picture
EXPERT
Sandeep
answered a month ago
profile picture
EXPERT
reviewed a month ago
  • Edge-optimized api gateway can also enabling caching at the API Gateway level can significantly reduce the number of calls made to the backend Lambda functions and database, why is this not correct?

  • API Gateway caching can:

    1. Reduce the number of requests to Lambda functions and the database
    2. Decrease latency by serving cached responses directly from edge locations
    3. Lower costs by minimizing the number of requests to backend resources

    So, option A: Convert the API Gateway Regional endpoint to an edge-optimized endpoint and enable caching in the production stage, is indeed a correct and efficient solution to address the issue.

    Enabling caching at the API Gateway level is a great solution because it:

    1. Caches responses at the edge, closer to clients, reducing latency
    2. Reduces the load on Lambda functions and the database
    3. Is a managed service, easy to configure and maintain
  • Creating an Elastic Cache will also be more costly compared to edge-optimized endpoint?

  • Yes, creating an Elastic Cache would generally be more costly compared to using an edge-optimized endpoint.

    Use edge-optimized endpoint and caching in API Gateway. This will make the API faster and reduce load on the database.

  • Yes, creating an ElastiCache for Redis can be more costly compared to enabling caching at the API Gateway level, especially with an edge-optimized endpoint.

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions