Akka-remoting with Artery using load balancing/round robbing dns

62 views
Skip to first unread message

johan.kjolhed...@gmail.com

unread,
Nov 10, 2016, 4:48:00 AM11/10/16
to Akka User List
Case:

I have two services (A and B) that wish to talk to each other using akka-remoting over artery.
Each service executes on it's own machine behind a load balancer mapping a dns name, e.g. $A resolving -> multiple IP addresses.

For A to talk to B, we can for example execute:

// Make request from an A to a B
val b
= context.actorSelection(s"akka://$systemName@$B:$port/user/$actorName")
b ! Request()

where $B is the load balanced address that is resolved to a B instance (maybe B1, maybe B2.. etc)

In order for B to receive this message, B would need to have an akka conf with canonical.hostname = $B. Otherwise artery will filter out these messages...

So far, this works. However, now let's say this is bidirectional communication. 
B wants to reply to A's requests, but also, B wants to send its own independent requests to A and expect A to reply back to B.

B would then have something like the following code
// Reply from B back to A
def receive {
 
case  Request() => sender() ! Reply()
}

But because A has canonical.hostname set to $A, which is a load balanced address, the reply could end up at A1, A2 or any Ai for that matter.

To work around this, all I can think of is to let each actor resolution actually do a manual dns lookup before calling context.actorSelection.. and write the explicit resolved address of each actor to their own akka conf.
Is this conclusion correct?

I suspect akka.tcp does not have this problem as sender() would just re-use the existing tcp connection, but artery being build on udp, will suffer from the problem above.
Am I missing something? :)

/ Johan

Viktor Klang

unread,
Nov 10, 2016, 7:03:36 AM11/10/16
to Akka User List
the host needs to be a stable identifier.

What problem are you trying to solve with the rr dns?

--
>>>>>>>>>> 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+unsubscribe@googlegroups.com.
To post to this group, send email to akka...@googlegroups.com.
Visit this group at https://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.



--
Cheers,

johan.kjolhed...@gmail.com

unread,
Nov 10, 2016, 11:12:27 AM11/10/16
to Akka User List
Ok. Just wanted that confirmed. We already have a workaround for it so I was mostly just curious to see if it was needed :).

/ Johan

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 https://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.



--
Cheers,

Endre Varga

unread,
Nov 10, 2016, 11:14:53 AM11/10/16
to akka...@googlegroups.com
Actor remote messaging is a P2P protocol and as such any kind of name-remapping is harmful. Trying to load balance Akka Remote connections I think is a mistake and makes not much sense. You *can* load balance Akka provided services of course, but you need to expose them as a different protocol (i.e. REST API, custom TCP endpoint, etc.). 

To unsubscribe from this group and stop receiving emails from it, send an email to akka-user+unsubscribe@googlegroups.com.

Patrik Nordwall

unread,
Nov 10, 2016, 12:03:46 PM11/10/16
to akka...@googlegroups.com
And for the record, it's just accidental that it works with tcp. We don't guarantee that the same connection is reused.

Viktor Klang

unread,
Nov 10, 2016, 12:20:44 PM11/10/16
to Akka User List
Consider that confirmed then. ;)

On Thu, Nov 10, 2016 at 5:12 PM, <johan.kjolhed...@gmail.com> wrote:
To unsubscribe from this group and stop receiving emails from it, send an email to akka-user+unsubscribe@googlegroups.com.

To post to this group, send email to akka...@googlegroups.com.
Visit this group at https://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.



--
Cheers,

Johan Kjölhede

unread,
Nov 10, 2016, 1:21:10 PM11/10/16
to akka...@googlegroups.com
Thanks for clarifying that. We suspected that but weren't sure. We can close this thread ;). Thanks everyone for great input

Skickat från min iPhone
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/0M_-nRo_dPw/unsubscribe.
To unsubscribe from this group and all its topics, send an email to akka-user+...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages