Consider disabling WebSocket message splitting when permessage-deflate is off

未关闭
#7,724 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
45/100
Issue 类型
功能
描述清晰度
需要澄清
活跃度
冷清
技术栈
typescript, vscode

调研方向

首先查看 ipc.net.ts,尤其是 MaxWebSocketMessageLength 以及 issue 中描述的 enableMessageSplitting 行为。在高延迟的 proxied 连接下比较 splitting 和不 splitting 的路径,然后确定完成是指 CLI 可配置的设置,还是由延迟和压缩安全性检查支持的默认值变更。

由索引模型根据 Issue 内容生成。

描述

code-server enhancement needs-investigation

WebSocket message splitting adds significant latency for large files on proxied connections

When serving code-server behind a proxy (which is the common production deployment), the 256KB WebSocket message splitting introduced in microsoft/vscode#174278 multiplies per-message RTT overhead significantly for large file operations like image previews.

Background

VS Code splits large IPC messages into 256KB chunks (MaxWebSocketMessageLength = 256 * 1024 in ipc.net.ts) to avoid blocking the Node.js event loop during zlib compression. Each chunk becomes a separate WebSocket message.

The latency problem in proxied deployments

In a proxied deployment (e.g. a gateway in front of a devbox), each WebSocket message incurs a full round-trip. With 100ms RTT between the proxy and the devbox:

  • A 10MB file generates ~40 chunks (10MB ÷ 256KB)
  • Each chunk = one WebSocket message = one round-trip
  • Total overhead: ~40 × 100ms = ~4 seconds of pure latency

We tested image preview times (time from opening a file in the explorer to the image fully rendering) across different file sizes at 100ms simulated RTT:

File size Splitting ON Splitting OFF Improvement
145 KB 2,212ms 2,251ms ~0%
1 MB 1,988ms 1,707ms 14%
1.5 MB 2,093ms 1,412ms 33%
5.6 MB 4,255ms 2,193ms 48%
10.3 MB 7,262ms 2,888ms 60%
Is disabling splitting safe? (Does zlib actually block?)

A few basic tests didn't seem to indicate this issue in our case, but more investigation may be needed

Question

Would you consider making enableMessageSplitting configurable via a CLI flag, or defaulting it to false for single-user deployments?

Happy to submit a PR if there's agreement on the right approach.

主要语言
TypeScript
星标
79.4k
派生
6.9k
平均合并
2 天 13 小时
30 天内合并 PR
39

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

coder/code-server 的其他 Issue

查看 coder/code-server 的全部 Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。