EC2/AWS Lambda how to get lowest latency

0

I'm kind of new to AWS and I have a project that requires lowest possible latency to a third party service that hosted on AWS. Resovled DNS of it looks like ecip_address.ap-northeast-1.compute.amazonaws.com

So i tested following AWS services for loading target get https://website.com (aka ecip_address.ap-northeast-1.compute.amazonaws.com) :

AWS Lambda ap-northeast-1 ~130 ms

EC2 Instance ap-northeast-1a ~110 ms

EC2 Instance ap-northeast-1c ~110 ms

EC2 Instance ap-northeast-1d ~110 ms

EC2 Instance ap-northeast-1-tpe-1a ~220 ms

EC2 Wavelength ap-northeast-1-wl1-kix-wlz-1 ~120 ms

EC2 Wavelength ap-northeast-1-wl1-nrt-wlz-1 ~80 ms

THIRDPARTY Tokyo vps ~50 ms

AWS CloudShell ap-northeast-1 ~18 ms

The question Is how this is even possible and how do I get AWS CloudShell latencies, because they are actually possible. P.S. Everything was tested on t3.medium and pretty much default settings

1 Answer
0

What's missing here is "what is the application" (i.e. is it web-based or something else?) and "where are you measuring the latency from" - because it's going to be variable depending on where the requests come from.

The short answer is "host the application in the region which is closest to your users". The longer answer is that there are many thing you can do to reduce latency but in the end you can't beat the speed of light. One answer might be to host in multiple regions but that increases the level of complexity required in your application.

If your application is web-based, consider using CloudFront. Because there are hundreds of points of presence around the world and it provides caching for HTTP objects.

If your application is not web-based you might consider Global Accelerator which uses the AWS global network to carry traffic from the points of presence to the nearest region where your application is hosted.

profile pictureAWS
EXPERT
answered 7 months ago
profile picture
EXPERT
reviewed 7 months ago
  • Application is the binance futures trading api endpoint, https://fapi.binance.com I'm measuring latency between raw python get request and response time

    P.S. I don't need to beat the speed of light, CloudShell latencies are just fine for me, because in optimized scenario they will be reduced down to ~4 ms, the question is how do i get these unoptimized cloudshell latencies on my EC2 servers

  • CloudShell is (under the hood) a compute-based service running in an AWS region. You should be able to get similar latency by using EC2 in the region that you're using CloudShell.

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions