Why the nearest cloud region on the map is often not the fastest, and how to measure it from your own browser
You are about to create a server, a database or a Kubernetes cluster, and the console asks for a region. The provider's map shows a dot in your country and another a few hundred kilometres over the border. The obvious choice is the one closest to you, or closest to most of your customers. Sometimes that's right. Sometimes the region next door answers in 9 ms and the one in your own city in 25, because your internet provider hands its traffic to the rest of the world at an exchange point in another country. You only find out after the database is full of data and moving it is a project.
This post explains why geography is such an unreliable guide to latency, why the common ways of checking it measure the wrong thing, and how the Find the Nearest Cloud Region test works out the real answer from the browser you are reading this in.
Latency is paid on every round trip
Latency is the time a message takes to get somewhere and for the reply to come back. It matters far more than its small numbers suggest, because almost nothing on the web is a single round trip.
Opening a fresh HTTPS connection to a server costs one round trip for the TCP handshake and, with TLS 1.3, another for the encryption handshake, before the first byte of the request is sent. Then the request and its response take a third. A page that loads a few scripts and calls an API or two adds more. And inside the application it gets worse: an API endpoint that makes twenty database queries one after another, with the database in a different region from the application server, pays the latency between them twenty times on every request.
So a difference of 40 ms per round trip is not 40 ms per page. It can be a quarter of a second on the first load, and seconds for a chatty backend talking across an ocean. That is why picking the region is one of the few infrastructure decisions that is both cheap to get right and expensive to change later.
Why distance on a map is a poor guide
The physics floor
Light in optical fibre travels at roughly two thirds of its speed in a vacuum, about 200,000 km per second, or 200 km per millisecond. A round trip covers the distance twice, so every 100 km of fibre adds about 1 ms of round-trip time. London to New York is about 5,600 km in a straight line, which puts the floor for a round trip at around 56 ms before a single router has done any work. Nothing you configure gets below that number.
Fibre doesn't follow straight lines
Cables follow coastlines, railways, motorways and the sea bed, and land at a limited number of cable stations. The path between two cities can easily be half as long again as the great-circle distance. Every router along the way adds a little queueing and processing time on top.
Your provider decides the route, not you
This is the part a map can't show. Your traffic leaves your home or office through your internet provider, which connects to the rest of the internet at a handful of places: its own data centres, internet exchange points where networks swap traffic, and paid transit links. Cloud providers connect at many of those same places, but not all, and the two may meet somewhere surprising. Examples of what that does in practice:
- A smaller ISP may hand all its international traffic to a transit provider in a hub city such as Frankfurt, Amsterdam, London, Singapore or Ashburn, so a region in that hub is effectively closer than one in your own country.
- Two providers in the same city that don't peer with each other locally can send traffic out of the country and back.
- Mobile networks often route everything through a few core sites, which may be nowhere near the user.
- A VPN moves your starting point to wherever the VPN server is, plus the detour to reach it.
None of this is visible from a region map, and it differs between your office line, your home connection and your customers' phones. The only reliable way to know is to measure from where the traffic actually starts.
The usual ways of checking, and what each one misses
Running ping yourself
The command-line ping sends ICMP echo packets and times the reply. It needs a hostname in each region that answers ICMP, and many cloud endpoints quietly drop it, so you get timeouts that say nothing about the region. Even where it works, finding a pingable address for each of a provider's 30 or 40 regions is an afternoon's job, and you have to repeat it for each provider you are comparing.
Measuring from a server
You can start a small VM and measure from there, or use a monitoring service that tests from its own machines. That tells you how far apart data centres are from each other, which is useful for replication between regions. It tells you nothing about your users, who don't sit in a data centre. A test machine in Frankfurt reaches a Paris region over a cloud backbone; a customer on a cable connection in Lyon may take a very different path.
Published latency tables
Some providers publish round-trip times between their own regions. They describe the provider's backbone, measured between its own machines, and again leave out the last mile from you to the cloud, which is where most of the variation lives.
Guessing from the speed test
A broadband speed test reports latency to whichever test server it picked, usually one run by or near your ISP. It confirms your line is healthy but says nothing about which cloud region is close.
Why a browser can't just ping
The obvious fix is to measure from the visitor's own browser, which starts exactly where real traffic starts. The obstacle is that a web page is deliberately boxed in. It can't send ICMP packets, can't open raw sockets and can't time a TCP handshake directly. All it can do is load things over HTTP and HTTPS, under the browser's cross-origin rules.
The first idea most people have is fetch(). Requests to another site are only readable when that site sends CORS headers allowing it, which the providers' endpoints mostly don't. A no-cors request avoids the check but gets an opaque response, and modern browsers now apply Opaque Response Blocking, which rejects many such replies outright. A healthy region would then look exactly like a failed one.
What does work is the oldest trick on the web: loading the URL as an image. The browser fetches it, and when the reply arrives it fires either onload (it was an image) or onerror (it wasn't). For timing purposes both mean the same thing: the server answered, and the clock can stop. The test's own code says this in a comment, with a warning not to swap it for fetch().
The catch with that trick. A hostname that doesn't exist also fires onerror, and does so quickly, because the DNS lookup fails at once. A region with a mistyped or retired hostname would look like the fastest, healthiest region on the list. That's why every region in the test is checked live before it's added, and why the project keeps a separate test suite that contacts each endpoint and requires a completed TLS handshake (and, for Google Cloud, a real 200 reply, because an unused Cloud Run address gets a catch-all 404 instead).
How the test measures
The test currently covers 23 providers and 462 regions, from AWS, Azure, Google Cloud and Oracle to object-storage services, GPU clouds and smaller hosts. Each provider has its own page, such as AWS, Azure or Google Cloud, so you only time the regions you are choosing between.
One endpoint per region
Each region is represented by a small endpoint the provider runs there: a storage endpoint, an API endpoint or a speed-test host. For AWS it is the regional EC2 endpoint's /ping path, for Azure a blob storage account in each region, for Google Cloud a Cloud Run service per region, for Vultr and Hetzner the ping and speed-test hosts they run in each location. What matters is that the server answering sits in that region.
A cache buster on every request
Every request has cache_buster= and the current time appended, so neither the browser nor anything in between can answer from a cache. A cached reply would come back in a fraction of a millisecond and win every time.
One region at a time
Regions are timed in turn, never in parallel. Parallel requests would compete for your connection and for the browser's connection limits, and the later ones in a batch would read slower for reasons that have nothing to do with the region. Sequential requests are slower to complete a full round but each sample is clean. A new round starts at most every two seconds, so a provider with only a few regions doesn't fire off hundreds of requests a minute.
A warm-up round that doesn't count
The first request to each region has to resolve its hostname, open a TCP connection and negotiate TLS before the request itself can go out: several round trips, plus whatever the DNS lookup costs. Later requests to the same host can reuse the open connection and pay for roughly one round trip plus the server's reply time. Mixing the two would make every region's first sample an outlier, so the first pass is shown in a Warm up column and left out of every statistic. Its column disappears once round 1 is complete.
A timeout, not a hang
A region that hasn't answered within 3 seconds is marked failed for that round, and the test moves on. One unreachable region can't stall the run, and failed rounds never pull the median down or up. The CSV export counts them separately, which is useful when one region fails often from your network.
Median first
Latency samples are not symmetric. Most land close to the true value, and a few are much slower: a Wi-Fi retransmission, a burst of traffic on your line, the browser busy with something else. Those spikes drag an average upward. The median, the middle value of every successful round, barely moves when one round is slow, which is why it is the figure the test ranks by and the one it names as Fastest so far. Minimum and maximum are shown too: the minimum is the best your path can do, the maximum how bad it gets.
Paused in the background
Browsers slow down timers and background work in tabs you aren't looking at, to save battery. A test left running in a background tab would record that slowdown as latency, so it pauses while the tab is hidden and resumes when you come back. The status line says so.
Reading a result
Suppose you are in Warsaw, comparing two providers for a web application whose users are mostly in Poland and Germany. You open the provider pages one after the other and let each run for a few rounds.
- Wait for three rounds or so. After the warm-up, a couple of full rounds are enough for the median to settle for most connections; mobile data needs more.
- Sort by median. Click the Median heading. The top few rows are your candidates. Regions within a few milliseconds of each other are a tie: one endpoint per region is a sample, not a contract, and the next round can swap them.
- Look at the spread. If a region's minimum is low but its maximum and mean are high, the path is unstable. If every region on every provider is jittery, the problem is probably your own connection (Wi-Fi, a busy line, a VPN), not the clouds.
- Compare within a provider before across providers. Endpoints differ between providers: some keep connections open, some close them after each reply, some do more work before answering. The ranking within one provider is solid; a 3 ms difference between two providers' best regions is not.
- Ask the people who matter. Your own result only covers your connection. If your customers are elsewhere, send them the link and ask for the CSV or image back.
The CSV is made for that last step. It opens with an attribution line and a summary, then one row per region in the order shown:
#,Region,Place,Code,Latest (ms),Median (ms),Mean (ms),Min (ms),Max (ms),Rounds OK,Rounds failed,Warm up (ms),Round 1 (ms),Round 2 (ms),...
With Show each round ticked it carries the warm-up and every round measured, not only the 20 still on screen, so you can put several people's runs side by side in a spreadsheet. It is written as UTF-8 with a byte-order mark, so Excel shows São Paulo and Zürich correctly.
What the test can't tell you
- Bandwidth. It measures how long a small reply takes, not how fast a large download is. A close region with a congested path can still be slow for big files.
- Latency between regions. If your app server and database are in different regions, the delay between them is a separate question, best measured from a VM in one of them.
- Other people's networks. Every number is from your browser, over your connection, right now. Run it again on a different network and expect different results.
- Raw network time. Each sample is an HTTPS request, so it includes the server's time to answer. It reads a little higher than
pingwould, but ranks regions the same way, and it is closer to what a real API call feels like. - Blocked endpoints. Ad blockers, corporate firewalls and DNS filters sometimes block storage or API hostnames. A region that fails every round from one network may be fine from another.
Practical tips
- Test on the connection your users have. Office fibre and home cable can disagree. If your customers are on phones, run it on mobile data too.
- Switch the VPN off, unless the VPN's location is what you want to measure.
- Use a wired connection when you can. Wi-Fi adds jitter that makes medians take longer to settle.
- Keep the tab in front while it runs. A hidden tab pauses the test rather than recording nonsense.
- Treat small differences as ties, and let price, the services available in each region and data-residency rules decide between them.
- Re-test before a migration. Routes change when ISPs and clouds change their peering. A result from last year is a hint, not a measurement.
If the results look strange across the board, check what your own connection looks like first: What's My IP & Browser Info shows the address you appear from (a VPN or proxy shows up there), and times a few requests to this site. And if a region's hostname refuses to answer at all, DNS Lookup & Health Check will tell you whether the name resolves from here.