You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@pekko.apache.org by GitBox <gi...@apache.org> on 2026/09/11 09:09:17 UTC

[GH] (pekko-http/perf/bytestring-output-stream): Workflow run "Validate and test" failed!

The GitHub Actions job "Validate and test" on pekko-http.git/perf/bytestring-output-stream has failed.
Run started by GitHub user pjfanning (triggered by pjfanning).

Head commit for run:
610069b73cf8c8ca075b44e31d33254cd59fb8d2 / PJ Fanning <pj...@users.noreply.github.com>
perf: avoid copying WebSocket deflate/inflate output

Motivation:
PerMessageDeflate buffers the output of the Deflater/Inflater in a
ByteArrayOutputStream and then calls ByteString.fromArrayUnsafe on
toByteArray. ByteArrayOutputStream.toByteArray always copies the buffer,
so every compressed or decompressed WebSocket frame pays a full copy of
its payload.

Modification:
Add an internal ByteStringOutputStream that extends
ByteArrayOutputStream and exposes toByteStringUnsafe, wrapping the
internal buffer in a ByteString without copying when most of the buffer
is used, and copying to a right-sized array otherwise so a large buffer
is not retained by a small payload. Use it for the inflate and deflate
paths in PerMessageDeflate, which allocate the stream per call and
discard it immediately afterwards.

Result:
No copy of the payload per WebSocket frame when permessage-deflate is
enabled, and no oversized buffer retained when a frame only fills a
small part of it.

Tests:
- sbt "http-core/testOnly org.apache.pekko.http.impl.util.ByteStringOutputStreamSpec org.apache.pekko.http.impl.engine.ws.WebSocketServerSpec" - 51 tests succeeded
- scalafmt --list --mode diff-ref=upstream/main - no files reported
- sbt headerCreateAll - headers added for the new files

References:
None - the ByteStringOutputStream implementation is adapted from Apache
Pekko gRPC (Apache License 2.0), https://github.com/apache/pekko-grpc/pull/862

Report URL: https://github.com/apache/pekko-http/actions/runs/34581936210

With regards,
GitHub Actions via GitBox


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org
For additional commands, e-mail: notifications-help@pekko.apache.org