微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

无法执行 HTTP 请求:获取操作花费的时间超过了配置的最长时间

如何解决无法执行 HTTP 请求:获取操作花费的时间超过了配置的最长时间

我正在 AWS 中运行一个批处理作业,它使用来自 SQS 队列的消息并使用 akka 将它们写入 Kafka 主题。我使用以下参数创建了一个 Sqs 异步客户端:

private static SqsAsyncclient getSqsAsyncclient(final Config configuration,final String awsRegion) {
    var asyncHttpClientBuilder = NettyNioAsyncHttpClient.builder()
            .maxConcurrency(100)
            .maxPendingConnectionAcquires(10_000)
            .connectionMaxIdleTime(Duration.ofSeconds(60))
            .connectionTimeout(Duration.ofSeconds(30))
            .connectionAcquisitionTimeout(Duration.ofSeconds(30))
            .readTimeout(Duration.ofSeconds(30));

    return SqsAsyncclient.builder()
            .region(Region.of(awsRegion))
            .httpClientBuilder(asyncHttpClientBuilder)
            .endpointOverride(URI.create("https://sqs.us-east-1.amazonaws.com/000000000000")).build();
}

private static SqsSourceSettings getSqsSourceSettings(final Config configuration) {
        final SqsSourceSettings sqsSourceSettings = SqsSourceSettings.create().withCloSEOnEmptyReceive(false);
        if (configuration.hasPath(ConfigPaths.SqsSource.MAX_BATCH_SIZE)) {
            sqsSourceSettings.withMaxBatchSize(10);
        }
        if (configuration.hasPath(ConfigPaths.SqsSource.MAX_BUFFER_SIZE)) {
            sqsSourceSettings.withMaxBufferSize(1000);
        }
        if (configuration.hasPath(ConfigPaths.SqsSource.WAIT_TIME_SECS)) {
            sqsSourceSettings.withWaitTime(Duration.of(20,SECONDS));
        }


        return sqsSourceSettings;
    }

但是,在运行我的批处理作业时,我收到以下 AWS 开发工具包异常: 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. Increasing the max connections can increase client throughput (unless the network interface is already fully utilized),but can eventually start to hit operation system limitations on the number of file descriptors used by the process. If you already are fully utilizing your network interface or cannot further increase your connection count,increasing the acquire timeout gives extra time for requests to acquire a connection before timing out. If the connections doesn't free up,the subsequent requests will still timeout. If the above mechanisms are not able to fix the issue,try smoothing out your requests so that large traffic bursts cannot overload the client,being more efficient with the number of times you need to call AWS,or by increasing the number of hosts sending requests

以前有人遇到过这个问题吗?

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐


Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其他元素将获得点击?
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。)
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbcDriver发生异常。为什么?
这是用Java进行XML解析的最佳库。
Java的PriorityQueue的内置迭代器不会以任何特定顺序遍历数据结构。为什么?
如何在Java中聆听按键时移动图像。
Java“Program to an interface”。这是什么意思?