These are chat archives for akkadotnet/akka.net

12th
Jul 2016
Corneliu
@corneliutusnea
Jul 12 2016 06:39
guys, I have to do some dispatching for children actors based on a key. Whats the recommended pattern:
  1. to keep an IDictionary<string, IActorRef> children = ... and do my management of child actor references . Then when I need to send a message I can use do children[key].Tell( message )
  2. just fire the event to the children and listen to deadletter queue for missed events?
  3. use the ActorSelector which I read it's slow-ish
Ricky Blankenaufulland
@ZoolWay
Jul 12 2016 06:51
@Aaronontheweb I have tried to add some of the exception I am seeing after the ASP NET Core webhost has shutdown and I try to leave the cluster. But the comment feature of SO is a bit limited for this. WIll put together something on pastebin
Ricky Blankenaufulland
@ZoolWay
Jul 12 2016 06:58
@corneliutusnea I would recommend using a router if possible
You can choose a delivery strategy like random, round-robin or use hashing for your own logic, see http://getakka.net/docs/working-with-actors/Routers#consistenthashing
Otherwise your dictionary is just some kind of re-inventing routing ;)
Corneliu
@corneliutusnea
Jul 12 2016 07:09
@ZoolWay yeah, thought about a router, I could even use a group but I need an easy way to react if a route (or child) is not in the list
Ricky Blankenaufulland
@ZoolWay
Jul 12 2016 07:09
You mean if the number of routees becomes too low or if a special kind of routees fails?
Corneliu
@corneliutusnea
Jul 12 2016 07:09
if a route name is wrong
Ricky Blankenaufulland
@ZoolWay
Jul 12 2016 07:10
Regardless of that one router you will always want to check dead letters to find out I guess. But I am still an Akka.NET apprentice so maybe someone else knows better ;)
When I thin about it, even the route name to your parent actor might be wrong so yeah, dead letters is the way to detect that
Do you compose the actor paths?
Arsene Tochemey GANDOTE
@Tochemey
Jul 12 2016 07:12
Hello does the creation of an Actor expensive? The reason I am asking that question is that I want to create my actors from configuration using the .NET type feature and the Props each time I need them. This is an example of what I am trying to do:
            var pluginType = ConfigurationManager.AppSettings["ModPlugin"];
            var plugin = Type.GetType(pluginType);
            var props = new Props(plugin);
            var pluginActor = system.ActorOf(props, "plugin");
