Tool: AWS region to region latency calculator

We had a project for work to create a secondary infrastructure in Europe, our main one being in Canada (for legal reasons). During the conversation, there was a question as to whether we would need to replicate everything, or if the European services could leverage some of the Canadian ones.

Of course that would allow us to save a pretty penny on EC2 costs, but what about the end user performance impact of making requests that need to physically travel back and forth the Atlantic Ocean.

I embarked on the (quick) journey to build a tool that would estimate the minimum amount of time (ms) required for a packet to make that trip, based on physics.

The premise is that a packet of information may not travel faster than the speed of light. This premise is backed by the fact that the speed of light is the fastest speed at which energy, matter and information can travel. (source)

With this constant, along with the geographical positions of AWS data-centers, plus some maths for the actual distance on the globe (the earth is a sphere, after all), we are left with the theoretical minimal latency that can be expected for a packet to travel from one region to the other.

Now, the next step was to get a rough idea of a full round trip (or ping) time in ms. For this, I had to read into this paper of network hops and the added latency that is expected: (source)

Once put together, I was able to get the minimal round trip overhead from Europe (eu-west-1) to Canada (ca-central-1)

Ping: 53.89 ms
...and now comparing with actual numbers

Ping: 78.75 ms
It's not exactly accurate, but it can give us a lot of insights:

- We can plan SLAs more accurately for routes needing to reach other AWS regions,
- We can estimate infrastructure overhead and potentially detect outages (if we take the full round trip time from the European service's request, then subtract the minimal ping value and the Canadian service's response time, we're left with the infrastructure overhead)

Anyways, that's all I had for today.


Posts les plus consultés de ce blog

Blogging isn't for me

What it means to be a backend developer