aws sap 문제 풀이 12주차 문제풀이 3번

aws, sap, May 28, 2023

examptopics

Q22

A software company has deployed an application that consumes a REST API by using Amazon API Gateway, AWS Lambda functions, and an Amazon DynamoDB table. The application is showing an increase in the number of errors during PUT requests. Most of the PUT calls come from a small number of clients that are authenticated with specific API keys. A solutions architect has identified that a large number of the PUT requests originate from one client. The API is noncritical, and clients can tolerate retries of unsuccessful calls. However, the errors are displayed to customers and are causing damage to the API’s reputation. What should the solutions architect recommend to improve the customer experience?

A. Implement retry logic with exponential backoff and irregular variation in the client application. Ensure that the errors are caught and handled with descriptive error messages. B. Implement API throttling through a usage plan at the API Gateway level. Ensure that the client application handles code 429 replies without error. C. Turn on API caching to enhance responsiveness for the production stage. Run 10-minute load tests. Verify that the cache capacity is appropriate for the workload. D. Implement reserved concurrency at the Lambda function level to provide the resources that are needed during sudden increases in traffic.

생각들

답은 쉽게 맞출 수 있었는데, 생각해보니 API GW 에서 throttling 을 설정해본적이 없네. 어떻게 설정하는건지 간단히 알아봐야할듯.

그리고 429가 뭐였더라..

풀이 및 공부

답 : B

HTTP status code 429 : Too Many Requests

throttling 설정 방법

Usage Plans에서 아래와 같이 하면 될듯.

  • Rate : 초당 몇개의 requests를 허용 할지.
  • Burst는 뭔지 몰라서 찾아봤다. 아래에 설명

–>

Burst 정의

The burst limit defines the number of requests your API can handle concurrently

찾아보고 아차 싶었는데, 그 이유는 예전 프로젝트 당시 하드웨어에 액션을 동시에 하나만 줘야하는 상황이있어, 어떻게 처리할지 하다가 lambda의 concurreny 를 1로 설정했던 적이 있는데, api gw 자체에서도 이걸 제한 할 수 있구나.

역시 사람은 공부를 해야한다.

참고

  • https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-request-throttling.html
  • https://stackoverflow.com/questions/70423503/api-gateway-throttling-burst-limit-vs-rate-limit

Comments