These are chat archives for akkadotnet/akka.net

3rd
Jun 2015
Aaron Stannard
@Aaronontheweb
Jun 03 2015 00:08
@stefansedich @annymsMthd would either one of you mind reviewing the flurry of PRs I opened up? #1032, #1031, #1030, #1028
that's all that's left for releasing v1.0.2 today
Stefan Sedich
@stefansedich
Jun 03 2015 00:53
sure @Aaronontheweb
@Aaronontheweb looks like #1031 is the only one I can approve atm, you happy for me to merge it?
or did you want to wait for #1030
Aaron Stannard
@Aaronontheweb
Jun 03 2015 00:59
go ahead and do #1031
Stefan Sedich
@stefansedich
Jun 03 2015 00:59
great
Aaron Stannard
@Aaronontheweb
Jun 03 2015 00:59
just resolved a merge conflict for #1030
Stefan Sedich
@stefansedich
Jun 03 2015 00:59
1031 is merged
Aaron Stannard
@Aaronontheweb
Jun 03 2015 00:59
ty sir
once the build server is happy with #1030 I'll kick off the release process
yaaaaaay
Stefan Sedich
@stefansedich
Jun 03 2015 01:00
so we ripped the bandaid off, but gently applied it back :D
Aaron Stannard
@Aaronontheweb
Jun 03 2015 01:00
(after one of you merges #1030, that is)
lol yeah
I /facepalmed when I read my comment afterwards
Stefan Sedich
@stefansedich
Jun 03 2015 01:01
ah it was realted to this one
once build goes green I will merge it
Stefan Sedich
@stefansedich
Jun 03 2015 01:02
lol
Joshua Benjamin
@annymsMthd
Jun 03 2015 01:02
wow
Aaron Stannard
@Aaronontheweb
Jun 03 2015 01:03
figured it was relevant since we're on the subject of release notes :p
Aaron Stannard
@Aaronontheweb
Jun 03 2015 01:27
@annymsMthd @stefansedich build's passed on #1030, although something horrible happened to my rebase lol
Joshua Benjamin
@annymsMthd
Jun 03 2015 01:29
@Aaronontheweb quick question about ask. I have a router that is routing remotely. My web node asks that router. If i pass that message on with the IActorRef back to the sender and someone else down the chain answers will that work?
Aaron Stannard
@Aaronontheweb
Jun 03 2015 01:30
hell yeah
Joshua Benjamin
@annymsMthd
Jun 03 2015 01:30
basically i dont want my router waiting for the ask
Aaron Stannard
@Aaronontheweb
Jun 03 2015 01:30
the temporary IActorRef that gets created during an Ask
Joshua Benjamin
@annymsMthd
Jun 03 2015 01:30
it needs to route not wait
sweet
Aaron Stannard
@Aaronontheweb
Jun 03 2015 01:30
will show up as the sender
Joshua Benjamin
@annymsMthd
Jun 03 2015 01:30
perfect
Aaron Stannard
@Aaronontheweb
Jun 03 2015 01:30
and it will automatically get forwarded to the routee
Joshua Benjamin
@annymsMthd
Jun 03 2015 01:30
\o/
Aaron Stannard
@Aaronontheweb
Jun 03 2015 01:30
MERGE MY PR
Joshua Benjamin
@annymsMthd
Jun 03 2015 01:30
MAGIC
Aaron Stannard
@Aaronontheweb
Jun 03 2015 01:30
lol
yeah I do crazy stuff in some of my code where some actor 4 steps removed from the original ask is the one who answers back
perfectly valid thing to do
message-based systems for the 4tw
Joshua Benjamin
@annymsMthd
Jun 03 2015 01:32
well our throughput is gonna go even higher then
didn't notice an issue until we had a slow request
Stefan Sedich
@stefansedich
Jun 03 2015 01:33
@annymsMthd beat me to it :) all sorted!
Aaron Stannard
@Aaronontheweb
Jun 03 2015 01:35
#1033 - godspeed, ye mighty build server
Aaron Stannard
@Aaronontheweb
Jun 03 2015 01:45
@annymsMthd I'm kind of bummed that the guy with the async / await question left before I had a chance to answer it last night
I was looking forward to that
Stefan Sedich
@stefansedich
Jun 03 2015 01:45
lol
Aaron Stannard
@Aaronontheweb
Jun 03 2015 01:46
@skotzko and I gave a talk on Akka.NET last night at the LA .NET meetup and @annymsMthd was there with one of his co-workers
Stefan Sedich
@stefansedich
Jun 03 2015 01:47
ah cool
Joshua Benjamin
@annymsMthd
Jun 03 2015 02:07
lol yeah
that flaky test
Aaron Stannard
@Aaronontheweb
Jun 03 2015 02:39
boom!
Akka 1.0.2
Joshua Benjamin
@annymsMthd
Jun 03 2015 02:39
\o/
Stefan Sedich
@stefansedich
Jun 03 2015 02:39
winning!
Roger Johansson
@rogeralsing
Jun 03 2015 02:44
Yay
Greg Berns
@gregberns
Jun 03 2015 02:53
Hey all, just starting to use Akka.net and its quite rediculously cool, but really taking some time to wrap my head around. Question: I don't find any documentation on 'Agents' in the .net version, do they exist? My thought was to have a bunch of child nodes, and each of those child nodes will handle a 'queue' of items. If that actor dies, how do i make sure that when its restarted, that queue doesn't disappear? Seemed like something I could do with an Agent.
Aaron Stannard
@Aaronontheweb
Jun 03 2015 03:51
@gregberns sorry Greg, I'm not sure I understand your question
whenever an actor gets restarted in Akka.NET, its queue isn't lost
all of those messages are still there
Roger Johansson
@rogeralsing
Jun 03 2015 03:51
Akka agents have
Aaron Stannard
@Aaronontheweb
Jun 03 2015 03:52
it's only when an actor is completely terminated that it loses any messages
Roger Johansson
@rogeralsing
Jun 03 2015 03:52
Not been ported. Darn enter key :)
Aaron Stannard
@Aaronontheweb
Jun 03 2015 03:52
ah, so that's a different thing
gotcha
I assumed agent was just an interchangeable name for actor :p
doh! Looks like I forgot to make sure the right icon image was on the Akka.Persistence.Cassandra package before I published it :p http://www.nuget.org/packages/Akka.Persistence.Cassandra/1.0.2.9-beta
Greg Berns
@gregberns
Jun 03 2015 04:21
By 'queue' I wasn't referencing the mailbox, rather, the Actor would store a simple list of items, each item would point to a Child node, but I need to store metadata about each child node
@rogeralsing thats kinda what I figured
Aaron Stannard
@Aaronontheweb
Jun 03 2015 04:22
@gregberns yep, my bad - I didn't realize you were talking about something different :p
Greg Berns
@gregberns
Jun 03 2015 04:24
no prob... I'm almost confusing my self. Its all a lot to take in. I'm looking at the 'stack/unstack' and 'become/unbecome' and that may get me somewhere.
Essentially, I have an agent that should only can have 10 child actors, when a request to create an 11th child comes in, I need to sit and wait until one of the other child actors is finished processing. It is very important I don't loose the metadata surrounding all of the children, so the parent node needs to persist that info if it has to restart
Chris Martin
@trbngr
Jun 03 2015 05:33
no docs on testing? BOO
Joshua Benjamin
@annymsMthd
Jun 03 2015 06:13
@Aaronontheweb upgraded out cluster to 1.0.2 and everything looks good.
Chris Martin
@trbngr
Jun 03 2015 06:16
Man. I must be dense. I can't get DI working
Joshua Benjamin
@annymsMthd
Jun 03 2015 06:16
@trbngr I haven't used the built in akka DI stuff yet but im sure someone here has
Chris Martin
@trbngr
Jun 03 2015 06:17
can I create an actor with ctor dependencies?
Joshua Benjamin
@annymsMthd
Jun 03 2015 06:18
Chris Martin
@trbngr
Jun 03 2015 06:19
Looked a million times. Actually read it too. haha
"If your actor has a constructor that takes parameters then those need to be part of the Props as well, as described above. But there are cases when a factory method must be used, for example when the actual constructor arguments are determined by a dependency injection framework."
with no example
Joshua Benjamin
@annymsMthd
Jun 03 2015 06:23
what DI framework are you using?
Chris Martin
@trbngr
Jun 03 2015 06:23
Autofac
familiar with the all though.
Joshua Benjamin
@annymsMthd
Jun 03 2015 06:24
okay let me look at this real quick

