No. 25Next.js8 min read2,035 words
Edge vs server rendering in Next.js: what matters in 2026
Edge vs server rendering in Next.js, explained for teams choosing where code runs: why database location beats user location, and when the edge still pays off.
- Written by
- Lazy Devs
- Published
- Updated
- Sources
- Cited inline

Key takeaways · 05
The short version
- 01For pages that query a database, render on a server in the same region as that database. Latency to the data usually costs more than latency to the user.
- 02Edge caching (a CDN serving prerendered or cached responses) is almost always a win. Edge compute (running your code in many locations) only wins when the request needs little or no origin data.
- 03In Next.js 16, Proxy (formerly Middleware) runs on Node.js, the edge runtime is not supported with Cache Components or ISR, and Vercel now recommends migrating edge functions to Node.js.
- 04The fastest dynamic page is usually a static shell from the CDN plus data streamed from a regional server, which is what Partial Prerendering with Cache Components gives you.
- 05Before moving anything to the edge, measure where the time goes. Slow pages are far more often caused by sequential database round trips than by distance to the user.
On this page · 10
Edge vs server rendering comes down to one question: is your request waiting on the user or on the data? Put your code next to whatever it talks to most. For a page that queries a single-region database, that means a server in the same region as the database, not an edge function near the user. The edge still wins for caching and for lightweight request shaping, but it is not a general upgrade, and in Next.js 16 the edge runtime is a narrower option than it used to be.
The edge was sold for years as the obvious next step, as if everyone running Node in one data center was doing it wrong. That framing was backwards, and the platforms have quietly come round to saying so.
What "edge" and "server" actually mean
When people say "edge rendering" in a Next.js context, they usually blur three different things together.
| Term | What it is | Typical latency profile |
|---|---|---|
| Edge caching (CDN) | A finished response stored and served from a location near the user. Your code does not run. | Fast for the user, no origin work at all |
| Edge runtime / edge compute | Your code runs in many locations in a restricted JavaScript environment without full Node.js APIs | Fast first hop, slow if it then calls a distant database |
| Regional server (Node.js) | Your code runs in one or a few regions with the full Node.js runtime | Longer first hop for distant users, fast access to a nearby database |
The Next.js Edge Runtime reference is clear about the limits: no full set of Node.js APIs, some packages will not work, and no Incremental Static Regeneration. Edge caching, on the other hand, is mostly orthogonal to the runtime debate. Serving prerendered pages from a CDN is almost always the right call.
The confusion comes from treating "edge" as a synonym for "fast". It is fast for the network hop to the user. It can be slow for everything after that.
Where the edge runtime stands in Next.js 16
The platform has shifted, and much of what was written about edge rendering in 2023 no longer applies.
- Middleware is now Proxy, and it runs on Node.js. Next.js 16 deprecated
middleware.tsin favour ofproxy.ts, and the Proxy docs state that it defaults to the Node.js runtime and theruntimeoption cannot be set there. - Cache Components do not support the edge runtime. The
runtimesegment config notes thatruntime: 'edge'is not supported for Cache Components, which is the model Next.js now uses for caching and Partial Prerendering. - Vercel recommends moving off edge. Vercel's Edge Runtime documentation now recommends migrating from edge to Node.js for performance and reliability, and states that from Next.js 16.3, setting
runtime = 'edge'on routes and pages is no longer supported.
None of this makes the underlying physics different. It does mean that "should we put this page on the edge?" is now mostly answered by the framework, and the useful question becomes: what can we serve from a cache near the user, and where should the dynamic remainder run?
The thing nobody mentions: your database is in one place
Here is the scenario that breaks the edge-is-always-faster story.
Your function runs in Singapore because that is where the user is. Your Postgres primary runs in Virginia because that is where you provisioned it. Every query now crosses an ocean and back. A page that does three sequential queries pays for three of those long round trips before it can render anything. You moved compute towards the user and left the data behind, so you made things worse.
// app/dashboard/page.tsx
// Three sequential queries. If this runs far from the database,
// each await pays a full long-distance round trip.
export default async function Dashboard() {
const user = await getUser(); // round trip 1
const team = await getTeam(user.teamId); // round trip 2
const projects = await getProjects(team.id); // round trip 3
return <DashboardView user={user} team={team} projects={projects} />;
}Run the same code on a Node.js server in the same region as the database and each query is a short hop inside one data center. The "slow" regional server beats the "fast" edge function because latency to the database dominates, not latency to the user.
Fix the waterfall before you move anything
Whatever runtime you use, sequential awaits multiply latency. Two changes help everywhere:
- Collapse dependent queries into one where you can, with a join or a single query that returns the user, team and projects together.
- Run independent queries in parallel with
Promise.all, so the page pays for the slowest query rather than the sum of them.
const [user, notifications] = await Promise.all([
getUser(),
getNotifications(),
]);We cover these patterns in detail in data fetching patterns in React Server Components. In our experience, fixing a waterfall usually does more for a slow page than any change of runtime.
Where running close to the user still wins
There are concrete cases where proximity to the user is the thing that matters.
Cached and prerendered pages
Anything that can be prerendered or cached should be served from a CDN. Marketing pages, docs, blog posts, product listings that change a few times a day: none of these need code to run per request. This is the biggest latency win available, and it requires no edge runtime at all. Our post on shipping a marketing site without a database is built entirely on this idea.
A static shell with streamed data
With Cache Components enabled, Next.js prerenders a static shell for each route and streams the dynamic parts behind Suspense at request time. That is Partial Prerendering, and it is now the default behaviour under Cache Components. The user gets the layout, navigation and cached content from the CDN straight away, while the personalised parts stream from a regional server next to the database. It gives you most of what people wanted from edge rendering without moving data-heavy code away from the data. Our mental model for App Router rendering explains how the shell and the streamed parts fit together.
Lightweight request shaping
Redirects, rewrites, A/B bucketing, locale detection and cookie checks are request shaping, not data fetching. They belong in proxy.ts. Proxy now runs on Node.js, but the principle is the same: keep it fast and stateless, and never query the database there.
// proxy.ts
import { NextResponse, type NextRequest } from "next/server";
export function proxy(req: NextRequest) {
// Geo comes from your platform's request headers, e.g.
// x-vercel-ip-country on Vercel or cf-ipcountry on Cloudflare.
const country = req.headers.get("x-vercel-ip-country") ?? "US";
if (country === "DE" && !req.nextUrl.pathname.startsWith("/de")) {
return NextResponse.redirect(new URL("/de", req.url));
}
const res = NextResponse.next();
if (!req.cookies.has("ab")) {
res.cookies.set("ab", Math.random() < 0.5 ? "a" : "b");
}
return res;
}Note that req.geo was removed from NextRequest in Next.js 15. Read geolocation from the headers your host adds, such as the geolocation headers Vercel documents or Cloudflare's cf-ipcountry.
Data that is already global
If your reads come from a globally replicated key-value store or a database with read replicas near your users, the data is close to the code too, and running in many regions can deliver the low latency it promises. The catch is that you have to build for it. A single-region Postgres does not become global because you call it from an edge function.
Where a regional server wins
Regional Node.js rendering is the boring default for good reasons:
- The full Node.js runtime. Any npm package works, including ones with native bindings, standard database drivers and SDKs that assume Node.
- Proximity to your database. Multi-query pages stay fast because each query is a short hop.
- Connection pooling that works. A long-lived server, or a platform that reuses function instances, can hold a sensible pool of database connections.
That last point bites people. Postgres has a hard cap on concurrent connections (set by max_connections), and many short-lived, widely distributed function instances each wanting their own connection will hit it. Teams that go all-in on edge compute end up adding a connection pooler or an HTTP-based database driver just to survive. A regional server with a normal pool sidesteps the problem.
Which of these you can choose depends on your host. Our roundup of the best hosting for Next.js compares how each platform handles regions, the edge and caching.
How to decide, route by route
Skip the marketing benchmarks and ask these questions about each route.
- Can it be prerendered or cached? Then serve it from the CDN and you are done. This covers more pages than most teams expect.
- Is it request shaping only (redirects, headers, geo, a cookie check)? Put it in
proxy.tsand keep it free of database calls. - Does it read user-specific or fresh data from your primary database? Render it on a server in the same region as the database, ideally as a cached shell with the dynamic parts streamed.
- Is the data it needs globally replicated? Only then consider running the dynamic part in many regions.
| Route type | Where it should run | Why |
|---|---|---|
| Marketing pages, docs, blog | Prerendered, served from CDN | No per-request work needed |
| Redirects, locale, A/B bucketing | proxy.ts | Cheap, stateless, runs before render |
| Signed-in dashboard | Static shell from CDN, dynamic parts on a regional server | Data lives in one region |
| Public API that rarely changes | Cached response with tag-based revalidation | Freshness on demand, no per-request compute |
| Webhooks, background work | Regional server | Needs full Node.js and database access |
A concrete split for a SaaS product
For a typical SaaS app, a setup that holds up well:
- Marketing site: static, served from the CDN everywhere.
- Locale and auth redirects:
proxy.ts, cookie checks only. - App routes that query Postgres: Node.js, same region as the database, with a cached shell and streamed data.
- Public data that rarely changes: cached with tag-based revalidation.
Each piece runs where its bottleneck is, which is the only principle that survives contact with production.
Measure before you move anything
The most common mistake we see is moving code to a different runtime to fix a slowness nobody has measured. Before you change anything:
- Check time to first byte from where your users are. web.dev's TTFB guide explains what it includes (redirects, connection setup, server time) and how to read it.
- Break down server time. Add a
Server-Timingheader or tracing spans around database calls so you can see whether the time goes to queries, rendering or the network. - Look at field data. Real-user measurements of LCP and TTFB by country tell you whether distance is actually the problem. Our Core Web Vitals checklist covers how we measure.
If the breakdown shows the time is spent waiting on sequential queries, no runtime change will help. If it shows the time is spent before your code even runs, caching and a CDN are the fix.
Common mistakes
- Putting data-heavy pages on the edge while the database stays in one region.
- Querying the database from Proxy on every request, including prefetches.
- Sequential awaits that turn three fast queries into three slow round trips.
- Assuming edge means cached. An edge function runs your code on every request unless something caches the result.
- Opening a new database connection per invocation without a pooler.
- Optimising for one location. Testing from the office next to your cloud region hides what distant users experience.
The short version
Edge versus server is not a ranking. It is a question of distance: distance from the user versus distance from the data. Cache everything you can near the user, keep dynamic rendering near the data, and stream the parts that have to be fresh. In Next.js 16 the framework nudges you towards exactly that split.
If you have a slow Next.js app and want to know where the time is actually going, that diagnosis is a core part of our performance and SEO engineering work. Tell us what you are seeing and we will help you find the real bottleneck.
FAQ · 04 questions
Frequently asked questions
Is edge rendering faster than server rendering?
Only for requests that need little or no data from your origin. Edge functions start close to the user, but if they then query a database in one region, every query crosses the same long distance the edge was supposed to avoid. For data-heavy pages, a regional server next to the database is usually faster overall.
Does Next.js 16 still support the edge runtime?
Partly, and it is shrinking. Next.js 16 renamed Middleware to Proxy, which runs on Node.js only, and the edge runtime is not supported with Cache Components or Incremental Static Regeneration. Vercel's own documentation now recommends migrating from edge to Node.js and says route-level edge support ends with Next.js 16.3.
What is the difference between edge caching and edge computing?
Edge caching means a CDN stores a finished response, such as static HTML or an image, and serves it from a location near the user without running your code. Edge computing means your code actually executes in those locations on every request. Caching is cheap and nearly always helps; computing at the edge only helps when the data it needs is also nearby.
How do I make a Next.js app fast for users on other continents?
Serve as much as possible as static or cached HTML from a CDN, so most of the page arrives from nearby. Keep dynamic rendering next to your database, cut sequential queries, and stream personalised parts behind Suspense. If you truly need low-latency dynamic data worldwide, add read replicas or a globally replicated data store, not just edge functions.