# Regions, PoPs and the Edge — Serverless & Edge

Source: https://www.skillbyai.com/en/serverless-edge/se-edge-vs-region

> Explain the difference between regional cloud functions and edge functions, and why physical distance shapes latency.

## Where your code physically runs

A cloud **region** is a cluster of data centres in one geography, such as Mumbai or Singapore. Classic serverless functions run in the one region you deploy to. A **CDN** (content delivery network) has many more, smaller locations called **points of presence (PoPs)** spread across cities worldwide, originally used to cache static files close to users. **Edge computing** runs *your code* inside those PoPs, so a user in Guwahati can be answered by a nearby PoP instead of a distant region. Why does this matter? Network latency is bounded by distance and the speed of light in fibre, and each round trip (DNS lookup, TCP connect, TLS handshake, the request itself) pays it again. Edge runtimes trade capability for proximity: they start fast and run everywhere, but usually offer smaller CPU budgets, fewer APIs, and data that is either cached nearby or far away in a region.

## Three places a request can be answered

A request leaves the user's device, reaches the nearest edge PoP, and only continues to the regional cloud if the edge cannot answer it from cache or edge code.

![Three connected stages from left to right: the user device, an edge point of presence near the user, and a regional cloud data centre.](assets/figures/serverless-edge/section-1-map.svg) — Figure 1.1: user -> edge PoP -> regional cloud

## Measuring where the time goes

`curl` can print timing for each phase of a request. Run it against a site served from a CDN and one served from a single far-away region and compare the connect and TLS times.

```bash
curl -o /dev/null -s -w \
  'dns:%{time_namelookup}s connect:%{time_connect}s tls:%{time_appconnect}s first-byte:%{time_starttransfer}s\n' \
  https://example.com/
```

## Edge is not automatically faster

Moving a function to the edge helps only if it can answer *without* going back to a distant origin. An edge function that makes three sequential calls to a database on another continent pays the long trip three times. Section 6 returns to this with numbers.

**Quiz:** What is a point of presence (PoP)?

- [ ] A database replica that accepts writes
- [ ] A single large data centre that hosts an entire cloud region
- [ ] A billing unit used to price serverless functions
- [x] A smaller network location of a CDN placed close to users

*Answer:* A smaller network location of a CDN placed close to users. PoPs are the many CDN locations spread across cities. A region is a much larger, less numerous cluster of data centres.
