NEXINFINITY META · Blog
Cloud & Infrastructure

Where Your App Runs Decides How Fast It Feels: The One-Line Fix That Cut Our Load Times by Up to 84%

S. Veera Kumar 8 min read

If your web app uses serverless functions and your database is in India, check which region the functions run in. On Vercel the default is Washington, D.C., so with a database in Mumbai every query travels to the other side of the planet and back, roughly 230 milliseconds each time. A page that makes eight queries one after another spends about two seconds on geography alone, and it feels to the user like the app is thinking after every click. We found this across our own web apps, fixed it with one line of configuration, and measured the result: time to first byte fell by between 59 and 84 percent. This is how to find the problem on your own app, what the fix does and does not do, and the second half of the problem that the region change does not touch.

Key takeaways

  • Serverless functions default to Washington, D.C.; with a database in Mumbai each query pays about 230 ms of geography.
  • Read the second region code in the x-vercel-id header to see where a function ran, then set the region in vercel.json to match the database.
  • On our own apps this cut warm time to first byte by 59 to 84 percent; pages with no database work gained nothing.
  • Merge the setting into an existing config file; overwriting it can silently switch off scheduled jobs.
  • Fix the query pattern too: run independent reads together and fetch per-request context once.

Why a correct app can still feel slow

On a developer's laptop the database is a few milliseconds away, so every query is instant and nothing looks wrong. In production the same code runs in a data centre that the hosting platform chose for you, and the database sits wherever you created it. If those two are on different continents, each query pays the round trip, and a request that makes several queries pays it several times.

The arithmetic is unforgiving. At about 230 milliseconds per round trip between Washington and Mumbai, eight sequential queries cost about 1.8 seconds before any of your own code runs. Nothing in the code is slow and nothing shows in a code review. It shows only as a vague feeling that the app hesitates, which is why this is one of the most common reasons a well-built app feels worse than it should.

How to check your own app in one command

Vercel's documentation states that the default region for functions is Washington, D.C. (iad1). Your database has a region too, shown in its dashboard. If they differ, you have the problem.

You can see where a request was actually served with one command: request any page that does database work and read the response header called x-vercel-id. It has the form of two region codes joined by two colons. The first is the edge location that accepted the request, which is not the thing to fix. The second is the region the function ran in. A value of bom1 followed by iad1 means a user in India reached a nearby edge and was then sent to Washington. A value of bom1 followed by bom1 means the function ran in Mumbai, next to the data.

The fix: one line, no code change

The region is a setting in the project's vercel.json file. Setting regions to bom1 (Mumbai) puts the functions in the same city as the database. Nothing in the application code changes, and it deploys like any other commit.

One practical warning: when you add this to an existing project, merge it into the file instead of replacing the file. Several of our apps also keep scheduled jobs in the same file for payment reconciliation and reminders, and overwriting it would have silently switched those jobs off with no error anywhere.

App typeBeforeAfterChange
Online shop1.00 s0.16 s-84%
Book store0.77 s0.16 s-79%
Art marketplace1.00 s0.25 s-75%
Internal admin panel0.87 s0.36 s-59%

Time to first byte on warm requests before and after, measured on 22 August 2026 across four of our own web apps

What the fix does not help

A page that does no database work gains nothing. One of our sign-in pages showed no change at all after the move, because it makes no queries; the gain showed up on the signed-in pages behind it. A static page needs no function in the first place, which is why this website is built fully static and pinned to Mumbai only as a precaution.

It also moves the problem rather than removing it if your users are spread across the world. The function should sit next to the database, because that is where the chatty traffic is. Users far from that region then pay one long trip for the whole page instead of eight for the queries. For a mostly Indian audience that is the right trade. For a global one the next step is read copies of the data or caching, which is a different project.

The other half: too many queries in a row

Latency only hurts this much because the queries run one after another. In one of our apps, working out who the signed-in person is cost six separate queries on every navigation, and one of them was a write. Moving the region helped, but the real fix was to collapse the per-request context into a single call to the database and to wrap that call in React's cache function so the layout and the page do not each pay for it.

The rule we now follow: independent reads go out together, never in sequence, and anything every page needs is fetched once per request. That is a code change, not a configuration change, and it compounds with the region fix: eight queries at 230 milliseconds is two seconds; one query at 10 milliseconds is nothing.

Make the wait feel short, too

Actual speed and perceived speed are separate. A page that must wait for the server should show something shaped like itself immediately, a skeleton with the real layout, so a click lands on a screen that is already moving. A page that is fully static should not use one, because a loading boundary makes the page wait for the whole document before it appears. We learned that the hard way and wrote it up in what profiling our own site on a phone found and in why a website feels slow on mobile.

A five-minute check for your own stack

None of this needs a consultant to start. It needs the answers to a few questions.

  • Where is the database? Read the region in its dashboard.
  • Where do the functions run? Read the second code in the x-vercel-id header of a page that does database work.
  • If they differ, set the region in the project configuration, merging into the existing file.
  • Count the queries on your slowest page and ask which could run together.
  • Measure time to first byte on a warm request before and after, so you know it worked.

Measure warm, not cold

The first request after a quiet period includes starting the function and is slower for every setup. Compare warm requests, the second and later ones, or the comparison is noise.

Where this fits in a build

Region choice, query design and monitoring are the unglamorous part of cloud and infrastructure work, and they are the part users feel. If you would like your own app checked, send us the address and we will tell you what we find, in writing.

Frequently asked questions

Why is my Vercel app slow in India?

A common cause is that the serverless functions run in the default region, Washington, D.C., while the database is in India, so each query crosses the planet. Check the second region code in the x-vercel-id response header; if it is not the same region as your database, set the regions setting in vercel.json.

What is the default region for Vercel Functions?

Washington, D.C., USA (iad1) for new projects, according to Vercel's documentation. You can change it with the regions key in vercel.json.

How do I find which region my function ran in?

Request a page that does database work and read the x-vercel-id header. It has two region codes separated by two colons; the first is the edge location that accepted the request and the second is the region the function ran in.

Which Vercel region is best for users in India?

If your database is in Mumbai, set the functions to bom1, which is Mumbai, so they sit next to the data. The function should be near the database rather than near the user, because the chatty traffic is between the function and the database.

How much faster does moving the function region make an app?

On our own apps, warm time to first byte fell from 1.00 s to 0.16 s, 0.77 s to 0.16 s, 1.00 s to 0.25 s and 0.87 s to 0.36 s, a reduction of 59 to 84 percent. Pages that do no database work see no change.

Does a static website need a hosting region?

A fully static site serves files from the network edge and has no database round trips, so the function region does not matter for its pages. It matters for any page that runs a function and talks to a database.

Have a project in mind?

We design, build, and ship software end-to-end — with a fixed, written quote after a free scoping call.

More from the blog

Keep reading