These are chat archives for akkadotnet/akka.net

22nd
Jul 2016
Weston
@ronnyek
Jul 22 2016 01:38
appreciate it
so that page calls out the crawling example
does that thing just literally just try and consume as many urls as fast as it possibly can spinning up parsers and stuff
Weston
@ronnyek
Jul 22 2016 01:43
eg, might be 1000 actors?
Bart de Boer
@boekabart
Jul 22 2016 05:47
If the cluster is big enough...
Roger Johansson
@rogeralsing
Jul 22 2016 05:59
What do you all think of the new SO documentation site? anything we should look into? e.g. http://stackoverflow.com/documentation/akka.net
Alex Valuyskiy
@alexvaluyskiy
Jul 22 2016 06:18
@rogeralsing I see that only topics from the latest version of language/framework are popular
Arjen Smits
@Danthar
Jul 22 2016 07:02
@DamianReeves Once you go to clustering, any message you want to send across your cluster needs to be serializable.
Weston
@ronnyek
Jul 22 2016 07:44
is 1000 actors a lot?
I mean seems like 1000 actors should be a fairly small number
unless I misunderstand actors
=)
Vagif Abilov
@object
Jul 22 2016 07:45
@ronnyek Nope. An actor can take as little as 300 bytes or something, so you can have million.
Weston
@ronnyek
Jul 22 2016 07:45
that was my point... is the idea if say I created a storage actor that saved something
would I want just one
or do I need to say I want 5 actual instances handling inserting stuff into storaage
to scale better
if I have a actor thats lisetning and acting on a message of do something, and two messages theoretically come in at the same time
does akka spin up a second actor to handle that
or is an actor like a role, and not so much an actual instance
Marc Piechura
@marcpiechura
Jul 22 2016 07:49
It is a actual instance but only handles one message at a time, so this instance would process the first message and then the second one. Inside of an actor everything runs synchronously
Vagif Abilov
@object
Jul 22 2016 07:49
When I began with Akka I was also uncertain about creating many actors, but it's the whole point with actor model that you have tiny pieces of code that are sleeping most of the time without consuming CPU.
Weston
@ronnyek
Jul 22 2016 07:50
I'm not worried about creating actors
I just am not sure what the expectation on my part is
Marc Piechura
@marcpiechura
Jul 22 2016 07:50
Keep in mind that even if you send 10 actors a message at the same time only <number of cores> can run in parallel
Vagif Abilov
@object
Jul 22 2016 07:50
So I'd say it's fine having an actor per bank account or web shop user etc.
Weston
@ronnyek
Jul 22 2016 07:50
oh yeah
I mean maybe its a terrible association, but maybe the idea is a rough correllation with say a thread
3 actor of same type is really just ability to handle 3 of the exact same message at a time
I realize thats not accurate
I wish the examples of architecture with akka were not just the webcrawler =)
Marc Piechura
@marcpiechura
Jul 22 2016 07:58
best way to learn is to fix this and send a PR with a different architecture example :)
Aaron Stannard
@Aaronontheweb
Jul 22 2016 08:16
@ronnyek if you're worried about all of these low-level details, try reading the source code
that's the best documentation in existence
or just build a simple app and profile it
Peter Bergman
@peter-bannerflow
Jul 22 2016 08:31
This message was deleted
Ricky Blankenaufulland
@ZoolWay
Jul 22 2016 12:05
Can I set Akka.NET logging to level debug but disable all the cluster gossip logging? I mean without setting up filters in my logging backend (log4net).
Bart de Boer
@boekabart
Jul 22 2016 12:24
log4net has excellent filtering options for that :)
Ricky Blankenaufulland
@ZoolWay
Jul 22 2016 12:30
It misses the AND-filter... will have to implement one from a stackoverflow example then
because I would like to filter out all Akka.* message (which is easy) but only when of level debug
Alex Valuyskiy
@alexvaluyskiy
Jul 22 2016 12:35
@ZoolWay you could try akka.cluster.debug.verbose-heartbeat-logging = off and/or akka.remote.log-remote-lifecycle-events=off
Ricky Blankenaufulland
@ZoolWay
Jul 22 2016 12:45
@alexvaluyskiy Thanks. But that does not work - guess it is more opt-in to more logging. I will enhance my log4net filtering then
Max
@maxpaj
Jul 22 2016 12:46
This message was deleted
Weston
@ronnyek
Jul 22 2016 15:36
reading source... I've encountered very few codebases where that was hugely helpful in anything outside of bug fixing
if akka.net survived being ported from java/scala to c# and is readable to the point where source is documentation
my hats off to you guys =0
Iuri L. Machado
@imetallica
Jul 22 2016 15:37
@ronnyek let us not forget about F# as well. :)
Which have amazing bindings for it.
Weston
@ronnyek
Jul 22 2016 16:36
I've yet to have a need where f# could really kick some ass for me
I mean i know f# can do almost everything c# can
but maybe non-equivalent levels of effort
Iuri L. Machado
@imetallica
Jul 22 2016 16:38

