NBA Stats Subscription Levels: Free, Premium, and Enterprise

Limiting Concurrent Requests for Free Level in a Serverless Application

Prev Question Next Question

Question

You are a developer at a company that has built a serverless application that allows users to get NBA stats.

The application consists of three different levels of subscription Free, Premium and Enterprise, implemented using stages in API Gateway.

The Free level allows developers to access stats up to 5 games per player, and premium and enterprise get full access to the database.

Your manager has asked you to limit the free level to 100 concurrent requests at any given point in time.

How can this be achieved?

Answers

Explanations

Click on the arrows to vote for the correct answer

A. B. C. D.

Answer: B.

Option A is incorrect as changing Burst to 50 and Rate to 50 will mean that 50 concurrent requests can be made and processed at any given point in time.

Option B is CORRECT as changing Burst to 100 and Rate to 100 will allow 100 concurrent requests to be made and processed at any given point in time.

Option C is incorrect as changing Burst to 50 and Rate to 100 will allow 50 concurrent requests to be made but 100 processed at any given point in time.

The remaining 50 requests will be a 429 error and will have to retry after an interval.

Option D is incorrect as not all options are correct.

Reference:

https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-request-throttling.html https://aws.amazon.com/blogs/aws/new-usage-plans-for-amazon-api-gateway/

The correct answer to the question is B. Under usage plan for the stage change Burst to 100 and Rate to 100.

API Gateway provides the ability to create usage plans to limit and meter usage of API resources for different levels of subscription. Usage plans can define different limits on requests, such as the number of requests per second or the number of concurrent requests.

To limit the free level to 100 concurrent requests at any given point in time, we need to create a usage plan for the Free level and set the limit for concurrent requests to 100. We can achieve this by following these steps:

  1. In the API Gateway console, select the API for which you want to create a usage plan.
  2. Click on the "Usage Plans" option from the left-hand menu and click "Create".
  3. Enter a name for the usage plan and a description if necessary.
  4. Select the "Create a new API key" option if you want to require API keys for usage of this plan.
  5. Under "Throttling", set the "Max concurrent requests" to 100.
  6. Under "Quotas", set the desired limits for the number of requests per second or per day, depending on the needs of the application.
  7. Save the usage plan.

Once the usage plan is created, we need to associate it with the Free stage. We can do this by following these steps:

  1. In the API Gateway console, select the API and then select the "Stages" option from the left-hand menu.
  2. Select the Free stage and click on the "Associated Usage Plan" tab.
  3. Click on "Add usage plan" and select the usage plan that was just created.
  4. Save the changes.

Now, any requests made to the Free stage will be subject to the limits defined in the usage plan, including the limit of 100 concurrent requests at any given point in time.

Option A (Burst to 50 and Rate to 50) and Option C (Burst to 50 and Rate to 100) are incorrect because they do not meet the requirement of limiting the free level to 100 concurrent requests. Only Option B (Burst to 100 and Rate to 100) meets the requirement. Therefore, the correct answer is option B.