These are chat archives for akkadotnet/akka.net

1st
Jun 2015
Chris Martin
@trbngr
Jun 01 2015 03:18
Question time...Say I have a cluster running and I'm using EventsourcedActors. How do instances on other nodes keep up to date?
I don't want to stop each instance after a message, right?
Aaron Stannard
@Aaronontheweb
Jun 01 2015 03:19
Akka.Cluster.Sharding basically does it this way
and technically you can do this other ways too
but one actor writes
the other nodes can get messages from a PersistentReadView
which will read, on a timer, messages from the database
your PersisentReadView can then publish those messages to any other actors who need it
Chris Martin
@trbngr
Jun 01 2015 03:20
I supposed I could talk to the persistance before processing
Aaron Stannard
@Aaronontheweb
Jun 01 2015 03:21
yes, that too
Chris Martin
@trbngr
Jun 01 2015 03:21
so say I have /user/account/guid that lives in three nodes
I can talk to all of those instances?
or tell ;)
Aaron Stannard
@Aaronontheweb
Jun 01 2015 03:23
yep, you could use a clustered broadcast router for
that*
Chris Martin
@trbngr
Jun 01 2015 03:23
hmmm. I gotta dig into Cluster sharding i guess
Cool
Aaron Stannard
@Aaronontheweb
Jun 01 2015 03:24
we're still working on porting over cluster sharding
I haven't worked with it at all yet myself
Chris Martin
@trbngr
Jun 01 2015 03:24
Man. This is so easy but so daunting when the real workloads come ;)
Aaron Stannard
@Aaronontheweb
Jun 01 2015 03:24
haha
putting code into production is what separates the boys from the men
as they say
Chris Martin
@trbngr
Jun 01 2015 03:24
oh yes.
We've talked about getting you guys out here to Phoenix for a few days. I think that will happen eventually.
Aaron Stannard
@Aaronontheweb
Jun 01 2015 03:25
should definitely do that
Chris Martin
@trbngr
Jun 01 2015 03:26
Would clear up a lot
Aaron Stannard
@Aaronontheweb
Jun 01 2015 03:27
we aim to please ;)
plus it'd be good to see Scott again - always had a blast when he came to our events when I was at MSFT
Chris Martin
@trbngr
Jun 01 2015 03:27
nice.
Our system needs this badly. And it's all my fault! haha
Aaron Stannard
@Aaronontheweb
Jun 01 2015 03:30
haha
Bartosz Sypytkowski
@Horusiath
Jun 01 2015 05:11

Say I have a cluster running and I'm using EventsourcedActors. How do instances on other nodes keep up to date?

@trbngr When it comes to PersistentActor, you can't use more than one per it's persistence Id in akka cluster scope. They have to be singletons

Mark
@q42mark
Jun 01 2015 06:19
In terms of througput, how many Ask/s are you guys seeing on your machines? I'm at 76k messages/sec
I've key-value-store actor (backed by a dictionary) and handling the get message is async (since it may be in the dictionary or not and then we'll get it async)
I'm using a ReceiveActor
but I guess that doesn't matter much :) should the performance be better or this quite the same as what you are seeing
Bartosz Sypytkowski
@Horusiath
Jun 01 2015 06:21
are you talking about remotely accessed actor?
Mark
@q42mark
Jun 01 2015 06:22
no local
Bartosz Sypytkowski
@Horusiath
Jun 01 2015 06:22
then something is fucked up :)
Mark
@q42mark
Jun 01 2015 06:24
how can i see what's fucked up?
dottrace?
Bartosz Sypytkowski
@Horusiath
Jun 01 2015 06:25
looks more like something in the configuration, maybe you want to gist your code sample?
Mark
@q42mark
Jun 01 2015 06:26
no configuration at all , let me see if i can reduce this code to a simple gist :)
Bartosz Sypytkowski
@Horusiath
Jun 01 2015 06:41
I'll take a look, but I'm in work right now, so I don't know when I'll be able to respond
Mark
@q42mark
Jun 01 2015 06:41
oke cheers :)
Bartosz Sypytkowski
@Horusiath
Jun 01 2015 07:58
ok, few notes:
  1. you're using asynchronous lambda in Receive - using async when unnecessary is not good for performance reasons. If you will change this method to be synchronous, you should get somewhere around twice perf boost
  2. since you have both a single actor and are using await on actor Ask inside message sending, your example is basically an equivalent of synchronous message sending (on a single thread) with active loop realized by TPL tasks
Mark
@q42mark
Jun 01 2015 08:10
I see! I also saw that on point 2 :) Btw is point 1. something which might get improved by akka or are you bound by the TPL impl of Microsoft?
Bartosz Sypytkowski
@Horusiath
Jun 01 2015 08:15
making async-compatible version of Receive method was made only for convinience of the people, who don't understand (or don't agree with) the advantages of PipeTo method - which is preferred way of dealing with async APIs in Akka. This could be potentially improved, but would require major rewrites of akka internals and will break existing API
Mark
@q42mark
Jun 01 2015 08:17
hmm you are right, i'll switch to pipe to :)
Mark
@q42mark
Jun 01 2015 09:14
cool 300k requests/s now
:)
Nikita Tsukanov
@kekekeks
Jun 01 2015 09:57
I need some simple (eg. bubblesort), short (1-2 pages of code) and easy to comprehand example where Akka shines and 'classic' methods are being ugly
need that for presentation
any ideas?
Nikita Tsukanov
@kekekeks
Jun 01 2015 10:02

When it comes to PersistentActor, you can't use more than one per it's persistence Id in akka cluster scope. They have to be singletons