`// Create and build your container
var builder = new Autofac.ContainerBuilder();
builder.RegisterType<WorkerService>().As<IWorkerService>();
builder.RegisterType<TypedWorker>();
var container = builder.Build();

// Create the ActorSystem and Dependency Resolver
var system = ActorSystem.Create("MySystem");
var propsResolver = new AutoFacDependencyResolver(container, system);`

looks like this setups up the container into the propsResolver
Chris Martin
@trbngr
Jun 03 2015 06:24
Thanks man. I totally get all that.
Joshua Benjamin
@annymsMthd
Jun 03 2015 06:24
k
system.ActorOf(propsResolver.Create<TypedWorker>(), "Worker2");
Chris Martin
@trbngr
Jun 03 2015 06:24
But there's not example of creating an actor with deps
Joshua Benjamin
@annymsMthd
Jun 03 2015 06:25
that part uses the resolver to construct the type
Chris Martin
@trbngr
Jun 03 2015 06:25
no worky ;)
Joshua Benjamin
@annymsMthd
Jun 03 2015 06:25
if you have registered your interfaces with the container it should resolve them when it builds the actor
Chris Martin
@trbngr
Jun 03 2015 06:25
ok. It must be the way I'm doing it
thanks alot man.
Joshua Benjamin
@annymsMthd
Jun 03 2015 06:25
anyway you could post a gist?
Chris Martin
@trbngr
Jun 03 2015 06:26
I will if I can't get it working in a few
Joshua Benjamin
@annymsMthd
Jun 03 2015 06:26
k
Chris Martin
@trbngr
Jun 03 2015 06:47
OK. Simplest thing I could think of
Well crap. I'm not getting any actor instances using just Props and no deps
Chris Martin
@trbngr
Jun 03 2015 06:55
disregard that last message. I need to keep the system running ;)
got it
Joshua Benjamin
@annymsMthd
Jun 03 2015 07:01
awesome
Chris Martin
@trbngr
Jun 03 2015 07:02
I wasn't registering the actors in the container.
Joshua Benjamin
@annymsMthd
Jun 03 2015 07:02
ahh
Aaron Stannard
@Aaronontheweb
Jun 03 2015 16:22
so we released v1.0.2 yesterday, and I want to give a big shout out to @sean-gilliam - the guy sends in PRs continuously, working on improving our api-docs and web documentaton all the time https://twitter.com/Aaronontheweb/status/606133207671504897
Bartosz Sypytkowski
@Horusiath
Jun 03 2015 17:24
I think if everything goes fine and we manage to get enough free time, we should be able to push Akka.IO, Akka.Cluster.Tools and Akka.Cluster.Sharding to beta in couple of weeks
Nikita Tsukanov
@kekekeks
Jun 03 2015 17:45
Dumb question. Why aren't we using ForkJoinDispatcher by default? JVM guys claim that their implementation is more efficient than ThreadPool
Aaron Stannard
@Aaronontheweb
Jun 03 2015 17:45
@kekekeks because everyone knows that the ThreadPool is magic
Nikita Tsukanov
@kekekeks
Jun 03 2015 17:45
wat
Aaron Stannard
@Aaronontheweb
Jun 03 2015 17:45
now you know!
Nikita Tsukanov
@kekekeks
Jun 03 2015 17:46
wut
Aaron Stannard
@Aaronontheweb
Jun 03 2015 17:46
:p
the JVM doesn't have an equivalent of the static CLR ThreadPool
Aaron Stannard
@Aaronontheweb
Jun 03 2015 17:46
as far as I know
so they have to create their own default dispatcher somehow
and IIRC they have a threadpoolbuilder class that's able to determine the number of cores
and use some scalar to allocate N threads per core
the CLR threadpool does that for us per-process
Nikita Tsukanov
@kekekeks
Jun 03 2015 17:48
So its more efficient than anything we can implement in managed code?
Aaron Stannard
@Aaronontheweb
Jun 03 2015 17:48
there are edge-cases where you can beat out the CLR threadpool, for sure
for instance, one of the things the CLR threadpool does really well is recursive task queuing
which gets used in TPL continuations and all that jazz
we don't really use that capability much in Akka.NET actors
Nikita Tsukanov
@kekekeks
Jun 03 2015 17:50

