vercel-edge-explained-2026.html
< BACK 光迹在黑色全球网络网格中的发光节点之间弧形延伸,暗示边缘计算贴近用户

Vercel Edge in 2026:它是什么、有什么变化以及何时使用

Vercel Edge是指Vercel将你的代码运行和缓存内容从全球网络提供,就在访问者身边,而不是从一个源地区。很简单。问题在于关于它写的很多内容现在已经过时。2025年6月,Vercel停止了独立Edge Functions产品,Edge runtime转移到了流动计算模型下的Vercel Functions。所以这是2026版本:Vercel Edge实际上是什么、那个变化做了什么、以及何时Edge runtime仍然值得选择。

Vercel Edge是什么?

Vercel Edge是一个宽泛的术语,不是单一产品。四样东西往往被归在这个名称下:

  • Edge Network:Vercel的CDN,那些缓存你的内容并将每个请求发送到最近节点的存在点。: Vercel's CDN, the points of presence that cache your content and send each request to the nearest one.
  • Edge runtime:一个轻量级V8隔离runtime,就是为Chrome提供动力的同一引擎,运行你的函数代码,无需启动Node.js容器。: a light V8-isolate runtime, the same engine that powers Chrome, that runs your function code without spinning up a Node.js container.
  • Edge Middleware:在请求到达你的页面之前运行的代码。重定向、身份验证检查、重写、A/B 分流。: code that runs before a request reaches your page. Redirects, auth checks, rewrites, A/B splits.
  • Edge Config:一个低延迟的键值存储,你可以从边缘读取,为功能标志和重定向映射而构建。: a low-latency key-value store you read from the edge, built for feature flags and redirect maps.

当有人说"Vercel Edge"时,他们几乎总是指 Edge runtime 或 Edge Middleware。值得精确区分,因为那个列表中只有一项在 2025 年发生了实际变化。

Vercel Edge 会被停用吗?

不会。Edge runtime 仍在运行并得到支持。在 2025 年 6 月被弃用的是独立的 Edge Functions 产品,而不是 runtime 本身。Edge runtime 现在运行在 Vercel Functions 上,后者将 Vercel 的所有计算统一到一个定价模式,并移除了边缘和无服务器之间的旧硬壁垒。所以在日常使用中,你为每个函数选择一个 runtime(Edge 或 Node),计费方式相同。那些问 Vercel 是否在悄悄杀死 edge 的讨论?那是重命名造成的误解,不是关闭。Vercel 在其 Edge Middleware 和 Edge Functions 更新日志中详细说明了这一举措。Edge Middleware and Edge Functions changelog.

Vercel Edge runtime vs Node runtime

当延迟和启动时间比库支持更重要时,选择 Edge runtime。当你需要完整的 npm 生态系统或更长时间运行的工作时,选择 Node。权衡如下:

  • 冷启动:Edge runtime 在大约一毫秒内唤醒,因为 V8 isolate 不需要容器。Node 从冷启动速度较慢,尽管流动计算已缩小了很多差距。: the Edge runtime wakes in roughly a millisecond, since a V8 isolate needs no container. Node is slower from cold, though fluid compute has closed a lot of that gap.
  • API:Edge 提供网络标准 API(fetch、Request、Response、Web Streams)。Node 给你完整的 Node 表面,包括文件系统和原生模块。: Edge gives you web-standard APIs (fetch, Request, Response, Web Streams). Node hands you the whole Node surface, file system and native modules included.
  • 包:很多 npm 包都假设 Node 内置模块存在,根本无法在 Edge runtime 上运行。任何涉及文件系统或原生绑定的包都需要 Node。: plenty of npm packages assume Node built-ins and simply will not boot on the Edge runtime. Anything that touches the file system or native bindings needs Node.
  • 流式传输:两者都能正常流式传输,但 Edge 运行时的低首字节时间使其成为流式传输 AI 令牌的更好默认选择。: both stream fine, but the Edge runtime's low time-to-first-byte makes it the better default for streaming AI tokens.
  • 覆盖范围:Edge 代码可以在靠近用户的许多区域运行。繁重的 Node 工作通常留在你的主要区域。: Edge code can run in many regions near your users. Heavy Node work usually stays in your primary region.

