12-04 更新 实时
首页/ 技术栈/ 正文

如何将 TB 级 LLM 模型交付提速 50 倍

技术栈 来源:Databricks Blog 2026-12-03 05:35 1 阅读 机器翻译
如何将 TB 级 LLM 模型交付提速 50 倍

由 Databricks Unity Gateway 提供服务的模型,通过 Databricks Artifact Registry 的 Model Delivery Network 分发。每个模型只需上传一次,随后复制到所有区域。这条流水线耗时从数小时到数天不等,对 Kimi-K3(1.56 TB)这样的前沿模型来说实际上已无法使用。

基准测试和监测工具排除了网络带宽、内存和 CPU 的因素,最终指向一个连接瓶颈:所有传输都被复用到单条 HTTP/2 连接上,无论可用带宽有多少,其流量控制窗口都限制了吞吐。

改用并行连接,并并发复制模型的各个文件后,吞吐从约 15 MB/s 提升到约 800 MB/s。Kimi-K3 现在约 32 分钟即可完成上传,约 3 小时内就能覆盖所有区域。

Databricks Unity Gateway 为 Kimi、GLM、Qwen 等前沿大语言模型提供容量,这些模型托管在我们自己的推理服务和 GPU 上。我们的运营规模极为庞大,所有模型合计每年服务超过 125T Token。

要让新的前沿模型在发布当天即可用,权重必须在发布后几小时内完成上传并复制到所有区域。随着模型规模突破 1 TB,这件事变得愈发困难:一个 600 GB 的模型上传耗时超过 12 小时,需要长达三天才能覆盖所有区域,而 1.56 TB 的 Kimi-K3 实际上已大到无法交付。

瓶颈并不在网络。而在于我们的 HTTP/2 客户端把所有并发传输都复用到了同一条连接上,这条连接共享的流控窗口无论有多少空闲带宽,都会限制吞吐。我们的解决办法是让每个传输都拥有自己的连接和窗口——先是把客户端切回 HTTP/1.1,同时并行复制同一个模型的多个文件。吞吐从约 15 MB/s 提升到约 800 MB/s:Kimi-K3 现在大约 32 分钟就能上传完成,几个小时就能覆盖所有区域。

模型如何进入生产环境

模型在开始服务流量之前要经历三个阶段。第一,上传:权重被复制一次到 Artifact Registry 的一个中心“leader”区域。第二,复制:Registry 把模型复制到每一个服务区域。第三,运行时下载:服务节点启动时拉取模型并加载,以开始响应请求。

此前我们投入了大量精力来加快运行时下载,用上了我们的镜像加速技术和优化过的“fast puller”(Superhuman 和 Databricks 如何携手构建 20 万 QPS 的推理平台)。本文讲的是前两个阶段:上传和复制。

问题随着模型规模而加剧。Kimi-K2.7(600 GB)上传耗时超过 12 小时。把它复制到每一个区域大约需要 3 天,因为这些长时间运行的跨区域传输会时不时中断,不得不重新开始。而按旧的路径推算,Kimi-K3(1.56 TB)上传大约需要一天,复制到全球各地大约需要一周。

这些耗时限制了 Unity Gateway 团队的交付节奏。一个模型只有先上传并复制到某个区域,才能在该区域承载流量,因此这条流水线处在每一次发布和每一次更新的关键路径上。当这个过程要花上几天、还可能在途中失败时,验证新的 checkpoint、发布修复或推出新版本这类日常工作,就变成了需要有人盯着、耗时多日的操作。在 Kimi-K3 的规模下,这条流水线实际上已不可用;而由于每个新的前沿模型都比上一个更大,问题每次发布都会进一步加剧。

上传速度约为 15 MB/s,远低于网络带宽上限。我们借助 AI 智能体对流水线的每个阶段做了基准测试、运行了实验,并对比结果以找出瓶颈。

我们首先检查了跨区域网络,发现有充足的余量。接着测试了接收端的对象存储;它能接收数据的速度远高于我们发送的速度。然后我们检查了 CPU、内存和本地磁盘。它们都远未达到饱和,而上传速度依然维持在约 15 MB/s。

