These are chat archives for akkadotnet/akka.net

26th
Jun 2018
Onur Gumus
@OnurGumus
Jun 26 2018 08:59
@Horusiath Does akkling persist have a callback mechanism ? Because I want a side-effect to trigger after persisting but not when recovering.
Simon McConnell
@Unthred
Jun 26 2018 09:59
@OnurGumus Thanks again for your suggestions the other day, I have a further question. I have a cluster up and running but as I understand it a node will only get the ok to leave the cluster once every node has been informed its leaving..... I plan on having around 9,000 - 10,000 lets call them child nodes connected to a few central nodes that will process the results from the children and control what they do......the child nodes dont care if one leaves or arrives... I assume I can configure it so that these child nodes dont have to respond to another node leaving? I will only have about 5 or 6 nodes that everyone will care about if they are down
Onur Gumus
@OnurGumus
Jun 26 2018 10:22
@Unthred where is it documented that the node will get the ok once every node has been informed ?
Simon McConnell
@Unthred
Jun 26 2018 10:23
I havent looked in the docs I am following a pluralsight course which just stated it
If I am talking rubbish then thats perfect
Onur Gumus
@OnurGumus
Jun 26 2018 10:23
I don't know the machinery of leaving.
But I highly doubt this is the case.
AFAIK there is a leader who approves joins and leaves.
Simon McConnell
@Unthred
Jun 26 2018 10:25
@OnurGumus Marvellous then disregard the question..... I will find out when I get far enough along that encounter such issues
Onur Gumus
@OnurGumus
Jun 26 2018 10:27
@Unthred note that leave is a graceful thing, so the party has to accept the leave. There is also something called "Downing" which forcefully kicks out that node even if it is unreachable.
I also recommend setting weakly-members-up by default.
otherwise if one node is unreachable no new nodes can join.
Simon McConnell
@Unthred
Jun 26 2018 10:29
@OnurGumus yeah I have just been working on leaving and now have it so that lighthouse knows my node has left properly..... I will look into Downing and weakly-members-up
thanks again
Ivan Sams
@ivansams
Jun 26 2018 10:37
Hi all, I'm new to Akka and new to gitter! I have been tasked with setting up logging in our Azure product. I'm struggling to get my custom logger working. Is there anyone here who has experience with setting up a custom logger for Akka.NET?
Onur Gumus
@OnurGumus
Jun 26 2018 10:38
@ivansams I don't know about Azure but we use serilog with akka.net.
Ivan Sams
@ivansams
Jun 26 2018 10:38
I've asked a StackOverflow question here, thought this community might be a better bet: https://stackoverflow.com/questions/51031960/custom-windows-extensions-logging-logger-not-used-in-akka-net-actor-logging
Thanks Onur. My constraint is that the logging must end up in the same place as all our other application logs, namely blob storage that is written to automatically by the Azure Web App Diagnostics. We use Microsoft.Extensions.Logging throughout our projects so I really don't want to use NLog or Serilog, although I believe there is good support for them
Ebere Abanonu
@eaba
Jun 26 2018 17:16
Who here loves soccer? #NGAARG it is about time
My heart beats faster.....wish me luck
chipdice
@chipdice
Jun 26 2018 17:49
What is the recommended serializer for Akka 1.3.8? I've been using Hyperion, which is still marked as Beta
Aaron Stannard
@Aaronontheweb
Jun 26 2018 18:02
@chipdice yeah, Hyperion still needs some love from the development team here
it's taking a backseat to some other bits and pieces we're working on
like multi-datacenter clusters, StreamRefs (ground work for running Akka.Streams over multiple nodes)
etc
if you're going live in production with Akka.Cluster
my recommendation is to go with a schema-based serializer if you can
i.e. Protobuf, MsgPack, Microsoft's Bond
I personally use Protobuf because we use that internally inside Akka.NET
it's more upfront work to setup
because you have to define a .proto file that includes your schema
and then use the protoc compiler to generate the C# message types
and then write an Akka.NET Serializer that converts between your domain classes and the proto messages
but here's the big advantages you get for doing that
  1. wire format is no longer coupled to the message types / classes your actors use for processing
so you're free to refactor your internal message types all day long
change the namespace
add properties
etc
without accidentally breaking your wire format when it comes time to deploy
that's the biggest benefit
when you use something like the default JSON.NET or Hyperion serializer
those two types are the same
to changing your internal C# classes affects the way messages are expressed over the network
Chandra Sekhar Manginipalli
@leo12chandu
Jun 26 2018 18:07
I was wondering if someone can weigh in on the pros and cons of different actor hierarchy strategies below and which onez best to choose.
if I have 2 steps of tasks say Step1 and Step2 to run on cluster for a given request.
1) Create a set n number of actors to handle Step1 and Step2 under a different parent actor (Supervision).
2) Create Step2 actor as a child of Step1 actor. Again create n instances of each step actor.
3) Create a brand new Step2 actor as soon as step1 is done and Context.Stop(step2) once step2 is done.
Aaron Stannard
@Aaronontheweb
Jun 26 2018 18:07
so one developer with a ReSharper license can break the wire format for an entire cluster, theoretically, if you don't have good review processes on that sort of thing
  1. Schema-based serializers have built-in ways to handle versioning of messages over time and give you the ability to explicitly control this