Corneliu
@corneliutusnea
Jul 12 2016 07:12
yes, my system is quite dynamic and I do get sometimes wrong routes and I need a way to react to that and I dislike the dead letter queue .. it's too broad
@Tochemey creating actors is not expensive but in your above code the Type.GetType is expensive
do that call once in your constructor
and you'll be fine
Arsene Tochemey GANDOTE
@Tochemey
Jul 12 2016 07:13
ok
Ricky Blankenaufulland
@ZoolWay
Jul 12 2016 07:13
@corneliutusnea I understand, maybe you can filter the failed message with a common base type or interface?
Corneliu
@corneliutusnea
Jul 12 2016 07:16
@ZoolWay yeah . I'm sure I can but I dislike the idea of the deadletter to be a single bottleneck where I have to filter messages
I'd like the deadletter to be hierarchical :D hahaha .. so I can pickup dead letters from a path directly.. I'm sure it's possible or maybe it's already in there
I'll see what I can do
Ricky Blankenaufulland
@ZoolWay
Jul 12 2016 07:17
so if you really design your own router you could make sure to have the route to that always right and then have it checking the route for the payload it gets and handle it if it is wrong before producing a dead letter - and if everything is right, .Forward() it to a Akka.NET router...
not sure if that would be applicable
Corneliu
@corneliutusnea
Jul 12 2016 07:18
@ZoolWay how is that different then having my own dictionary and checking the route and then telling the child? I'd need to checkout how the Group Routing is implemented
Ricky Blankenaufulland
@ZoolWay
Jul 12 2016 07:19
Just thinking you could always reconfigure without coding what goes on. Of course you can just forward it to the child too.
But I am still not sure if it wouldn't be possible to capture a failed message before it becomes a dead letter.... all this failure strategies. maybe it is possible.
Valeriy Reutskiy
@vvreutskiy
Jul 12 2016 08:10
Hello! Is there any scenarios to deploy akka.net cluster in azure worker role? I figured out that I can not get a worker instance with known IP address (for seed node) - Azure Cloud Service issues IP addresses dynamically.
Arsene Tochemey GANDOTE
@Tochemey
Jul 12 2016 08:22
Hello assuming I am dealing with a webservice that does blocking and I am using an Actor to interact with it. How do I go about it seeing that we do not block in an Actor system?
Alex Valuyskiy
@alexvaluyskiy
Jul 12 2016 08:23
@vvreutskiy Is it possible, technically. You should create at least two workers roles. One for a seed node, and one for your default node. You also should tweak timeouts, because Cloud Services has unpredictable (for akka) lifecycle. It would be better to run Akka on Azure Service Fabric, or create your own cluster on IaaS
Valeriy Reutskiy
@vvreutskiy
Jul 12 2016 08:25
@alexvaluyskiy but how will default node find seed node, if seed node have dynamic IP address?
Ricky Blankenaufulland
@ZoolWay
Jul 12 2016 08:29
@Tochemey You delegate the call to the webservice to a child actor/s
@vvreutskiy @alexvaluyskiy I guess DNS (but I am not familiar with Azure)? But note that there a some bugs in 1.1 regarding DNS
Arsene Tochemey GANDOTE
@Tochemey
Jul 12 2016 09:01
How do I provide a generic method to create any type of actor?
Marc Piechura
@marcpiechura
Jul 12 2016 09:03
@Tochemey @ZoolWay you should use a blocking IO dispatcher for that child if the webservice really doesn't provide async methods
Ricky Blankenaufulland
@ZoolWay
Jul 12 2016 10:55
@Aaronontheweb Regarding the shutdown: I have posted a solution for TopShelf in the StackOverflow question and also published examples for console, ASP.NET Core and topshelf on GitHub ( https://github.com/ZoolWay/akka-net-cluster-graceful-shutdown-samples ). These samples still produce some errors and dead letters but the nodes actually leave the cluster in the end. An example for the exceptions and dead letters can be found in the gist (https://gist.github.com/ZoolWay/8092e7c2aa3a86b009981885cd4aa271) in the first comment. Not sure if they are by design. Also I am still struggling with leaving in larger apps and trying to reproduce them
Peter Bergman
@peter-bannerflow
Jul 12 2016 11:24
I just saw this message in the log of one of my nodes, I guess the information is quite clear... but when is it triggered? Is there some threshold when the buffer gets too large or similar?
Akka.Remote.EndpointWriter: [481678] buffered messages in EndpointWriter for [akka.tcp://bf@10.0.0.5:5052]. You should probably implement flow control to avoid flooding the remote connection.
Peter Bergman
@peter-bannerflow
Jul 12 2016 12:17
Ah, I now found where its set: https://github.com/akkadotnet/akka.net/blob/4acfa7c363bfa83ac71849a5a8487c8d6b1bbcb1/src/core/Akka.Remote/RemoteSettings.cs#L25-L34 but I haven't explicitly configuered akka.remote.log-buffer-size-exceeding so I guess it defaults to what ever GetInt gives as default , zero?
wdspider
@wdspider
Jul 12 2016 13:34
@peter-bannerflow I believe the default values are the values listed in the related config file. In the specific case of akka.remote.log-buffer-size-exceeding, the value 50000 is listed here https://github.com/akkadotnet/akka.net/blob/4acfa7c363bfa83ac71849a5a8487c8d6b1bbcb1/src/core/Akka.Remote/Configuration/Remote.conf#L146
Peter Bergman
@peter-bannerflow
Jul 12 2016 14:31
@wdspider Ah, ok cool, thx. Do you know the internals of that buffer? Does it buffer messages before they are sent over the network?
wdspider
@wdspider
Jul 12 2016 14:54
not really, pretty new to things myself. Just happened to have stumbled across the config files while looking at some of the source :)
Peter Bergman
@peter-bannerflow
Jul 12 2016 14:54
Hehe ok, I see
Arsene Tochemey GANDOTE
@Tochemey
Jul 12 2016 15:23
Hi Gentlemen is there a way to check the existence of an Actor?
to11mtm
@to11mtm
Jul 12 2016 15:26
@Tochemey you can send the actor an Identify message. You should get an ActorIdentity back if it exists : http://getakka.net/docs/Working%20with%20actors
Aaron Stannard
@Aaronontheweb
Jul 12 2016 16:01
@ZoolWay that gist 404s
might have created it as private
Jordan S. Jones
@jordansjones
Jul 12 2016 16:36
@Aaronontheweb Github is currently experiencing issues
wdspider
@wdspider
Jul 12 2016 17:18
Is there an example of how to add a version path to your actor hierarchy so the path looks something like /user/v1/MyRootActorPool ? Or do you have to create an actual v1 actor that then has the MyRootActorPool as a child?
Curtis Swartzentruber
@skills0
Jul 12 2016 18:28
We have an interesting usage of cluster with our app: 2 Windows services running in active/passive mode for failover. Both are configured as seed nodes. In some environments we can fail over back and forth no problem. In others we get "Leader can currently not perform its duties" when one node goes down and the up node goes into a association error loop. We were seeing this before 1.1 as well and hoped it would be fixed. 1.1 did improve the association issues when the down node comes back up. That is working much better. Any ideas what is causing this? We could have something misconfigured.
Arsene Tochemey GANDOTE
@Tochemey
Jul 12 2016 18:46
Can I please an example of exception handling with Actors? I have read we can handle exception in the supervisor. However I want to handle some exception in the actor due to external web service calls.
Bart de Boer
@boekabart
Jul 12 2016 18:53
try/catch in the Receive handler is just fine
Arsene Tochemey GANDOTE
@Tochemey
Jul 12 2016 18:53
@boekabart Thank you. I thought as much but I needed a recommende way.
Bart de Boer
@boekabart
Jul 12 2016 18:53
but the more typical way of working would be to use a Character Actor (thay may die) to do the dangerous work
Character actor being a child actor of the actor that's supposed to do the work
Arsene Tochemey GANDOTE
@Tochemey
Jul 12 2016 19:06
Hello I know that an Actor handle one and only one message at a time. Let us assume that we want to handle multiple instances of the same message concurrently. Can someone tell me the recommended and best approach to this problem?
Bart de Boer
@boekabart
Jul 12 2016 19:13
broadcast it to N actors. Doesn't even have to be different instances, in fact.
If you mean 'multiple instances of the same message class', the typical way is to create N instances of your handler actor with a router Props.Create<HandlingActorClass>().WithRouter(...)
Arsene Tochemey GANDOTE
@Tochemey
Jul 12 2016 19:29
@boekabart Thank you. I have used another approach that is to create another instance of the same actor since I m dealing with Http request. And I want to use the request handler actor to handle each request that comes. I believe it is a good approach.
Another challenge I am facing is the Fault tolerance. I could not see any reliable article on it. Even the one on the site lacks code snippets http://getakka.net/docs/Fault%20tolerance