Running server functions in the same region as the database
Server functions ran close to the person making the request, but the database was in Seoul. We run the functions in the Seoul region to avoid repeated long trips.
A recovery code request from London took 8.5 seconds. Today it even ran past the app's 30-second limit. The function ran close to the person who asked. That usually ought to be faster, but this time that location was the problem.
Between the person and the function there's one round trip. But a single function can send the database many queries. Put the function near the person, and every query has to travel to faraway Seoul and back. What needed to be close wasn't the person and the function, but the function and the database.
So we set the router to run every function in the same Seoul region as the database. The queries that used to make many long trips now stay within one region.
The distance hasn't disappeared. For someone using the app far away, the request still has to reach Seoul. For now we've cut the number of long trips, not removed the distance.
Written from that day’s point of view, using the documents and change history of the time. Published 2026.12.01.
