Disable CDP proxy compression#256
Merged
Merged
Conversation
Turn off websocket permessage-deflate for CDP proxy traffic after benchmarking screenshot latency through the built headless image. Co-authored-by: Cursor <cursoragent@cursor.com>
hiroTamada
approved these changes
May 28, 2026
Contributor
hiroTamada
left a comment
There was a problem hiding this comment.
lgtm. clean two-line proxy change + well-scoped e2e benchmark. trade-off (CPU/latency for wire bytes) is the right call for screenshot-heavy CDP workloads; worth keeping an eye on JSON-heavy traffic over slow links.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Page.captureScreenshotcalls through the built headless image.Benchmark results
Command:
Image was rebuilt before each benchmark:
DOCKER_BUILDKIT=1 docker build -f images/chromium-headless/image/Dockerfile -t onkernel/chromium-headless-test:latest .CompressionContextTakeover)302.5ms/op4.674 screenshot_MiB/s1,482,564 screenshot_bytes/opCompressionDisabled)236.7ms/op5.974 screenshot_MiB/s1,482,564 screenshot_bytes/opDisabling compression improved this screenshot benchmark by roughly 22% latency / 1.28x throughput.
Test plan
go test -run '^$' -bench '^$' ./e2ego test ./lib/devtoolsproxyonkernel/chromium-headless-test:latestBenchmarkCDPCaptureScreenshotbefore and after disabling proxy compressionMade with Cursor
Note
Low Risk
Proxy-only transport change with no auth or API surface changes; tradeoff is higher wire size on compressible traffic in exchange for lower CPU/latency on large CDP messages.
Overview
Turns off permessage-deflate on both the client-facing and upstream WebSocket legs in
devtoolsproxy(CompressionDisabledinstead ofCompressionContextTakeover), so CDP traffic—including large base64 screenshot payloads—is no longer compressed in the proxy path.Adds
BenchmarkCDPCaptureScreenshotin e2e: Docker headless container, CDP target setup, repeatedPage.captureScreenshot, and custom metrics (screenshot_bytes/op,screenshot_MiB/s) to track proxy screenshot performance over time.Reviewed by Cursor Bugbot for commit ccc0fc6. Bugbot is set up for automated code reviews on this repo. Configure here.