- Newest
- Most votes
- Most comments
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.
Relevant content
- Accepted Answerasked 3 years ago
- AWS OFFICIALUpdated 3 years ago
- AWS OFFICIALUpdated 2 months ago
- AWS OFFICIALUpdated 2 years ago
- AWS OFFICIALUpdated 3 months ago