Skip to content

Disable CDP proxy compression#256

Merged
rgarcia merged 1 commit into
mainfrom
disable-cdp-proxy-compression
May 28, 2026
Merged

Disable CDP proxy compression#256
rgarcia merged 1 commit into
mainfrom
disable-cdp-proxy-compression

Conversation

@rgarcia
Copy link
Copy Markdown
Contributor

@rgarcia rgarcia commented May 28, 2026

Summary

  • Disable websocket permessage-deflate for both legs of the CDP proxy.
  • Add an e2e benchmark for repeated Page.captureScreenshot calls through the built headless image.

Benchmark results

Command:

go test -run '^$' -bench '^BenchmarkCDPCaptureScreenshot$' -benchtime=20x -count=1 -v ./e2e

Image was rebuilt before each benchmark:

DOCKER_BUILDKIT=1 docker build -f images/chromium-headless/image/Dockerfile -t onkernel/chromium-headless-test:latest .
Proxy compression Result Throughput Payload
Enabled (CompressionContextTakeover) 302.5ms/op 4.674 screenshot_MiB/s 1,482,564 screenshot_bytes/op
Disabled (CompressionDisabled) 236.7ms/op 5.974 screenshot_MiB/s 1,482,564 screenshot_bytes/op

Disabling compression improved this screenshot benchmark by roughly 22% latency / 1.28x throughput.

Test plan

  • go test -run '^$' -bench '^$' ./e2e
  • go test ./lib/devtoolsproxy
  • Rebuilt onkernel/chromium-headless-test:latest
  • Ran BenchmarkCDPCaptureScreenshot before and after disabling proxy compression

Made 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 (CompressionDisabled instead of CompressionContextTakeover), so CDP traffic—including large base64 screenshot payloads—is no longer compressed in the proxy path.

Adds BenchmarkCDPCaptureScreenshot in e2e: Docker headless container, CDP target setup, repeated Page.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.

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>
Copy link
Copy Markdown
Contributor

@hiroTamada hiroTamada left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@rgarcia rgarcia merged commit 6ba41bd into main May 28, 2026
10 checks passed
@rgarcia rgarcia deleted the disable-cdp-proxy-compression branch May 28, 2026 14:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants