'Java CompletionException: software.amazon.awssdk.core.exception.SdkClientException: Acquire operation took longer than the configured maximum time
Trying to make call to an aws lambda function but getting the following error:
java.util.concurrent.CompletionException: software.amazon.awssdk.core.exception.SdkClientException: Unable to execute HTTP request: Acquire operation took longer than the configured maximum time. This indicates that a request cannot get a connection from the pool within the specified maximum time. This can be due to high request rate.
Consider taking any of the following actions to mitigate the issue: increase max connections, increase acquire timeout, or slowing the request rate.
Using the awsasyncclient in aws sdk v2 java which invokes the lambda function
LambdaAsyncClient client = LambdaAsyncClient.builder().region(region_lambda).build();
How to increase maximum connections or increase idle time? What can be done here?
Solution 1:[1]
You need to create a custom HTTP by calling httpClient from your LambdaAsyncClient. Then all you have to do is add your custom settings like connection timeout acquisition (you can also add other customizations to increase throughput e.g, max concurrency, max connections).
Check here: Interface NettyNioAsyncHttpClient.Builder
Do this
NettyNioAsyncHttpClient customHttp = NettyNioAsyncHttpClient.builder()
.connectionAcquisitionTimeout(Duration.ofMillies(20000);
LambdaAsyncClient lambdaAsyncClient = LambdaAsyncClient.builder()
.region(region_lambda)
.httpClientBuilder(customHttp)
.build();
If that doesn't solve the problem, check if you're not overloading your lambda client with multiple requests on so short a time
Also, import the netty-nio-client dependency
implementation "software.amazon.awssdk:netty-nio-client"
Solution 2:[2]
vis the generic value verb and it prints nil pointers as<nil>because that makes most sense as a generic formatting. Note the word "default" in its description: It usespas default, not unconditionally.pprints pointer values and thus prints a nil pointer as0x0. Note thatpandvare different verbs.Yes, nil pointers are 0. But note that the strings
<nil>and0x0are not "the same".
(Tip: It is incredibly hard to learn things by trying to be clever with fmt.Printf as it contains a lot of (sensible) magic.)
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Gabriel Magalhães |
| Solution 2 | blackgreen |
