Quick background -- I want to test the speed of connecting from a client to a service I am building that has service endpoints in different places in the world (not necessarily AWS data centers for these service endpoints).

So it seems the best way to do this would be to setup AWS Lambda's all over the world that actually do this work, timing access to my service in different AWS data centers (regions) and looking at how Lambda's perform in different places. The Lambda opens a websocket connection and makes a bunch of requests to the service and calculates things like latency under different amounts of load.

The Lambda then returns these findings to an "app" that displays them nicely.

But I am finding Lambda is dropping connections using the same JS logic that runs just fine otherwise on a UNIX machine in node.js, for example.

So my question is -- is this suitable for Lambda? Am I abusing the purpose of Lambda?

  • This should be perfectly fine. Does it work intermittently, or not at all? Do you control the service being tested? If not, do you have permission? Mar 14 '19 at 20:36
  • I am getting intermittent results... I indeed do have control of the service that Lambda is calling. Mar 14 '19 at 21:53
  • It sounds like a valid use case. Your Lambda function isn't attached to a VPC, is it? A misconfiguration, there -- specifically, attaching to 2 subnets, only one of which is correctly configured to allow access to the Internet via a NAT Gateway -- can cause hit-and-miss connectivity. Mar 15 '19 at 0:58

It should work.

However keep in mind that Lambda execution is time-limited to 15 minutes execution time and has some other limits as well, for example the number of open sockets may bite you. Check out the limits here: AWS Lambda Limits

When it fails what kind of failure do you see?

  • Does it run out of time? Out of memory?
  • Did you check CloudWatch Logs for the exact error messages?
  • Can you enable some more debugging in the Lambda to narrow down the reason for the failure?

Also consider using AWS Fargate instead of Lambda for this kind of task - Fargate gives you more control over what happens inside the container and doesn't have any execution time limits.

Or if you want a truly distributed measuring maybe look at RIPE Atlas - it's a network of tiny probes deployed around the world that you can hire for custom measurements. It may or may not be suitable for your usecase.

Hope that helps :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.