1
votes

I have a simple WebSocket application, which is based on Akka HTTP/Reactive streams, like this https://github.com/calvinlfer/akka-http-streaming-response-examples/blob/master/src/main/scala/com/experiments/calvin/ws/WebSocketRoutes.scala#L82.

In other words, I have Sink, Source (which is produced from Publisher), and the Flow:

Flow.fromSinkAndSource(incomingMessages, outgoingMessages)

When I produce more, than 30 messages per second to the client, Akka closes a connection.

I cannot understand, where is a setting, which configure this behaviour. I know about OverflowStrategy, but I don't explicitly configure it.

It seems, that I have OverflowStrategy.fail(), or my problem looks like it.

1
and what does your outgoingMessages look like? The one from the code linked clearly has the overflow strategy set to fail...Frederic A.
@FredericA. my outgoingMessages is Source.fromPublisher(publisher).watchTermination() { (_, future: Future[Done]) =>Max
@FredericA. pastebin.com/vU7A01G8 is my serverMax

1 Answers

1
votes

You can tune Internal buffers.

There are two ways, how to do it:

1) application.conf:

akka.stream.materializer.max-input-buffer-size = 1024

2) You can configure it explicitly for your Flow:

Flow.fromSinkAndSource(incomingMessages, outgoingMessages)
  .addAttributes(Attributes.inputBuffer(initial = 1, max = 1024))