Go tool to check AWS region latencies

I connect to multi-region databases / services on AWS and need to find out what the closest region is, especially when deploying on many Fly regions. I’ve built a Go library that tracks this from each server, let me know if you need help using it or want different language versions of it.

If you already know the AWS and Fly regions in advance why not simply use a lookup table?

I understand there are network fluctuations, but I would imagine the closest geographical region will be on average the best one to use.

It’s possible to create the lookup table out of this data, but there’s no guarantee that geography will work well… network topology will likely be more important.

Even the lookup table would be pretty large, though, roughly 19 X 23 = 437 entries, and only slated to grow a lot with time.

The tool does a quick check and then does very low overhead checks once every 30 seconds or so.

This could be pretty useful for regions that aren’t 1-1 matches with AWS. It wouldn’t surprise me if latency varies enough that from EWR, for instance, you sometimes connect to us-east-1 and sometimes connect to us-east-2.

We’ve been meaning to setup Smoke Ping so you can see latency like this but haven’t gotten it done yet: https://oss.oetiker.ch/smokeping/

Do you want a JSON service for this? If you can run it on every Fly region with a common addressable URL it’ll be easy to call periodically from any Fly app and get a region/list to connect to quickly.

It’s possible to create the lookup table out of this data, but there’s no guarantee that geography will work well… network topology will likely be more important.

It depends. If you have the budget to run Dynamo on many regions that are very close together (eg: all AWS regions of Europe or US East) then yeah the latency approach makes sense. But if you’re just running an instance in Europe, one in US East, etc, then the latency approach is overkill.

Even the lookup table would be pretty large, though, roughly 19 X 23 = 437 entries, and only slated to grow a lot with time.

How so? Wouldn’t it be one Fly region for one AWS region?

No, if I’m running Dynamo in two regions, AWS1 and AWS2, I need to know which of them is closer from any of the 20 Fly regions, which isn’t possible unless I have the numbers for both. Since AWS1 and 2 are unknown, we need them all.

The question is not which AWS region out of them all is fastest from a given Fly region, its which of the AWS regions you’re using is the fastest.

Yeah, the system reevaluates latencies every 30 seconds with a weighted average. It’ll always route to the fastest, so would recommend periodic re-checking - that also provides free disaster recovery by indicating the next nearest region of one goes down.