Edge functions and the latency you forgot
Running close to the user does not help if your data lives somewhere else.
26 articles
Edge compute moves your code to the user. It does not move your database. If the function makes three sequential queries to a single region, you have made things worse, not better.
The arithmetic
Three round trips at ninety milliseconds is two hundred and seventy milliseconds of waiting, and you have paid it in a place with less memory and a shorter timeout.
Edge wins for work that needs no origin data: redirects, header rewriting, personalisation from a cookie, geolocation. Everything else wants to be near the data.
A rule of thumb
Move code to the edge when it needs no origin data, or exactly one round trip. Beyond that the latency you saved on the first hop is spent several times over on the ones after it.
The pattern that does work
Read-through caching at the edge with a short window. The first request pays for the origin trip; everything after it for the next few seconds is local. For anything read-heavy this is most of the benefit of edge compute with none of the sequential-query trap.