this is a really handy property especially if you use Akka.Persistence
Protobuf, for instance, lends itself really well to extend-only design
where you can extend the wire format without breaking the older clients serializing and deserializing those messages
final motivator for using schema based serializers
  1. they're the fastest for any sort of complex type
they compress messages really well
don't use reflection
which makes them more CPU and bandwidth-efficient
... I need to make a blog post about that
but anyway, the recommendation I make to users
is when you're just doing a proof of concept
or an internal prototype
stick with Hyperion / JSON.NET
move onto Protobuf when you get serious about going into production
it's really the upgrade / versioning protection that makes it worth it
any system that relies on trusting the developers not to make a mistake will inevitably fail
splitting wire format from its POCO representation makes really, really, really difficult to accidentally break the wire format
@leo12chandu I like to re-use actors if I can
doesn't always work - i.e. if the actors are stateful and you can't re-use the state across operations
Aaron Stannard
@Aaronontheweb
Jun 26 2018 18:12
then you should feel comfortable just disposing of those actors and create new ones
if step 2 depends on the output of step 1
or vice versa
chipdice
@chipdice
Jun 26 2018 18:12
Well I've got a production system using Hyperion and I have done some work with protobuf, but having to maintain proto files seems kind of labor intensive, but I guess it's only limited to what is sent between cluster nodes right? I'll look at moving to protobuf in the future, but seems like I need to stick with Hyperion for now. Any reason it is still flagged as Beta?
Aaron Stannard
@Aaronontheweb
Jun 26 2018 18:12
I'd probably go with a single parent that manages both
@chipdice API and wire format may change in the future
Chandra Sekhar Manginipalli
@leo12chandu
Jun 26 2018 18:13
Gotcha. These are stateless. So, I will stick to your idea of keeping a constant number of both.
Aaron Stannard
@Aaronontheweb
Jun 26 2018 18:13
@chipdice even for beta packages we usually put a big, screaming warning about major breaking changes in the release notes
i.e. we're going to be introducing a breaking change to Cluster.Sharding in 1.3.9
that will be obvious in the release notes if I do my job correctly
Chandra Sekhar Manginipalli
@leo12chandu
Jun 26 2018 18:14
yes step2 is dependent on step1. infact step1 transforms/fetches required info and step2a, b, c, etc are using that and doing their own sub tasks parallely within different actors.
Aaron Stannard
@Aaronontheweb
Jun 26 2018 18:14
@leo12chandu I'd have a parent actor that supervises the work
of both children
and if one fails it should try to restart the operation from wherever it can logically be resumed, if possible
Chandra Sekhar Manginipalli
@leo12chandu
Jun 26 2018 18:15
so not a good idea for step2a,b, c actors to be children of step1 right? instead have a parent actor that manages all of these step1, step2a, b, etc..
Aaron Stannard
@Aaronontheweb
Jun 26 2018 18:15
if restarting is too risky
Chandra Sekhar Manginipalli
@leo12chandu
Jun 26 2018 18:15
gotcha
Aaron Stannard
@Aaronontheweb
Jun 26 2018 18:15
i.e. it's risky because you have no idea whether an operation started / completed when the error occurred
and re-running the operation a second time would be dangerous
chipdice
@chipdice
Jun 26 2018 18:15
@Aaronontheweb I only hesitate because it will add another level of dev work to my project, which of course, is due yesterday. Thanks for the info
Aaron Stannard
@Aaronontheweb
Jun 26 2018 18:16
if restarting is too risky then you can get away with many more different types of structures
from a hierarchy perspective
because the error just gets flagged wherever it happened
and presumably a human either has to go look at it or whatever
or maybe the customer just re-submits the request
trying to stick to generalities when I give advice like that
your mileage may vary
@chipdice I feel you there
Chandra Sekhar Manginipalli
@leo12chandu
Jun 26 2018 18:17
I see. Restarting is not risky because its stateless and when things go wrong, we explicitly capture the error and send it back to the user as an exception. So its fine.
Aaron Stannard
@Aaronontheweb
Jun 26 2018 18:17
@leo12chandu but yeah, I'd have a single parent manage everything in that case then
Chandra Sekhar Manginipalli
@leo12chandu
Jun 26 2018 18:17
Thanks Aaron, will restructure all of them to have just 1 parent.
Aaron Stannard
@Aaronontheweb
Jun 26 2018 18:17
and that way you can create multiple instances of that parent and scale out
underneath a router or whatever
if you want to increase the degree of parallelism
but for the time being, sounds like one parent should be sufficient
Chandra Sekhar Manginipalli
@leo12chandu
Jun 26 2018 18:18
Gotcha.
Bartosz Sypytkowski
@Horusiath
Jun 26 2018 18:23

@OnurGumus

Does akkling persist have a callback mechanism ?

Could you precise?

Seyedamirhossein Hesamian
@amir734jj
Jun 26 2018 18:53
In Akka.Net, How to convert IActorRef to the concrete class that extended ReceiveActor?
I tried AsInstanceOf, but it does not work.
Peter Shrosbree
@pshrosbree
Jun 26 2018 19:17
@amir734jj You cannot. IActorRef is not an interface that actors implement, so what you are asking does not make sense in terms of casting. The type of the actor referenced may not even be a type in your process address space, or even on your machine, so even if actors did implement the interface, you would not be able to retrieve the type. IActorRefs are just things you can send messages to.
Seyedamirhossein Hesamian
@amir734jj
Jun 26 2018 19:34
@pshrosbree Makes sense, Thanks you