These are chat archives for akkadotnet/akka.net

3rd
Dec 2016
Kevin Avignon
@Kavignon
Dec 03 2016 07:29 UTC
With F#, I have a bind overload compiling issue which doesn't make any sense for me! The way I'm receiving the message seems pretty fine to me, can someone help me out please !
Kevin Avignon
@Kavignon
Dec 03 2016 07:36 UTC
The problem is @ L58
I don't understand !
Bartosz Sypytkowski
@Horusiath
Dec 03 2016 07:39 UTC
@Kavignon return! { state with Operation = Some Sell }return! handleProtocol { state with Operation = Some Sell }
actor expression needs to be tail recursive. Otherwise it will stop an actor after completing a message
Kevin Avignon
@Kavignon
Dec 03 2016 07:42 UTC
Recursivity strikes back !
Been coding for way too long, sorry to bother ! But thanks for the amazing time response, was thinking I'd have a couple of hours of me looking again on internet :)
Bartosz Sypytkowski
@Horusiath
Dec 03 2016 07:43 UTC
no problem ;)
Kevin Avignon
@Kavignon
Dec 03 2016 08:22 UTC

Hey quick question for @Horusiath
Like I've mentioned a bunch of times, I'm creating a game prototype with Akka.NET
When I'll launch my game, how do properly start those actors?
I have these lines for instance
let system = System.create "system" <| Configuration.load ()
let shopSystem = spawn system "Shop System" <| itemStoreManager

That's the part that got me confused a bit at the moment.I'll give you some context on my architecture
I see the game as a huge state which has several smaller states such as where I am in the storyline or in what phase of the battle system am I in. The first thing I want to start is that state server which will be notified by every update and I will want to enter my shop, for instance, I will require the shop system to be either started, revived or unpaused ? I'm not sure about the terminology.
Thanks in advance :innocent:

Bartosz Sypytkowski
@Horusiath
Dec 03 2016 08:24 UTC
you can have a top level manager actor, that you'll ask for get or create a component for me
if it's not clrear when to create it
Kevin Avignon
@Kavignon
Dec 03 2016 08:26 UTC
That actor sole purpose would be to either get or create components ? Should it also have a child actor to listen to the event stream in case of dead letters which would mean that 1+ of my actors are dead and needs to be revived ?
By any chance, and I know they're pretty slim, is there an example with F# of clustering or a similar approach to clustering Akka.NET actors that you'd know of ? @Horusiath
Bartosz Sypytkowski
@Horusiath
Dec 03 2016 08:27 UTC
if you need to be informed about actor dying, you can use Context.Watch to watch over that actor (in F# API this function was called monitor I suppose).
Wathing actor will receive Terminated message with reference to dead actor
there are few examples, but they are targetting Akkling -> my fork of Akka.FSharp
Siemienik Paweł
@Siemienik
Dec 03 2016 12:09 UTC
Hi everyone, I've just started use Akka.Persistance and I am not sure how It should handle collection with 130 000 entities.`
Before i used mongodb driver without persistence
My first idea: there exists CollectionPersistenceActor, which handle update/insert/remove commands. Each command as a query works on mongodbdriver directly(update, insert, remove). But in that case, what should happend on snapshot()?
Siemienik Paweł
@Siemienik
Dec 03 2016 12:23 UTC
Second idea: CollectionActor that can create/stop/remove children actors(EntityPersistenceActor) and sending to they proper commands(update/snapshotAndStop). Each children actor has own persistenceId used to respawn. After snapshot the EntityPersistenceActor will be stoped. When the actor is required, will respawn by persistenceId.
But in that case i dont know how can i quick searching and ordering.
Thanks a lot:)
Andrey Leskov
@andreyleskov
Dec 03 2016 13:18 UTC
@Siemienik I'm using same approach to work with each domain entity (aggregate) as a separate actor. Supervisor (CollectionActor) will spawn childs and pass commands to them, also it should be responsible for child termination on inactivity.
you can check example here
Andrey Leskov
@andreyleskov
Dec 03 2016 14:51 UTC
Guys, can a Pool router terminate one of its children?
Andrey Leskov
@andreyleskov
Dec 03 2016 15:16 UTC
Answer is : yes, if pool use resizer
Kevin Avignon
@Kavignon
Dec 03 2016 15:28 UTC
I'll take a look at it tonight ! @Horusiath
Thanks :D
Andrey Leskov
@andreyleskov
Dec 03 2016 17:29 UTC
Guys, I'm continue to investigate issue with event bus not delivering messages to subscribers
I have two subscribers - one is actor with random pool, and it is always receiving messages
other is actor with consistenthashing pool
and it loose messages randomly
may be I miss something in how pool is interacting with eventStream subscriptions ?
Bartosz Sypytkowski
@Horusiath
Dec 03 2016 17:30 UTC
@andreyleskov clustered routers?
Andrey Leskov
@andreyleskov
Dec 03 2016 17:30 UTC
no
one node with akka.remote
Bartosz Sypytkowski
@Horusiath
Dec 03 2016 17:32 UTC
you're taking into account, that event stream works only for actors inside the same actor system?
Andrey Leskov
@andreyleskov
Dec 03 2016 17:32 UTC
This message was deleted
Sure
I have only one system
and sometimes message is delivered good and sometimes not
here is how I create router :
 var routesMap = msg.Routes.ToDictionary(r => r.Topic, r => r.CorrelationField);

            if (routesMap.All(r => r.Value == null))
            {
                Log.Debug("Created random pool router to pass messages to {actor} ", msg.ActorName);

                return new RandomPool(Environment.ProcessorCount);
            }


            var pool = new ConsistentHashingPool(Environment.ProcessorCount,
                       m =>
                       {
                           var type = m.GetType();
                           string prop = null;

                           if (!routesMap.TryGetValue(type.FullName, out prop))
                                throw new CannotFindRouteException(m);

                           var value = type.GetProperty(prop).GetValue(m);

                           LogManager.GetLogger().Trace("routed message {msg} by property {property} with value {value}", m, prop, value);
                           return value;
                       });
