AWS WebSocket API: 'Internal Server Error' with Increased Connected Clients

0

Hello!

I have set up a WebSocket API on AWS with Lambda and DynamoDB following this AWS documentation.

When I test the WebSocket with just a few clients (like 2-3), everything works fine, including connections, disconnections, sending messages...

However, when I have a larger number of clients (around 150-200), I get an "Internal Server Error" message when attempting to send a message through the WebSocket API. (connect/disconnect works fine) {"action": "sendmessage", "message": "hello, everyone!"}

I followed all the settings in the AWS console as per the tutorial linked above. Do you have any idea what should be the problem?

  • Have you checked for throttling on your DynamoDB table? How are you handling errors in your Lambda, do you catch exceptions and return the correct response, otherwise it can return internal server error.

  • Hey, there is not throttling on the DynamoDB. For Lambda I used "the app creation template for AWS CloudFormation" from the tutorial above.

  • Did you check the Lambda for errors or timeouts?

  • I found throttles on the Lamda Dashboard https://imgur.com/a/M7gR32M How could I fix this? Sorry, new to AWS :D

2개 답변
1

From your comments it looks like you have both throttling and errors in your Lambda function. We have a great many resources describing throttling and how to overcome it:

By default, there are 1000 units of concurrency allocated to each AWS account per region. This capacity is shared by all the functions in your account, per region. What this implies is that no function in your account can be invoked simultaneously by a rate of more than 1000 times. And if more functions are being invoked at the same time, they will share from the 1000 available units

https://docs.aws.amazon.com/lambda/latest/operatorguide/throttling.html

https://aws.amazon.com/blogs/compute/understanding-aws-lambdas-invoke-throttle-limits/

https://docs.aws.amazon.com/lambda/latest/dg/invocation-retries.html

profile pictureAWS
전문가
답변함 7달 전
0

Hello,

Concurrency is a crucial factor to consider in AWS Lambda, as it can lead to application failures through a phenomenon known as Throttling. By default, each AWS account is allocated 1000 units of concurrency per region, shared among all functions in that region. This means that no function can be invoked more than 1000 times simultaneously, and if more invocations occur simultaneously, they will share from the available 1000 units. However, this limit can be increased by requesting support from AWS. Throttling in AWS Lambda happens when function invocations surpass the available concurrency units, resulting in the function not running and triggering a RateExceeded exception.

The following links should help you understand and give you more insights on how to troubleshoot throttling issues

https://repost.aws/knowledge-center/lambda-troubleshoot-throttling

https://aws.amazon.com/blogs/compute/understanding-aws-lambdas-invoke-throttle-limits/

AWS
답변함 7달 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인