I was looking at ways to throttle the Amazon CloudWatch Async Client from making a lot of concurrent connections simultaneously as we in our company monitor AWS system of lot of customers which means the number of metrics being fetched reach thousands easily. which leads to network throttling/packet drops/rejection of requests by AWS.
Turns out there is a way to do this which was not apparent at first as I was looking at the API of AmazonCloudWatchAsyncClient. It is present as a property of ClientConfiguration class and the way to use it is as follows.
Turns out there is a way to do this which was not apparent at first as I was looking at the API of AmazonCloudWatchAsyncClient. It is present as a property of ClientConfiguration class and the way to use it is as follows.
AWSCredentials credentials = new BasicAWSCredentials(obj.getString("AWS_ACCESS_KEY"),obj.getString("AWS_SECRET_KEY")); ClientConfiguration config = new ClientConfiguration(); config.setMaxConnections(1); // This is done to create fixed number of connections per client AmazonCloudWatchAsyncClient client = new AmazonCloudWatchAsyncClient(credentials); client.setConfiguration(config);
No comments:
Post a Comment