What about synchronizing the states of the views? Storages like EventStore has some mechanims for subscribing to event streams.

Nikita Tsukanov
@kekekeks
Jun 01 2015 10:08

something which might get improved by akka or are you bound by the TPL impl of Microsoft?

We are bound by the use of an ambient context backed by ThreadStatic field. This sort of things just won't work well with async/await, that's why a custom TaskScheduler is used. And that TaskScheduler don't execute stuff on threadpool like default does, it messes up with akka's internals to pause actor's mailbox and executes async callbacks on akka's dispatcher. That's why you shouldn't use it for anything other than I/O operations that absolutely have to be completed before processing the next message.

Bartosz Sypytkowski
@Horusiath
Jun 01 2015 10:17
@kekekeks Persistent views synchronize themselfs in time interval (by default it's 5 sec) - this option can be turned off, then they are syncing on demand by sending Update message back to them. I know that this is bad, and when akka streams will be ready to be used, we'll change persistent views to use streaming, but until then we have to stick with that.
Nikita Tsukanov
@kekekeks
Jun 01 2015 10:19
Is there any way to move this logic from views to persistence provider? So it can take the advantage of the streaming support of the underlying storage platform.
Bartosz Sypytkowski
@Horusiath
Jun 01 2015 10:19
and AFAIK EventStore uses Atom protocol for subscription
Nikita Tsukanov
@kekekeks
Jun 01 2015 10:19
It has multiple protocols for that
.NET/JVM clients don't use HTTP
HTTP is here for dirty non .NET/JVM peasants.
Anthony Brown
@bruinbrown
Jun 01 2015 10:25
@kekekeks an example I've used is call centre applications where an agent can be in this really complicated state machine and Akka makes it easy, give me a minute and I'll make a gist of some code
Bartosz Sypytkowski
@Horusiath
Jun 01 2015 10:25
If you use journal based on SyncWriteJournal or AsyncWriteJournal you may use akka.persistence.publish-plugin-commands - if you set this on, then journal will emit all of it's messages on the akka event stream
Anthony Brown
@bruinbrown
Jun 01 2015 10:29
@kekekeks this is an example I've used, might be a bit long for a slide but people can grasp it since it's in the context of something they've likely experienced https://gist.github.com/bruinbrown/f8a45074f5bc114d1b69
Nikita Tsukanov
@kekekeks
Jun 01 2015 10:30
Oh, thanks
FSM stuff, yay
Chris Martin
@trbngr
Jun 01 2015 10:45
@Horusiath I'd really love some more talk about this. How do we do singletons in a cluster?
Bartosz Sypytkowski
@Horusiath
Jun 01 2015 10:48
until Akka.Cluster.Tools and Akka.Cluster.Sharding will come out we'll have to do them manually
Roger Johansson
@rogeralsing
Jun 01 2015 11:52
@Horusiath should we try to split some of the tasks up? Ill try to get some real coding done on akka.net this week
Bartosz Sypytkowski
@Horusiath
Jun 01 2015 12:42
@rogeralsing I'm in the midwork on ShardRegion class porting, I think that after it's complete, we have 1 more event to introduce in Akka.Cluster core (ClusterShuttingDown event I guess)
then all that remain is specs porting and refactoring
I don't know yet how we could split it up (probably split-by-spec has most sense)
Roger Johansson
@rogeralsing
Jun 01 2015 12:47
yes. sort in alphabetic order and you start from the top and me at the bottom :) distributed consensus
Bartosz Sypytkowski
@Horusiath
Jun 01 2015 12:47
with eventually consistent code base xD
Roger Johansson
@rogeralsing
Jun 01 2015 12:51
I'm adding Akka to a legacy code base here :) refactoring Service Layer methods to wrap up arguments into a message and then pass to a consistent hash router for concurrency controlled services
preventing race conditions in services
Aaron Stannard
@Aaronontheweb
Jun 01 2015 16:07
I need some simple (eg. bubblesort), short (1-2 pages of code) and easy to comprehand example where Akka shines and 'classic' methods are being ugly
I personally like the "job progress" example
write an actor who uses PipeTo to do some async I/O
i.e. moving copy files from one directory to another or downloading web pages
and write to the console the progress of the job
since the actor doing the work has synchronized internal state it can update the job progress without any locks or other weird stuff
doing that the "old way" is really nasty
bonus points for doing that on a UI thread, which is even nastier
(but trivial with Akka.NET actors)
FYI, JetBrains did us a solid and gave us an OSS license for the build server. So we'll have enough agents / projects to be able to support builds for the Akka.Persistence projects
Natan Vivo
@nvivo
Jun 01 2015 19:22
Roman Golenok
@shersh
Jun 01 2015 20:35
@nvivo, bearded joke =)
Natan Vivo
@nvivo
Jun 01 2015 21:10
Haha
Really didn't see that coming!
we need comics
Aaron Stannard
@Aaronontheweb
Jun 01 2015 22:08
@stefansedich my experience with ravendb in production does not look anywhere close to that cartoon
shenanigans I say
Stefan Sedich
@stefansedich
Jun 01 2015 23:10
hahaha yeah
I cringed myself
Aaron Stannard
@Aaronontheweb
Jun 01 2015 23:48
@/all just published a new Akka.NET training video on Akka.Remote - any thoughts on this? https://www.youtube.com/watch?v=kOm8lGBkrM8
Nikita Tsukanov
@kekekeks
Jun 01 2015 23:55
system,aCTOrSelection(".USER.remotecho")
Aaron Stannard
@Aaronontheweb
Jun 01 2015 23:55
hahaha
yeah, I should have just copied and pasted that
rather than look like I was drunk while typing