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ヶ月前

ログインしていません。 ログイン 回答を投稿する。

優れた回答とは、質問に明確に答え、建設的なフィードバックを提供し、質問者の専門分野におけるスキルの向上を促すものです。

質問に答えるためのガイドライン

関連するコンテンツ