WS: Optimize first empty frame #748

Closed
jrudolph opened this Issue Jan 10, 2017 · 1 comment

Projects

None yet

2 participants

@jrudolph
Member

For implementation reasons, the WS implementation sends out a streamed WS message as this succession of frames:

TEXT         fin = false empty
CONTINUATION fin = false data chunk 1 
CONTINUATION fin = false data chunk 2
...
CONTINUATION fin = true  empty

https://github.com/akka/akka-http/blob/5932237a86a432d623fafb1e84eeeff56d7485fe/akka-http-core/src/main/scala/akka/http/impl/engine/ws/MessageToFrameRenderer.scala#L25-L25:

      Source.single(FrameEvent.empty(opcode, fin = false)) ++
        data.map(FrameEvent.fullFrame(Opcode.Continuation, None, _, fin = false)) ++
        Source.single(FrameEvent.emptyLastContinuationFrame)

The first frame could be optimized away.

This was observed in #730 by @elseorand.

@jrudolph jrudolph added a commit to jrudolph/akka-http that referenced this issue Jan 10, 2017
@jrudolph jrudolph =htc #748 optimize frame creation for streamed WS messages
Previously, a single empty frame was created to start a WS message. Now,
a streamed message will only be begun when the first data comes in.
d0fe2ac
@jrudolph jrudolph added a commit to jrudolph/akka-http that referenced this issue Jan 10, 2017
@jrudolph jrudolph =htc #748 optimize frame creation for streamed WS messages
Previously, a single empty frame was created to start a WS message. Now,
a streamed message will only be begun when the first data comes in.
cab0037
@jrudolph jrudolph added a commit to jrudolph/akka-http that referenced this issue Jan 16, 2017
@jrudolph jrudolph =htc #748 optimize frame creation for streamed WS messages
Previously, a single empty frame was created to start a WS message. Now,
a streamed message will only be begun when the first data comes in.
6e084f5
@jrudolph jrudolph added this to the 10.0.2 milestone Jan 16, 2017
@jrudolph
Member

Fixed by #749.

@ktoso ktoso closed this Jan 26, 2017
@ktoso ktoso removed the 1 - triaged label Jan 26, 2017
@jrudolph jrudolph was assigned by ktoso Jan 26, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment