Efficient - transmit only once - broadcast?

57 views
Skip to first unread message

Kostas kougios

unread,
Nov 2, 2015, 5:28:27 PM11/2/15
to Akka User List
I am looking for an efficient way to broadcast a case class only once to my akka cluster, i.e. broadcast it only once (so it is serialized only once over the wire) and received by multiple actors. Then one of those actors will reply back to the sender.

Is there a way to do this? I know I can broadcast it to a Cluster (Dist pub/sub) but this will send the message once to each ActorSystem. My message might be large so I am looking for a 1-send-over-the-wire only, if possible.

Thanks

Roland Kuhn

unread,
Nov 3, 2015, 7:24:26 AM11/3/15
to akka-user
Simple (simplistic?) solution: don’t send the large object, send its URI and have one of the clustered actors pick it up.

Regards,

Roland

--
>>>>>>>>>> Read the docs: http://akka.io/docs/
>>>>>>>>>> Check the FAQ: http://doc.akka.io/docs/akka/current/additional/faq.html
>>>>>>>>>> Search the archives: https://groups.google.com/group/akka-user
---
You received this message because you are subscribed to the Google Groups "Akka User List" group.
To unsubscribe from this group and stop receiving emails from it, send an email to akka-user+...@googlegroups.com.
To post to this group, send email to akka...@googlegroups.com.
Visit this group at http://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.



Dr. Roland Kuhn
Akka Tech Lead
Typesafe – Reactive apps on the JVM.
twitter: @rolandkuhn


Konstantinos Kougios

unread,
Nov 3, 2015, 8:26:37 AM11/3/15
to akka...@googlegroups.com
it is not an option as the actors have to react based on the large object's data. Only one of them will reply, based on that data
You received this message because you are subscribed to a topic in the Google Groups "Akka User List" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/akka-user/OiDvATVqxnI/unsubscribe.
To unsubscribe from this group and all its topics, send an email to akka-user+...@googlegroups.com.

Rüdiger Klaehn

unread,
Nov 3, 2015, 8:42:29 AM11/3/15
to akka...@googlegroups.com
This might not be very nice, but you could pre-serialize your large
object to a akka.util.ByteString. Serialization of an
akka.util.ByteString should be much cheaper than serializing a large.
complex data structure. I am assuming that the serialization overhead
is what you want to avoid.

Konstantinos Kougios

unread,
Nov 3, 2015, 10:14:12 AM11/3/15
to akka...@googlegroups.com
I assume serialization is optimal, but still the data size will be large.

Maybe UDP multicast (
http://doc.akka.io/docs/akka/2.4.0/scala/io-udp.html#UDP_Multicast ) is
what I need, though I need to dig in a bit to the docs to understand
how it works

Rüdiger Klaehn

unread,
Nov 3, 2015, 12:07:53 PM11/3/15
to akka...@googlegroups.com

UDP is limited to 65507 Bytes. Might be a bit small for large messages...

Viktor Klang

unread,
Nov 3, 2015, 12:12:51 PM11/3/15
to Akka User List

transmit only once would imply 100% lossless communication, which does not exist afaik?

--
Cheers,

Konstantinos Kougios

unread,
Nov 3, 2015, 12:48:06 PM11/3/15
to akka...@googlegroups.com
oh....

maybe breaking the msg into parts but it seems too much of a trouble
You received this message because you are subscribed to a topic in the Google Groups "Akka User List" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/akka-user/OiDvATVqxnI/unsubscribe.
To unsubscribe from this group and all its topics, send an email to akka-user+...@googlegroups.com.

Patrik Nordwall

unread,
Nov 4, 2015, 1:10:27 AM11/4/15
to akka...@googlegroups.com
Publishing to topic with Distributed PubSub will only transfer the message once per node that has any subscribers.

However, how large is large? Akka remoting is not designed for large messages, so you should consider splitting it up in parts or use another side channel, such as http or Akka IO.

/Patrik

Konstantinos Kougios

unread,
Nov 4, 2015, 12:54:54 PM11/4/15
to akka...@googlegroups.com


On 04/11/15 06:10, Patrik Nordwall wrote:
Publishing to topic with Distributed PubSub will only transfer the message once per node that has any subscribers.

However, how large is large? Akka remoting is not designed for large messages, so you should consider splitting it up in parts or use another side channel, such as http or Akka IO.
hmm, what sideeffect a large message can have (other than increasing the buffer sizes, maximum-frame-size ?) ?

Viktor Klang

unread,
Nov 4, 2015, 1:04:31 PM11/4/15
to Akka User List

delaying all other messages

--
Cheers,

Patrik Nordwall

unread,
Nov 4, 2015, 1:14:18 PM11/4/15
to Akka User List
and delaying other messages also means that cluster failure detector may trigger because heartbeat messages are delayed
Reply all
Reply to author
Forward
0 new messages