线索在于:通过 HTTP/2 并行运行更多传输并没有帮助。无论同时运行多少个传输,吞吐都稳定在约 15 MB/s。于是我们测量了每条连接的吞吐,并尝试把客户端切换到 HTTP/1.1,结果吞吐出乎意料地升到了数百 MB/s。单条连接的吞吐上限约为 17–18 MB/s,但把传输分散到各自独立的连接后几乎呈线性扩展,超过 200 MB/s。限制并不在于传输的数量,而在于它们全都共用同一条连接。

除了连接数限制之外,复制本身还有自己的瓶颈。每个模型的复制由一个单独的任务完成,它逐个复制文件,并且只使用一条共享连接。对于 Kimi-K3,一百多个大文件必须串行复制。受限于单条连接的速率,再加上偶发的瞬时错误不时导致某个文件重传,这原本需要数天才能完成。

为什么所有流量都走同一条连接

上传和复制都使用 HTTP/2。HTTP/2 的设计目标是在一条复用的连接上承载大量并发请求,这对于网页发出的众多小请求来说是正确选择。但单条连接只有一个流控窗口(即接收方确认之前允许在途数据量的上限),而在跨区域的长往返链路中,决定上限的是这个窗口,而不是网络。因此所有传输——无论是 pusher 的并行上传,还是复制任务的文件拷贝——都跑在同一条连接上,并受其窗口限制;增加更多传输并不会增加容量。

解决方案:多条连接

一旦确认共享连接就是上限所在,解决办法就很简单:让每次传输使用自己的连接,而不是共用 HTTP/2 强制复用的那一条。与 HTTP/2 不同,HTTP/1.1 不强制多路复用,因此客户端会为并发传输使用各自独立的连接,各自拥有独立的流控窗口。我们把客户端切换到 HTTP/1.1,吞吐随即跃升到数百 MB/s。

我们还为跨区域复制实现了一个 worker 池。每个 worker 独立复制一个文件,使用各自的连接,因此一个模型的多个文件可以并行复制。

其他有帮助的改动:

增大传输分块,以减少云存储中每次请求的开销

更大的服务端流控窗口,使每条连接都能让更多数据处于传输中

这些改动合在一起,把吞吐从约 15 MB/s 提升到约 800 MB/s,并消除了重试和传输中途失败。

效果非常显著:上传速度约提升 50 倍,复制约提升 20 倍,覆盖从数百 GB 到超过 1 TB 的各类模型。整条流水线也变得可靠得多,以往会让一次运行拖上数天的连接重置和重试都不复存在。

1复制的“X / Y”:X 表示单个区域,Y 表示覆盖所有区域(部分需要多跳)。

上传吞吐从约 15 MB/s 提升到 600–800 MB/s,复制从 18 MB/s 提升到 340–420 MB/s。我们此前预计 Kimi-K3(1.56 TB)上传需要约一天、复制到所有区域需要一周,如今它 32 分钟即可完成上传,约 3 小时就能覆盖所有区域。现在一个新模型当天就能在全球范围内进入生产环境。

HTTP/2 在它本来的设计目标上表现出色:把大量小而并发的请求复用在一条可重用的连接上,比如网页加载或服务间的 RPC 调用。但同样是这个默认做法——把所有内容复用到单一连接上——并不适合批量传输,因为大量超大数据传输加上较长的往返时延,全都被这一条连接的流控窗口卡住。

AI 编程智能体非常适合做性能排查。这类工作大部分内容(跑基准测试、添加埋点、遍历各种配置、评估瓶颈候选)都是系统性的、以测量为主,而智能体可以驱动这些实验并汇总结果,速度远超人工。

当产品基础设施快速演进时,性能很容易被忽视:一条能跑通的路径,很少有人会再看第二眼。瓶颈最终就留在了无人重新审视的默认设置里,而相比之下,修复往往很简单,收益却很大。

尽管吞吐已经有了显著提升,但仍远低于可用的网络带宽。剩下的天花板是结构性的:OCI registry 按内容寻址(每个对象都由其字节的摘要来标识),因此要计算摘要,每个对象的字节都必须依次经过 registry 服务器。registry 位于数据路径之中,增加更多连接也无法把它挪开。正在考虑的进一步改进包括:

直接上传到存储。客户端通过短时效、校验和锁定的 URL 将文件写入对象存储;存储负责校验每个文件的摘要,registry 只记录元数据。

云原生复制。对于同一云内跨区域的复制,对象存储可以在服务端复制文件,而不必让文件流经我们的服务。

原文较长,译文为节选;译文由英文原文机器翻译,术语按行业惯例统一,可在文末展开原文核对。

查看英文原文(How we ship terabyte LLM models 50x faster)

Models served by Databricks Unity Gateway are distributed by the Databricks Artifact Registry’s Model Delivery Network. Every model is uploaded once and replicated to all regions. That pipeline took hours to days, and was effectively unusable for frontier models like Kimi-K3 (1.56 TB).

Benchmarks and instrumentation ruled out network bandwidth, memory, and CPU, and pointed at a connection bottleneck: all transfers were multiplexed onto a single HTTP/2 connection, whose flow-control window capped the throughput no matter how much bandwidth was free.

Moving to parallel connections, and copying a model's files concurrently, took throughput from ~15 MB/s to ~800 MB/s. Kimi-K3 now uploads in about 32 minutes and reaches every region in about 3 hours.

Databricks Unity Gateway provides capacity for frontier LLMs such as Kimi, GLM, and Qwen, hosted on our own inference services and GPUs. We operate at a massive scale, serving more than 125T tokens per year across all our models.

To make new frontier models available on day zero, the weights have to be uploaded and replicated to all regions within a few hours of release. As models grew past a terabyte, this has become increasingly challenging: a 600 GB model took more than 12 hours to upload and up to three days to reach every region, and the 1.56 TB Kimi-K3 was effectively too large to ship.

The bottleneck was not the network. It was that our HTTP/2 client multiplexed all concurrent transfers onto a single connection, whose shared flow-control window capped throughput no matter how much bandwidth was free. We fixed it by giving each transfer its own connection and window, first by switching the client to HTTP/1.1, and by replicating a model's files in parallel. Throughput rose from about 15 MB/s to about 800 MB/s: Kimi-K3 now uploads in about 32 minutes and reaches every region in a few hours.

How a model reaches production

A model goes through three stages before it serves traffic. First, upload: the weights are copied once into a central "leader" region of the Artifact Registry. Second, replication: the registry copies the model out to every serving region. Third, runtime download: when a serving node starts, it pulls the model and loads it to begin answering requests.

We had previously invested heavily in making the runtime download fast, using our image-acceleration technology and optimized "fast puller" (How Superhuman and Databricks built a 200K QPS inference platform together). This post is about the first two stages, the upload and the replication.

image1.png

The problem grew with the model size. Kimi-K2.7 (600 GB) took more than 12 hours to upload. Replicating it to every region took about 3 days, because these long-running cross-region transfers dropped from time to time and had to restart. Kimi-K3 (1.56 TB) was projected roughly a day to upload and a week to replicate worldwide on the old path.

Those durations limited the pace at which the Unity Gateway team could ship. A model can't serve traffic in a region until it has been uploaded and replicated there, so this pipeline sits on the critical path of every launch and every update. When it takes days and can fail partway through, ordinary work like validating a new checkpoint, shipping a fix, or rolling out a new version turns into a multi-day operation someone has to watch. At Kimi-K3's size it was effectively unusable, and because each new frontier model is larger than the last, compounding the problem with every release.

Upload ran at about 15 MB/s, far below the network bandwidth limit. Using AI agents, we benchmarked each stage of the pipeline, ran experiments, and compared the results to find the bottleneck.

We started with the cross-region network and found ample headroom. Next, we tested the object storage on the receiving end; it could accept data much faster than we were sending it. Then we checked CPU, memory, and local disk. They were all far from saturated, and upload stayed at about 15 MB/s.

The clue was that running more transfers in parallel over HTTP/2 didn't help. Throughput stayed flat at about 15 MB/s no matter how many we ran at once. So we measured throughput per connection and tried switching the client to HTTP/1.1, which unexpectedly sent throughput into the hundreds of MB/s. A single connection topped out at about 17–18 MB/s, but spreading the transfers across separate connections scaled almost linearly, past 200 MB/s. The limit wasn't the number of transfers, but that they were all sharing one connection.

