跳到正文
Vercel Blog(vercel.com)· Luis Meyer·· 16 小時前精選AI 評分70

Vercel Flags SDK 冷啟動 7 倍加速,使用報告不再延長函式時長

Vercel Flags starts 7x faster and no longer extends function duration

AI 導讀

Vercel Flags SDK 在冷啟動時加速 7 倍,且使用報告不再延長函式時長。

  • 冷啟動最佳化:SDK 直接載入並解析旗標資料檔,避免網路等待,p75 初始化時間從 70 ms 降至 10 ms。
推薦理由

Vercel Flags SDK 7 倍加速冷啟動並移除使用報告延長函式時長,開發者可即時獲取旗標並最佳化函式執行。

正文 · 原文

On Vercel, the Vercel Flags SDK now initializes faster on cold starts, and usage reporting no longer keeps functions running after the response.

Faster cold starts

Two changes speed up SDK initialization on cold starts:

  • The SDK loads and parses the flags datafile bundled with your deployment as soon as the client is created, so it’s ready before your code evaluates its first flag.

  • Every function invocation now includes the current datafile revision, so the SDK can check whether the bundled datafile is up to date without a network request.

In internal testing, eliminating the network wait reduced p75 cold-start SDK initialization time from over 70 ms to 10 ms, roughly 7x faster.

After initialization, flag reads are effectively instant. Across cold and warm invocations, p99 flag-read latency is under 1 ms.

Usage reporting no longer extends function duration

The SDK previously used waitUntil for usage reporting, keeping functions running after the response was sent. It now passes usage events to the Vercel runtime, so reporting no longer adds to function duration.

Update @flags-sdk/vercel to version 1.5.3 or later and redeploy your application:

Learn more in the Flags SDK documentation.

Read more

來源: Vercel Blog (vercel.com)
開啟原文