By using AWS re:Post, you agree to the AWS re:Post Terms of Use

Network Latency in calling API

0

I have a Dot Net application which is continuously calling an API (POST Method with 150 bytes of JSON Body) . the API is providing response in millisecond but in AWS EC2, request sending is taking too much time. I have checked with Fiddler and found that delay is in between "Server Connected" and "Client Begin Request".

Please guide why this delay is there. In other server in another Cloud service provider, this delay is not coming.

Fiddler log for an API request.

ClientConnected: 11:30:20.782 ClientBeginRequest: 11:30:58.414 GotRequestHeaders: 11:30:58.414 ClientDoneRequest: 11:30:58.414 Determine Gateway: 0ms DNS Lookup: 0ms TCP/IP Connect: 0ms HTTPS Handshake: 0ms ServerConnected: 11:30:38.170 FiddlerBeginRequest: 11:30:58.414 ServerGotRequest: 11:30:58.414 ServerBeginResponse: 11:30:58.670 GotResponseHeaders: 11:30:58.670 ServerDoneResponse: 11:30:58.670 ClientBeginResponse: 11:30:58.670 ClientDoneResponse: 11:30:58.670

1 Answer
0

There are a few potential causes for the delay you are seeing between ServerConnected and ClientBeginRequest when calling your API from an EC2 instance:

  • Network routing - There could be slower network routing between the EC2 instance and the API endpoint, compared to your other cloud provider. Try testing from an EC2 instance in the same region as the API.

  • Instance size - Smaller EC2 instance types can have poorer network performance. Try using a larger instance size like m5.large to see if it improves.

  • SSL negotiation - The SSL handshake time will impact the connect time. You can try disabling SSL on the API side to isolate this.

  • Connection pooling - The API client may be reusing connections vs establishing new ones. Try increasing HTTP client pool sizes.

  • DNS resolution - Slow DNS resolution of the API domain will add delays. Use a fixed IP address instead of hostname.

  • VPC settings - If the API is accessed over VPC, check route tables, NACLs, proxy settings that could affect connectivity.

  • Load balancers - Any load balancers in front of the API can add latency. Try hitting an instance directly.

So in summary, focus on network routing, instance performance, and connectivity factors. Comparative testing from another provider in the same region can help narrow down where the delay is introduced.

AWS
answered a year ago

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