Replication had its own bottleneck on top of the connection limit. Each model was replicated by a single job that copied its files one at a time, utilizing one shared connection. For Kimi-K3, over a hundred large files had to be copied sequentially. Held to the single-connection rate, and with transient errors occasionally resetting a file, this would have taken days to complete.

Why it all went through one connection

Both upload and replication used HTTP/2. HTTP/2 is designed to carry many concurrent requests over a single reused connection, which is the right choice for the many small requests a web page makes. But a single connection has one flow-control window (a limit on how much data can be in flight before the receiver acknowledges it), and over long cross-region round trips that window, not the network, sets the ceiling. So every transfer, both the pusher's parallel uploads and the replication job's file copies, ran over one connection and was capped by its window; adding more transfers added no capacity.

The fix: many connections

Once we knew the shared connection was the ceiling, the fix was simple: give each transfer its own connection instead of sharing one enforced by HTTP/2. HTTP/1.1, unlike HTTP/2, does not enforce multiplexing, so the client uses separate connections with their own flow-control windows for concurrent transfers. We switched our client to HTTP/1.1, and throughput jumped into the hundreds of MB/s.

We also implemented a worker pool for cross-region replication. Each worker copies a file independently, over its own connection, so a model's files are copied in parallel.

Other changes that helped:

Larger transfer chunks, to cut per-request overhead in cloud storage

A larger server-side flow-control window, so each connection can keep more data in flight

Together, these changes raised throughput from about 15 MB/s to about 800 MB/s and removed the retries and mid-transfer failures.

The results are dramatic: upload is about 50x faster and replication about 20x, across models from hundreds of gigabytes to over a terabyte. The pipeline also became far more reliable, as the connection resets and retries that used to stretch a run out over days are gone.

1Replication "X / Y": X for one region, Y to reach all regions (some require multiple hops).

Upload throughput was improved from about 15 MB/s to 600–800 MB/s, and replication from 18 MB/s to 340–420 MB/s. Kimi-K3 (1.56 TB), which we projected would take about a day to upload and a week to replicate everywhere, now uploads in 32 minutes and reaches all regions in about 3 hours. A new model can now be in production worldwide the same day.

HTTP/2 is excellent for what it was built for: many small, concurrent requests sharing one reused connection, as in a web page load or service-to-service RPCs. But that same default, multiplexing everything onto a single connection, is a poor fit for bulk transfer, where many very large transfers over long round trips are all throttled by that one connection's flow-control window.

AI coding agents are well-suited to performance investigations. Much of the work (running benchmarks, adding instrumentation, sweeping configurations, and evaluating bottleneck candidates) is systematic and measurement-heavy, and an agent can drive those experiments and summarize the results far faster than doing it by hand.

When product infrastructure is evolving quickly, performance is easy to overlook: a path that works rarely gets a second look. Bottlenecks end up sitting in defaults no one revisited, where the fix often turns out to be simple relative to the gain.

Even though the throughput has been significantly improved, it's still well below the network bandwidth available. The remaining ceiling is structural: an OCI registry is content-addressed (every object is identified by the digest of its bytes), so each object's bytes must pass through the registry server sequentially for it to compute that digest. The registry sits in the data path, and adding more connections can't move it out of the way. The further improvements being considered are:

Direct upload to storage. Clients write files to object storage through short-lived, checksum-locked URLs; storage verifies each file's digest and the registry records only metadata.

Cloud-native copy. For replication between regions in the same cloud, the object store can copy a file server-side rather than streaming it through our services.

We're always looking for engineers who enjoy tackling gnarly performance and distributed systems challenges. If problems like these excite you, we'd love to hear from you, please check out open roles at databricks.com/careers!

Learn more about serving models on Databricks Mosaic AI Model Serving and Unity Gateway.

Get the latest posts in your inbox

原文为英文,正文由自动抓取并保留原文。

本文由采集器自动同步

原文发布于 Databricks Blog(How we ship terabyte LLM models 50x faster),标题、摘要与正文由机器翻译,术语按行业惯例统一,未经人工逐句校订。

阅读原文 ↗