Skip to content

Lambda Function URL: Handling High Concurrency Without 429 Errors

0

I have a Lambda function with the following SAM template configuration:

AWSTemplateFormatVersion: '2010-09-09'
Transform: AWS::Serverless-2016-10-31
Description: An AWS Serverless Application Model template describing your function.
Resources:
  SIMKULIAHendpointscrappingscheduleandfillattendace:
    Type: AWS::Serverless::Function
    Properties:
      CodeUri: .
      Description: 
      MemorySize: 1000
      Timeout: 900
      Architectures:
        - x86_64
      EphemeralStorage:
        Size: 1000
      Environment:
        Variables:
          # Environment variables omitted for brevity
      EventInvokeConfig:
        MaximumEventAgeInSeconds: 21600
        MaximumRetryAttempts: 2
      FunctionUrlConfig:
        AuthType: NONE
        InvokeMode: BUFFERED
        Cors:
          AllowCredentials: false
          AllowOrigins:
            - '*'
          ExposeHeaders: []
          AllowHeaders:
            - autosim_usk_api_key
          AllowMethods:
            - GET
            - POST
          MaxAge: 0
      ImageUri: >-
    
      PackageType: Image
      # Other properties omitted for brevity

I'm experiencing throttling issues with CloudWatch when my Lambda function is invoked concurrently. This is causing problems with logging and monitoring my function's performance. My questions are:

How can I increase the CloudWatch throttling limits for my Lambda function to handle a higher number of concurrent invocations? Are there any specific settings in the Lambda or CloudWatch configuration that I should adjust to mitigate this throttling issue? What are the best practices for scaling CloudWatch usage in high-concurrency Lambda scenarios?

Any insights or suggestions on how to resolve this CloudWatch throttling problem would be greatly appreciated. Thank you!

asked 2 years ago271 views

2 Answers
0

Hi,

I would approach your problem differently: instead of increasing CW quotas to avoid throttling, I would integrate an intermediate async layer capturing your data and writing it to CW in a slightly delayed manner during peaks. This way you will decouple CA from Lambda and you will be able to go very high with in the concurrency of our Lambdas independently of the highest CW quota that you will be able to obtain.

I see 2 options: AWS Kinesis or AWS Managed Steaming for Kafka dependeing on what you prefer.

Best,

Didier

EXPERT

answered 2 years ago

0

What CW operation gets throttled? If you emit custom metrics from your function, I recommend that you use Embedded Metrics Format instead of using PutMetricData.

AWS
EXPERT

answered 2 years ago

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.