I'm currently facing a significant API latency issue with my gaming app's backend hosted on AWS (ECS/ALB) in the eu-west-2 region. Here's the latency I'm seeing for users:
- London: 100ms
- Malta: 200ms
- New Zealand: 700-1000ms
I've tried several solutions:
1. Implementing CloudFront, but it caused issues with authentication.
2. Using Global Accelerator, but there's no SSL termination.
3. Adding Cloudflare with Argo, still experiencing high latency of 700ms+
4. Combining Cloudflare, Global Accelerator, and ALB resulted in no improvement.
I'm restricted from going multi-region due to compliance and data regulations. Is the 700ms latency just a natural consequence of the distance from New Zealand to London, or is there something I'm overlooking? How do other platforms tackle this problem?
3 Answers
The fastest theoretical latency from London to NZ is about 65ms, but realistically, you'll deal with delays that pile up. Have you tested latency from an instance in the same account/zone? If internal latency is fine, then the problem likely lies in external networks. Look into Wireshark for other games; they might be using different protocols that handle latency better. Considering multi-region setups typically ensures better user experience; you might want to explore that route!
Unfortunately, physics is a factor here, and you can't magically reduce latency over such distances. Consider running your auth processes in eu-west-2, generating a token, and then keeping the game logic closer to users. Also, having no SSL termination on Global Accelerator shouldn’t be an issue since it should be pointing at your ALB where the termination happens.
You might want to set up a simple HTTP ping/pong endpoint in London. If you can get someone in that area to hit it, you'll get a baseline latency. If that shows high latency too, it might indicate that you need distributed state across multiple regions to solve this. The expected round trip latency from London to NZ is around 600-700ms anyway, so it's not surprising.
Though, keep in mind the absolute minimum would be closer to 100ms due to speed limits in fiber optics, not just in a vacuum.