recursive task queuing

i. e. recently queued continuations are executed right away on the same thread, right?

Aaron Stannard
@Aaronontheweb
Jun 03 2015 17:50
@kekekeks yep, exactly right
the continuation gets queued onto the thread-local work queue
which is lock-free
Nikita Tsukanov
@kekekeks
Jun 03 2015 17:50
wow
Bartosz Sypytkowski
@Horusiath
Jun 03 2015 17:50
f**k, this summer starts exhausting, it's like 30C in my house... so it must be like 2000F or so
Joshua Benjamin
@annymsMthd
Jun 03 2015 17:50
lol
Nikita Tsukanov
@kekekeks
Jun 03 2015 17:50

f**k, this summer starts exhausting, it's like 30C in my house... so it must be like 2000F or so

Well, AC in my car is broken for some reason

Bartosz Sypytkowski
@Horusiath
Jun 03 2015 17:51
:P
Aaron Stannard
@Aaronontheweb
Jun 03 2015 17:51
@kekekeks there's some good videos on MSDN about the work-stealing queue implementation
Nikita Tsukanov
@kekekeks
Jun 03 2015 17:51
Welcome to Hell
Aaron Stannard
@Aaronontheweb
Jun 03 2015 17:51
it's raining in LA today
and kind of cold
feels like bizarro-world
Roger Johansson
@rogeralsing
Jun 03 2015 17:52
@Horusiath Dafuq, poland is not that further south than swe. Feels like autumn here
Bartosz Sypytkowski
@Horusiath
Jun 03 2015 17:54
it's only my flat... they must have patented something like reverse isolation
Nikita Tsukanov
@kekekeks
Jun 03 2015 17:56