想要跨提供商的相同比较?请查看我们的 edge compute 目录和 Vercel Edge 运行时配置文件。edge compute directory and the Vercel Edge runtime profile.

什么是 Edge Middleware?

Edge Middleware 是在请求与路由匹配之前在 Edge Network 上运行的代码。它是进行地理位置重定向、身份验证门禁、机器人过滤、语言路由和 A/B 测试的正确工具,因为它在页面渲染之前触发,几乎不会增加延迟。有一条规则:保持它的体积小。Middleware 在每个匹配的请求上运行,所以其中任何繁重的操作都会影响每个页面加载的性能。

什么是 Vercel Edge Config?

Edge Config 是一个全球复制的键值存储,你可以从 edge 以几乎零延迟读取。它适合你经常读取但很少写入的数据。功能标志、kill switch、重定向映射、维护模式开关。但它不是数据库,所以对于你经常写入或需要带过滤条件查询的任何东西,应该选择真正的无服务器数据库。a real serverless database instead.

2026 年你应该何时使用 Vercel Edge?

当你已经在 Vercel 上且工作量符合其限制时,使用 Edge 运行时。快速决策列表:

  • 将其用于 middleware、重定向、身份验证检查、流式响应以及希望获得低首字节时间的全球分布式读取。 middleware, redirects, auth checks, streaming responses, and globally distributed reads that want low time-to-first-byte.
  • 对于重依赖、文件系统操作、长任务以及任何依靠完整 npm 生态的工作,应该使用 Node 运行时。 heavy dependencies, file-system work, long tasks, and anything that leans on the full npm ecosystem.
  • 如果原始成本规模或更大的节点网络最为重要,可以考虑 Cloudflare Workers。Workers 的单次请求成本更低,覆盖地区更多。 raw cost at scale or a bigger points-of-presence network matters most. Workers runs cheaper per request and in more places.

先选择主机再选择运行时?我们的云托管对比和边缘计算详解涵盖了更广泛的选项。cloud hosting comparison and edge computing breakdown cover the wider field.

常见问题

Vercel 中的"边缘"是什么意思?

边缘是 Vercel 的全球节点网络,是位于访问者和源服务器之间的位置。在边缘运行意味着你的代码或缓存内容存储在这些位置,距用户更近,因此请求可以以更短的往返时间得到响应。

Vercel Edge 是免费的吗?

是的,在免费 Hobby 层用于个人项目时,Edge 运行时是包含在内的。付费使用从 Pro 计划开始,每个开发者席位每月约 20 美元,加上使用费。自 2025 年变更以来,边缘计算和无服务器计算归入同一个计费模型,而不是两个单独的模型。

Vercel 上的边缘请求是什么?

边缘请求是指 Vercel 的 Edge Network 自己处理的任何请求:缓存命中、中间件运行或从靠近用户的节点提供的 Edge 运行时函数。Vercel 单独计数这些请求,因为它们发生在网络层而不是源服务器上。

Vercel Edge vs Cloudflare Workers:我应该选哪一个?

如果你已经在 Vercel 上,想要紧密的 Next.js 集成、单一供应商、单一账单,就选 Vercel Edge。如果成本规模或更广的边界网络对你更重要,就选 Cloudflare Workers,因为 Workers 的单次请求成本更低,覆盖地点也更多。两者都基于 V8 isolates,所以底层模型基本相同。

2026 年的简短版本?Vercel Edge 没有消失。它被合并到 Vercel Functions 中了。Edge runtime 仍然是在 Vercel 上运行中间件和流式传输响应的最快方式,Node runtime 处理一切需要真实包的东西,现在的选择是按函数而不是按产品。

< BACK