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개 답변
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
Saad
답변함 4달 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