These are chat archives for akkadotnet/akka.net

28th
Sep 2016
Chris Martin
@trbngr
Sep 28 2016 07:08
So my cluster shards finally were acknowledged. Thanks to @melcloud right above me here, I realized that lighthouse was probably running an older version of Akka. Sure as shit, I upgraded Lighthouse and we're up and running. What a way to waste a day ;) Thanks for the tip, @melcloud :P
Robert Stiff
@uatec
Sep 28 2016 08:22
@Horusiath yes I am using .net core, and I followed the thing about akka.cluster.roles, and that's set to "server" instead of "cluster-sharding" but even setting that to the exact string "cluster-sharding" had no effect
Robert Stiff
@uatec
Sep 28 2016 08:58
@trbngr did you see errors like: [ERROR][28/09/2016 08:23:20][Thread 0012][[akka://mysystem/system/endpointManager/reliableEndpointWriter-akka.tcp%3A%2F%2Fmysystem%40127.0.0.1%3A50459-2/endpointWriter#2979764
28]] Dropping message [Akka.Actor.ActorSelectionMessage] for non-local recipient [[akka.tcp://birchd@127.0.0.1:4053/]] arriving at [akka.tcp://birchd@127.0.0.1:4053] inbound a
ddresses [akka.tcp://mysystem@127.0.0.1:4053]
Cause: Unknown
Bartosz Sypytkowski
@Horusiath
Sep 28 2016 10:54
@uatec I wouldn't expect that akka cluster will be working on .net core
it's still work in progress - here's the issue: akkadotnet/akka.net#2153
I don't know if it's upto date, but I know that @alexvaluyskiy opened myget channel with early beta for akka core and persistence with some plugins. But that doesn't count .net core version of akka.remote or akka.cluster
Peter Hvidgaard
@hvidgaard
Sep 28 2016 11:41
I'm trying to debate the use of akka.persistence for some metadata. But of the millions of rows, only the ones from the last few months are likely to be used. Short of dynamically create a persistence id based on creation date, or even based on id alone, is there any way to not fill up the memory with all the data that is unlikely to be used and only fetch events for a particular id if it's requested?
Arjen Smits
@Danthar
Sep 28 2016 12:41
snapshots
and akka.persistence is based on event sourcing
Peter Hvidgaard
@hvidgaard
Sep 28 2016 12:43
yes, but if I millions of different metadata objects, I cannot keep them all in memory, but then need to be accessible if needed.
Arjen Smits
@Danthar
Sep 28 2016 12:44
akka.persistence is mainly used/designed to provide a persistence story for statefull actors. So your actor keeps its relevant state in memory. And stores events mutating that state using the persistence mechanism. That way an actors state can always be rebuild.
is each metadata object an actor ?
Peter Hvidgaard
@hvidgaard
Sep 28 2016 12:45
that may be the only solution, but it's metadata linked to a document. Normally you would ask the the metadata belonging to an id
Arjen Smits
@Danthar
Sep 28 2016 12:45
why not store the metadata with the document ?
Peter Hvidgaard
@hvidgaard
Sep 28 2016 12:46
I could, but I still need to have a dynamic persistence id to support it
I'm unsure if that is a good idea or not.
Arjen Smits
@Danthar
Sep 28 2016 12:46
if your document has id X. Your metadata persistence id could be myactorPath/document/X/metadata
However akka persistence is not designed to be the be-all-end-all solution
if it does not fit your use-case. You can always implement your own database actor
Peter Hvidgaard
@hvidgaard
Sep 28 2016 12:48
the alternative is manually logging all changes manually
I'd rather get that part automatically because it's an absolute requirement to have full traceability.
Arjen Smits
@Danthar
Sep 28 2016 12:49
ah, like that.
Well if you can store all the metadata for A document, under one persistence id. That would be issue number one.
The second issue, keeping lots of records in memory
You can optimize by letting your metadata actor create snapshots of the data
and only keep the most recent relevant data in memory
Then if you need to entire history
I think you can use persistence.query for that
Peter Hvidgaard
@hvidgaard
Sep 28 2016 12:51
as long as it's in the datastore and can be recalled, that is enough.
If it's not considered bad practice to have a dynamic persistence id, I'll go ahead and create a prototype. It solves the memory problem as well because an actor is only live as long as the data is needed, and then shot down.
Arjen Smits
@Danthar
Sep 28 2016 12:52
Normally, you could delete all events leading up to the snaphot
But there is no obligation to do that
just keep in mind that when you are making snaphots, the persistence mechanism utilizes that when rebuilding the actor
So even though it will be in the database, your actor will only have the state of your latest snapshot + every event that came afterwards
Peter Hvidgaard
@hvidgaard
Sep 28 2016 12:54
that is an optimization I'll turn on if needed.
Marc Piechura
@marcpiechura
Sep 28 2016 13:18
Why would you need to keep all metadata actors alive? You could also stop them if not currently needed and recreate them with the correct Id, the actor will recreate its state from the database and can send the last state to the requester
Peter Hvidgaard
@hvidgaard
Sep 28 2016 13:37
I don't but if dynamic persistence ids wasn't a good idea, I was out of ideas.
but it seems like it's fair game, so that's the solution I'll try out.,
Damian Reeves
@DamianReeves
Sep 28 2016 14:43
Non akka question here. I've heard murmurs about it being simple to get free SSL certificates is this really a thing? Has anyone used such a solution? From where?
Robert Stiff
@uatec
Sep 28 2016 14:44
@Horusiath bugger: "waiting for Helios/DotNetty package"
very disapoint
Christian Duhard
@cduhard
Sep 28 2016 15:29
might anyone be using Serilog with Akka? I am curious what would be the elegant way to get to the serilog logger for adding context via ForContext?
Arjen Smits
@Danthar
Sep 28 2016 15:52
@cduhard at the moment its not supported. The Logging infrastructure in Akka does not provide such features
So if you want to use that, You need to use Serilog directly
You can still hook up the serilog logger plugin to have system messages logged through it.
But in your Actor you would then call the serilog logger directly via Log.Logger
Christian Duhard
@cduhard
Sep 28 2016 15:55
yeah, looking at the source would this work?
        public static ILoggingAdapter WithContext(this Akka.Event.ILoggingAdapter loggingAdapter, string property, object value, bool destructure = false)
        {
            Serilog.Log.ForContext(property, value, destructure);
            return loggingAdapter;
        }
Log.WithContext("Command", command, true).Error("Message {Thing}", thing);
i would probably need to use the serilog logger exclusively no?
Andrew Young
@ayoung
Sep 28 2016 16:53
anyone know: is this the right way to watch for deadletters? Context.System.EventStream.Subscribe(Self, typeof (DeadLetter));
Arjen Smits
@Danthar
Sep 28 2016 16:59
@ayoung yes
Andrew Young
@ayoung
Sep 28 2016 17:01
:beer: , @Danthar. I couldn't find any info in the documentation for this. good to know. thanks!
Arjen Smits
@Danthar
Sep 28 2016 17:02
@cduhard I think that would work.
However i'd create a private ILogger log instance in the Actors constructor
using log = Serilog.Log.ForContext<MyActorClass>()
that way you always have the SourceContext set to the actor class which performs the logging
which can be a major help in debugging
Christian Duhard
@cduhard
Sep 28 2016 17:46
so instead of
public ILogger Serilogger => _serilogger ?? (_serilogger = Serilog.Log.Logger); dopublic ILogger Serilogger => _serilogger ?? (_serilogger = Serilog.Log.ForContext<MyClass>());
Andrew Young
@ayoung
Sep 28 2016 17:47
is it typical to wait for ClusterEvent.MemberUp events to be published before sending messages through the cluster?
Bartosz Sypytkowski
@Horusiath
Sep 28 2016 17:49
@ayoung yes, if you'll try to do it before MemberUp triggers, depending on what you're using it for, you may not deliver message to other node
Andrew Young
@ayoung
Sep 28 2016 17:50
@Horusiath ok this might be related to the bug i logged. #2327
which means its probably not a bug :)
the question still remains: why does ProcessRouter.Ask<Routees>(new GetRoutees()) return members before MemberUp occurs?
Yin Zhang
@melcloud
Sep 28 2016 21:54
@trbngr Glad helped. I think this break changes need to be mentioned so people are aware of.
Andrew Young
@ayoung
Sep 28 2016 23:10
is there a way to manually increase the pool size of a router? not using the auto resizer.