How to measure request for minute for AWS Java SDK

Viewed 222

I want to gain some insights into the performance of my application that connects to several services in AWS e.g. IAM and S3. One metric interesting to me is requests-per-minute, I have checked around for possible approaches, AWS Metrics is limited to enterprise customers as stated in this AWS document. Another approach is generating Java SDK metrics, via CloudWatch. I have enabled this by adding the command below to the system property

-Dcom.amazonaws.sdk.enableDefaultMetrics=credentialFile=/path/aws.properties

I see some metrics in the CloudWatch dashboard, however, there is no request-per-second. I'd like to find out if someone has experience with this or maybe I am missing something.

2 Answers

I have come across this problem. But the problem I came across is that I wanted to control the number of requests so that the number of API calls will not exceed the relevant quotas.

I solved it by using the RateLimiter class from Guava library, which is an open-source common libraries for java by Google, which can control the rate of process happening.

I was able to limit the number of API calls to 3 times per second and then I got the issue solved. The import is → com.google.common.util.concurrent.RateLimiter;

Try it out https://www.baeldung.com/guava-rate-limiter

I hope it helps

Related