Dropped data in Unix Domain Socket

Hi there,

I am trying to get into Akka system of actor and streams so sorry if this is newbie’s question. I am using UnixDomainSocket from alpakka and if there is big amount messages sended into socket, handler can not manage it and drops a big amount of messages. Is it expected behaviour? Is there some way to catch all messages?

Thanks for any advice

Full context:
I am implementing app which is listening on UNIX domain socket and process received data in pipeline of actors.
Firstly I used library junixsocket but I got it that it is not good idea use actor as active listener.

After that I choose use alpakka and its UnixDomainSocket. It was a little bit confusing fit together typed and classic actor but finally I have working pipeline.

But I have problem with performance. I create socket and starts listening (com.gcx.unixsocket.Consumer#run). Data are send into socket immediately one to one (com.gcx.unixsocket.Producer#run). Unfortunately I noticed there is big amount of dropped messages (50 percent at minimum).
I created example on gitlab.

Hi @sob,

the problem is that the chunks you put into the stream on the producer side will not be the same chunks you receive on the other side. If you want to have the same chunks on both sides you need some framing protocol on the wire. Here’s some explanation how you could it with streams: https://doc.akka.io/docs/akka/current/stream/stream-io.html#using-framing-in-your-protocol

Here are some changes that seem to work somewhat:

Johannes

Hi Johannes,

thank you for your quick answer and also for added Sink to pipeline end - I was trying use it but unsuccessfully.
I am grateful and I hope it can help also others.

Lukas

1 Like