Latency to sendMessage #4068
-
My send message function takes up to 800ms to send to the SQS service.
I'm using an EC2 instance with a queue in the closest region (sa-east-1) |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 1 reply
-
To help with latency investigations, we recommend enabling the SDK client-side metrics - for instructions please check our Developer Guide - https://docs.aws.amazon.com/sdk-for-java/latest/developer-guide/metrics.html |
Beta Was this translation helpful? Give feedback.
-
@debora-ito I believe the problem is that I am creating a new client every time I send a message. Does the SDK not have native connection pool? turning the client into a singleton drastically lowered the latency. |
Beta Was this translation helpful? Give feedback.
-
Reusing the same client for different requests resolved. |
Beta Was this translation helpful? Give feedback.
-
Hello! Reopening this discussion to make it searchable. |
Beta Was this translation helpful? Give feedback.
Each client manages its own connection pool. Reusing the same client for different requests is the recommended way. For more best practice tips, check https://docs.aws.amazon.com/sdk-for-java/latest/developer-guide/best-practices.html.