it is a function returning a router
and it is passed to Props.WithRouter after
Bartosz Sypytkowski
@Horusiath
Dec 03 2016 17:36 UTC
did you manage to make it into reproducible example?
this would help a lot
Andrey Leskov
@andreyleskov
Dec 03 2016 17:36 UTC
right now no 8 ( working on it. I know it is correlated with system restart )
when I restart applications messages start to reach their subscribers for Ids not working before
Bartosz Sypytkowski
@Horusiath
Dec 03 2016 17:37 UTC
routee actors are standard ones or maybe persistent actors or something else?
Andrey Leskov
@andreyleskov
Dec 03 2016 17:37 UTC
in general any types of actors
but not persistent for sure
problems arise with routee witch itself controls a pack of persistence actors
and reroutes messages to it
routee just does not receive a message
Bartosz Sypytkowski
@Horusiath
Dec 03 2016 17:39 UTC
routee witch itself controls a pack of persistence actors or router witch itself controls a pack of persistence actors?
Andrey Leskov
@andreyleskov
Dec 03 2016 17:40 UTC
routee. I've tried a pool with persistence actors, it was bad )
Bartosz Sypytkowski
@Horusiath
Dec 03 2016 17:40 UTC
I wanted to say the same ;)
Andrey Leskov
@andreyleskov
Dec 03 2016 17:41 UTC
This message was deleted
schema is : publish message to event stream -> controller with pool router -> persistence actor living in controller internal collection
Bartosz Sypytkowski
@Horusiath
Dec 03 2016 17:43 UTC
it would be good to make sure on which connection message has been lost
Andrey Leskov
@andreyleskov
Dec 03 2016 17:44 UTC
I suspect hashing logic, and even added logging inside )) But cannot make logging work for now, investigating
Bartosz Sypytkowski
@Horusiath
Dec 03 2016 17:52 UTC
heh, I've never liked routers (especially CH), too much magic. Never used them in any practical scenario and I'm still happy, that they're not going to be a part of akka-typed
Andrey Leskov
@andreyleskov
Dec 03 2016 17:53 UTC
I'll try to remove ConsistentHashingPool at all as an option
BTW: i have a stream of events published to EventStream, and stateless handlers writing events into DB
How would you recommend to parallel handlers work? I'm using random pool for now
Bartosz Sypytkowski
@Horusiath
Dec 03 2016 18:00 UTC
this week I was working on new sql journal impl, which was optimized to handle much greater amount of requests than previous one using request batching (see: #2389)
Andrey Leskov
@andreyleskov
Dec 03 2016 18:02 UTC
@Horusiath cool ! Can't wait for it
and is their any plans to remove startup query for all ids in database ?
select distinct PersistenceId from Journal
Bartosz Sypytkowski
@Horusiath
Dec 03 2016 18:02 UTC
but this is quite big amount of code. For simpler case you can simply use random pools. I don't even know if EventStream is really what you need. I'm used to just passing actor reference to destination actor in constructor or in message itself.
@andreyleskov yes, I've removed it. Now it will be only called once, when someone actually will request for all persistence ids
Andrey Leskov
@andreyleskov
Dec 03 2016 18:03 UTC
yesss! thank you a lot ^_^
Bartosz Sypytkowski
@Horusiath
Dec 03 2016 18:04 UTC
I thank you ;) Your feedback was really welcome here.
Andrey Leskov
@andreyleskov
Dec 03 2016 18:04 UTC
after several months in production I have 1.5 millions ids, so query is killing my db on start
Andrey Leskov
@andreyleskov
Dec 03 2016 18:45 UTC
btw : after investigation it seems if I subscribe an actor with consistent hashing pool to EventStream only one of several spawned pool children will receive messages
will create a reproducable test
Andrey Leskov
@andreyleskov
Dec 03 2016 19:06 UTC
no, it is wrong hypothesis
Andrey Leskov
@andreyleskov
Dec 03 2016 19:31 UTC
It seems it is my fault - receivers just die with time >_<
Andrey Leskov
@andreyleskov
Dec 03 2016 19:49 UTC
@Horusiath Thanks a lot for help, I've shooted myself : " If a third party terminates a child by way of the system.Stop(child) method or sending a PoisonPill, the supervisor might well be affected."
controller terminates children after inactivity : they call Context.Stop(self)
and controller watches over them to get Terminated message
and dies after first clean
Maxim Cherednik
@maxcherednik
Dec 03 2016 20:28 UTC
hi guys, got a short q. Do I need to cache my request messages?
so that to avoid gc pressure
Aaron Stannard
@Aaronontheweb
Dec 03 2016 21:38 UTC
@maxcherednik cache it for what?
Aaron Stannard
@Aaronontheweb
Dec 03 2016 21:49 UTC
(just so I better understand the context)