@ronnyek F# can do everything C# can do. Not almost everything.

I like the strong typing. It makes coding a less painful experience. And no runtime exceptions. :)

Peter Rosconi
@prosconi
Jul 22 2016 16:40
@imetallica it's not all roses, I've been wrestling with serialization of certain F# types
Iuri L. Machado
@imetallica
Jul 22 2016 16:41
@prosconi sure it isn't nothing is perfect but, imho it's totally worth the tradeoff in the long run.
Peter Rosconi
@prosconi
Jul 22 2016 16:42
Definitely prefer it though
Iuri L. Machado
@imetallica
Jul 22 2016 16:44
I'm kinda new to the .net ecossystem (I have an Erlang background). So far, I'm mostly impressed with F#. I don't know why Microsoft doesn't invest more on it, since Scala is gaining so much traction that is replacing Java in some industries.
Peter Rosconi
@prosconi
Jul 22 2016 16:45
AFAIK, F# is divorced from MS now, it is completely open source
Iuri L. Machado
@imetallica
Jul 22 2016 16:46
Well, MS is still backing it through the F# foundation, no?
Peter Rosconi
@prosconi
Jul 22 2016 16:48
No idea
Peter Rosconi
@prosconi
Jul 22 2016 16:56
Has anyone been using Akka.Serialization.Wire? How is it?
Weston
@ronnyek
Jul 22 2016 17:24
well c# is strongly typed
and what I meant was I can make a web app in f# but it definitely seemed like more work in f#
if it were a matter of stream processing or pattern matching, or stuff that would really benefit more from being functional in nature
I'd definitely investigate f# further. Also sounds like ms is going to make it even more of a first class citizen in upcomign months
Peter Rosconi
@prosconi
Jul 22 2016 17:26
just curious, what type of web app? ASP.NET, OWIN?
Weston
@ronnyek
Jul 22 2016 17:26
just saying
nothing specific
I'm aware you can use f# places you'd use c#
Peter Rosconi
@prosconi
Jul 22 2016 17:27
oh, well with project templates and things (asp.net), i would agree it is harder to bootstrap it up in F# since the templates aren't built-in
Andre
@ondrelogin
Jul 22 2016 19:28

I'm doing a c# akka. I have a top level actor (ReceiveActor) and it creates several child Actors and I'm specifying a ActorOf(.., name). (storying them as a List<IActorRef>).

