同样的事情曾经让我很难过。您可能已经找到了解决方案,但对其他人来说,这就是我所做的。有客户端配置可以编辑默认连接时间。发送请求的默认连接时间为 1 秒,接收请求的默认连接时间为 3 秒,如果您在此时间段内完成请求,则更好,否则将调用根据 lambda 设置的重试。这两者的行为在它们各自的头文件中得到了很好的解释。
您还可以使用 lambda 的内存大小来提高 lambda 的内存,从而降低相同的响应时间。
Aws::Client::ClientConfiguration m_ClientConfig;
m_ClientConfig.requestTimeoutMs = 300000; // i.e. 300 seconds
m_ClientConfig.connectTimeoutMs = 300000;
/**
* Socket read timeouts for HTTP clients on Windows. Default 3000 ms. This should be more than adequate for most services. However, if you are transfering large amounts of data
* or are worried about higher latencies, you should set to something that makes more sense for your use case.
* For Curl, it's the low speed time, which contains the time in number milliseconds that transfer speed should be below "lowSpeedLimit" for the library to consider it too slow and abort.
*/
long requestTimeoutMs;
/**
* Socket connect timeout. Default 1000 ms. Unless you are very far away from your the data center you are talking to. 1000ms is more than sufficient.
*/
long connectTimeoutMs;