feels like bizarro-world

Photo taken near my dad's workplace last week
https://pbs.twimg.com/media/CGMBO44WYAACuxS.jpg

Bartosz Sypytkowski
@Horusiath
Jun 03 2015 17:57
looks like grim DeusEx-style future
Aaron Stannard
@Aaronontheweb
Jun 03 2015 17:57
"I'VE BEEN AUGMENTED"
Bartosz Sypytkowski
@Horusiath
Jun 03 2015 17:58
I never asked for this
Nikita Tsukanov
@kekekeks
Jun 03 2015 17:58
Just a regular day at Moscow City
We also have Tesla coils, look https://pbs.twimg.com/media/CGMR3rpU4AEzwF3.jpg
About ForkJoinDispatcher. So I can't say that Akka has something more efficient than ThreadPool, right?
Just "cheaper than threads"
Aaron Stannard
@Aaronontheweb
Jun 03 2015 18:01
I think there's room for innovation there
one place you can start is here https://github.com/helios-io/DedicatedThreadPool
this is the underlying engine that powers our ForkJoinDispatcher
and it comes with a benchmark that compares it to the CLR ThreadPool
Nikita Tsukanov
@kekekeks
Jun 03 2015 18:02
For now I'm preparing for my talk for the conference, so I need currently relevant data
Aaron Stannard
@Aaronontheweb
Jun 03 2015 18:02
if you can reduce the contention around the work queue - right now we use a BlockingCollection with a consuming enumerable
ah
what data can I give you?
ah, an answer to your question
Nikita Tsukanov
@kekekeks
Jun 03 2015 18:02
Yup
Aaron Stannard
@Aaronontheweb
Jun 03 2015 18:03
In terms of raw performance, I don't think it'd be easy to make an apples to apples comparison to the ThreadPool
but the fact that we have the dispatcher system available and make it trivially easy for developers to create actors with exclusive work queues and threads
is a huge advantage
Nikita Tsukanov
@kekekeks
Jun 03 2015 18:04
OK, I'll say that JVM guys have beaten JVM thread pool, but CLR ThreadPool is awesome so it will take some time
Aaron Stannard
@Aaronontheweb
Jun 03 2015 18:05
yeah, as Jonas Boner mentioned to me
the JVM ecosystem never had the great built-in concurrency tools that .NET had
so we (Typesafe) had to invent them
in .NET land we've had the benefit of years of CLR innovation in that area
but the CLR's core concern is being generally good across a huge number of use cases
Akka.NET's core concern is being good at high message throughput, so we still have work to be done there
Nikita Tsukanov
@kekekeks
Jun 03 2015 19:17
@Horusiath How to wait for PersistentView to receive currently available messages? If I just create it and send it my query it receives it before events
And I don't see any "recover complete" messages
Nikita Tsukanov
@kekekeks
Jun 03 2015 19:24
Self.Tell(new Update(true)) in constructor doesn't fix that
Bartosz Sypytkowski
@Horusiath
Jun 03 2015 19:34
so do you want some behavior on recovery completion?
Nikita Tsukanov
@kekekeks
Jun 03 2015 19:38
I want to delay query processing until all events are replayed
I. e. something like
var view = sys.ActorOf(Props.Create<ViewActor>("persistenceid"));
view.Ask<QueryResult>(new Query(...));
So I thought that I can stash queries (or they are stashed automagically during initial replay), but now I don't know how to implement this
Bartosz Sypytkowski
@Horusiath
Jun 03 2015 19:41
in this case you should not need to worry, when Persistent actor/view is created it immediatelly starts a recovery procedure and stashes all messages that came during recovery. When recovery ends, messages are unstashed automatically.
Also they use their own internal stashes for that, so it doesn't interfere with user stash
Nikita Tsukanov
@kekekeks
Jun 03 2015 19:50
Ehm
Its different from what I'm observing
It receives query first
then the events
Ouch
The events might be not persisted yet
my bad
jweimann
@jweimann
Jun 03 2015 19:51
I have an actor that's holding some bigger data. I want the actor to kill itself if it doesn't get any messages for an hour. Is there a recommended/prefered way to do this?
Bartosz Sypytkowski
@Horusiath
Jun 03 2015 19:52
@jweimann use ContextSetReceiveTimeout(TimeSpan.FromHours(1)) in actor's constructor
it will send ReceiveTimeout message to actor itself, after 1h if no messages has been received
jweimann
@jweimann
Jun 03 2015 19:54
perfect, thanks! :)
Bartosz Sypytkowski
@Horusiath
Jun 03 2015 19:54
then in you actor logic check if incoming message is of that type and order to stop if it is:
Receive<ReceiveTimeout>(_ => Context.Stop(Self));
Nikita Tsukanov
@kekekeks
Jun 03 2015 19:58
Its actually better not to use Context.Stop directly
But implement Passivate semantics with some sort of manager
See ShardRegion in JVM Akka
Bartosz Sypytkowski
@Horusiath
Jun 03 2015 19:59
it depends on the use case
Nikita Tsukanov
@kekekeks
Jun 03 2015 20:00
1) manager proxies messages to actors
2) when actor receives ReceiveTimeout (or another condition occurs) it sends Passivate to its parent
3) manager begins stashing messages for that actor and sends PoisonPill
4) when actor is terminated and manager has some messages for it, manager recreates the actor
in this case you won't lose any messages
Bartosz Sypytkowski
@Horusiath
Jun 03 2015 20:02
we should have some page with akka design patterns for that
  • "you don't know how to do X? Here's a link for you"
jweimann
@jweimann
Jun 03 2015 20:52
is there a good example of using the Passivate stuff in akka.net? I found some java/scala examples, but not sure exactly how it translates to a .net implementation
Nikita Tsukanov
@kekekeks
Jun 03 2015 21:19
.NET implemetation doesn't have ShardRegion implementation yet.
jweimann
@jweimann
Jun 03 2015 21:42
ah ok thanks :) I should be able to recreate the part I need pretty easily then, just wanted to make sure I was using anything possible that was already done :)