I want to handle the case where all the childActors are effectively invalid and new to be reset (i.e. I want to reset and recreate them via ActorOf(Props.Create()).

My code basically loops through my IActorRef and Context.Stop(actorRef). Then I go and redo some ActorOf(Props.Create()) with new state. Then I get a InvalidActorNameException because my top level actor somehow still has a reference to the name.

  • Is there a better pattern for this?
  • Is there a way to Unregister a Name?
(spelling) second paragraph: "...and need to be reset (i.e..."
Bartosz Sypytkowski
@Horusiath
Jul 22 2016 19:31
@ondrelogin stopping doesn't have to be immediate action. When you're creating an actor, set a watch over it with context.Watch(childRef), and then handle actor termination signal with Receive<Terminated>(t => childrenRefs.Remove(t.ActorRef)). This way you'll keep list of your actors updated no matter why they have died
Andre
@ondrelogin
Jul 22 2016 19:55

@Horusiath I'm not sure how using Watch(childRef) would help.

private void CreateChildActors()
{
  var a = Context.ActorOf(Props.Create(() => new MyActor(_state), "actorA");
  _childRefs.Add(a);
}
private void HandleResetActors()
{
  foreach (var a in _childRefs) { Content.Stop(a); }
  _childRefs.Clear();
  this.CreateChildActors();
}

The key issue being, I do some crazy complex things with _state;
When I first initialize my TopActor CreateChildActors runs fine. When I run HandleResetActors it errors when I'm "recreating" MyActor because "actorA", is still referenced (i.e. InvalidActorNameException).

I did some more poking around in the getakka.net site. Based on your comment, is maybe using the GracefulStop extension method better? The "immediate action" concept is maybe what is messing up my code? Is the core issue that I have to wait for the actual Stops to be done before I can "readd" my new Actors?

Bartosz Sypytkowski
@Horusiath
Jul 22 2016 19:57
@ondrelogin Isn't easier to have something like UpdateState message, where you can pass new state for children to update?
Arsene T. Gandote
@Tochemey
Jul 22 2016 20:06
Hello I have grabbed the concept of FSM via switchable behaviours. However can someone explain the FSM API. Also I would like to know whether with AKKA.Net one can implement a FSM with message.
Andre
@ondrelogin
Jul 22 2016 20:09

@Horusiath well, when you say it that way.. of course that makes sense. ugh. I think I will try that, but for sake of understanding the Akka platform:

var shutdown = actorRef.GracefulStop(timeoutTimeSpan);
var thunk = shutdown.Result;

I tried to find the Stop message but I couldn't find it.

Bartosz Sypytkowski
@Horusiath
Jul 22 2016 20:10
@ondrelogin there is no stop message - you can send PoisonPill.Instance, but keep in mind, that it won't work immediatelly
@Tochemey FSM API is for rather advanced use cases (an IMHO none of the use cases is "advanced" enough to use it)
Andre
@ondrelogin
Jul 22 2016 20:16
@Horusiath I got the idea from http://getakka.net/docs/working-with-actors/stopping-actors where it says "There is also an overload you can use to swap in a different message for PoisonPill (e.g. Stop instead of PoisonPill)." My assumption is that GracefulStop returns a Task<bool>. thus my var thunk = shutdown.Result handles the waiting for it to finish (i.e. remove the Actor address reference) and then I could add it back.
Bartosz Sypytkowski
@Horusiath
Jul 22 2016 20:18
@ondrelogin still I don't know why are you killing your actors to restart them immediately after ;)
Peter Rosconi
@prosconi
Jul 22 2016 22:13
Anybody know why I get NullReferenceException when doing Cluster.Get(system)
Object reference not set to an instance of an object. at Akka.Cluster.ClusterSettings..ctor(Config config, String systemName) at Akka.Cluster.Cluster..ctor(ActorSystemImpl system) at Akka.Cluster.ClusterExtension.CreateExtension(ExtendedActorSystem system) at Akka.Actor.ExtensionIdProvider`1.Akka.Actor.IExtensionId.CreateExtension(ExtendedActorSystem system) at Akka.Actor.Internal.ActorSystemImpl.<>c__DisplayClass55_0.<RegisterExtension>b__1() at System.Lazy`1.CreateValue() at System.Lazy`1.LazyInitValue() at System.Lazy`1.get_Value() at Akka.Actor.Internal.ActorSystemImpl.TryGetExtension(Type extensionType, Object& extension) at Akka.Actor.Internal.ActorSystemImpl.GetExtension(IExtensionId extensionId) at Akka.Actor.ExtensionIdProvider`1.Get(ActorSystem system) at Akka.Actor.ExtensionIdProvider`1.Akka.Actor.IExtensionId.Get(ActorSystem system) at Akka.Actor.Internal.ActorSystemImpl.RegisterExtension(IExtensionId extension) at Akka.Actor.ActorSystemWithExtensions.WithExtension[T,TI](ActorSystem system) at Akka.Cluster.Cluster.Get(ActorSystem system)
Andre
@ondrelogin
Jul 22 2016 22:22
@Horusiath Thanks for all your help.
to11mtm
@to11mtm
Jul 22 2016 22:25
@prosconi: I could be wrong, but I'm thinking that you have some sort of extension defined in your config that could not be loaded. Perhaps a plugin is pointing to a DLL that isn't present... got the config?
Peter Rosconi
@prosconi
Jul 22 2016 22:27
@"akka {
            actor {
                provider = ""Akka.Remote.RemoteActorRefProvider, Akka.Remote""
            }
            remote {
                helios.tcp {
                    port = 0
                    hostname = localhost
                    maximum-frame-size = 4000000b
                }
            }
            cluster {
                seed-nodes = [""akka.tcp://sbs@localhost:4053""]
            }
        }"
how do i make code work properly lol
Peter Rosconi
@prosconi
Jul 22 2016 22:40
OK, what in the world
I had to do this
actor.provider = ""Akka.Cluster.ClusterActorRefProvider, Akka.Cluster""
Oh, I see it now, the provider was wrong all along