0

When I invoke my lambda function it takes between 1 and 15 seconds to execute. If I invoke the function via the C++ SKD, I get timeouts. These timeouts seem to occur after a few seconds (this is human-judgment only, I did not actually time it).

Question: How do I tell the SDK to wait for slow lambdas to return and not to timeout?

Things that did not work:

In the JS SDK you can change this in the HTTP settings. This is is no such option in the C++ SDK HTTPOptions.

It does not help to give the lambda client a config with a larger connectionTimeoutMS (socket timeout). Also, the httpRequestTimeoutMs of the client is set to 0 by default, meaning it will wait forever.

I am using synchronous requests, which do not seem to have an extra option for timeouts.

Additional information:

I am using a single client to run multiple requests in parallel.

Error also happens if I am using async requests.

Related:

How do I troubleshoot retry and timeout issues when invoking a Lambda function using an AWS SDK?

User12547645
  • 6,955
  • 3
  • 38
  • 69

1 Answers1

0

Same thing gave me hard time once. You may have got the solution but for others, here is what I did. There is client configuration which can edit default connection time. Default connection time for sending request is 1 sec and for receiving it is 3 sec, if you get the request done in this time period than it is good otherwise a retry according to lambda setting will be invoked. The behavior of these two is well explained in their respective header file. you can also play with memory size of lambda higher the memory of lambda lower the response time for the same.

             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;
lalit gangwar
  • 389
  • 4
  • 10