These are chat archives for akkadotnet/akka.net

20th
Mar 2018
Kento
@robinsondotnet
Mar 20 2018 00:19 UTC
Hello :) Is it possible to have multiple singletons in a same cluster?
Aaron Stannard
@Aaronontheweb
Mar 20 2018 00:19 UTC
multiple singletons of different types - yep
Kento
@robinsondotnet
Mar 20 2018 00:21 UTC
Thanks. awesome. I assume that they have to be configured in code. Or Is it possible to configure them as an array in hocon file?
Aaron Stannard
@Aaronontheweb
Mar 20 2018 00:24 UTC
you have to specify how to start them in code
since you need the Props the singleton relies on
Joshua Benjamin
@annymsMthd
Mar 20 2018 01:36 UTC
yup looks like it is sharding to different buckets in the containers. I don't think we were seeing this with windows though
Aaron Stannard
@Aaronontheweb
Mar 20 2018 01:37 UTC
want to try it with the latest nightlies?
since we've incorporated some fixes in those areas last week?
Joshua Benjamin
@annymsMthd
Mar 20 2018 01:39 UTC
for sure. We are moving this into kubernetes in our test environment first so this doesn't hurt our production.
Aaron Stannard
@Aaronontheweb
Mar 20 2018 01:39 UTC
O
I'm in the process of dockering our WebCrawler sample right now
Joshua Benjamin
@annymsMthd
Mar 20 2018 01:39 UTC
I'll get that hooked up and I should have an answer if it fixed it soon.
Aaron Stannard
@Aaronontheweb
Mar 20 2018 01:39 UTC
which... unfortunately required porting everything to .NET Core 2.0
majority of my time doing this port thus far has been spent trying to figure out wtf is going on with the new SignalR for ASP.NET Core
Joshua Benjamin
@annymsMthd
Mar 20 2018 01:40 UTC
We have already ported a few of our other akka services without much trouble.. no signalR though
Our big cluster is a bit more challenging though
I think we will be tackling a way for akka.net to use service discovery in k8s to join the cluster. The seed node route falls apart when we redeploy the first seed
Aaron Stannard
@Aaronontheweb
Mar 20 2018 01:44 UTC
I've been helping a customer out on PCF
which is similar to K8s
the approach they went with is one where they have 2-3 lighthouse nodes that just register themselves to a Redis db instance in the background
and the seed node list gets automatically purged / repopulated every 30 seconds
every other node that joins the network just reads that collection from Redis
seems to work pretty well so far
but yeah, the new SignalR APIs are pretty bad so far
have to use ASP.NET Core DI for everything
if you're doing server-push
Joshua Benjamin
@annymsMthd
Mar 20 2018 01:46 UTC
You can always use autofac or something with the core DI
Aaron Stannard
@Aaronontheweb
Mar 20 2018 01:47 UTC
yeah it's not their specific DI that's the problem
it's more that Hubs are now transient objects
Joshua Benjamin
@annymsMthd
Mar 20 2018 01:47 UTC
oh
Aaron Stannard
@Aaronontheweb
Mar 20 2018 01:47 UTC
therefore you kind of have to invent your own way of reliably grabbing a hold of the new HubContext object they developed
and DI is the only way of accessing it atm
Joshua Benjamin
@annymsMthd
Mar 20 2018 01:47 UTC
Well that's a big change
Aaron Stannard
@Aaronontheweb
Mar 20 2018 01:47 UTC
yeah
broke poor WebCrawler big time
and it's not documented yet
ok, YAY - got WebCrawler working using pure ASP.NET Core
Joshua Benjamin
@annymsMthd
Mar 20 2018 01:51 UTC
nice
Aaron Stannard
@Aaronontheweb
Mar 20 2018 01:51 UTC
going to get it dockerized so we can have an end-to-end docker-compose sample that "just works"
Joshua Benjamin
@annymsMthd
Mar 20 2018 01:52 UTC
You can use the vs2017 docker integration to make your docker files for you
Aaron Stannard
@Aaronontheweb
Mar 20 2018 01:52 UTC
yeah I'm going to have it do that for the web app for sure
but I'll need to edit the stuff in order to add some of the Akka.Cluster-specific environment variables that I look for
such as the seed node addresses
Aaron Stannard
@Aaronontheweb
Mar 20 2018 02:02 UTC
won't be too bad
figured most of that stuff out when I was working on petabridge/lighthouse#47 last week
Joshua Benjamin
@annymsMthd
Mar 20 2018 02:07 UTC
Yeah it's pretty easy once you get the hang of it. The VS docker project stuff will let you specify ENV variables and bring in other containers in the docker compose.
Joshua Benjamin
@annymsMthd
Mar 20 2018 02:29 UTC
Looks like the sharding is consistent with the 1.3.6 nightly build. We will be watching it tonight and tomorrow to make sure it doesn't go into the Shard Forward Loop of Death. Everything looks promising though
scharada
@scharada
Mar 20 2018 14:46 UTC
i have a scenario to build and have read most of the docs and found no straight answer to it, so i am asking it here. i have read the docs where I found a lot of info, but that got me confused somehow. so here it is : say you have a group of servers where tasks are done by all of them of split between them. these servers must do 3 things mainly, 1 - send/receive/process/reply to messages from Client apps (mobile apps), 2 - synchronize information between them selves and 3 - request one of the servers to do a specific operation. i have read about clustering and it's very powerfull, i also read about remoting and IO. the docs say in remoting anybody can talk to anybody, so how does a client app (actor) sends a message to another actor registered with a different node when messages are sent to addresses and the sender does not know the address of the receiver or its existance ? the docs say also that IO is suitable for client server architecture and found no more explanation about it ... for those who are experts with akka, how is the best way to build the above scenario. thank you in advance.
Aaron Stannard
@Aaronontheweb
Mar 20 2018 14:57 UTC
1 - send/receive/process/reply to messages from Client apps (mobile apps),
so this can be done via Akka.IO between the clients and one of the servers
you could just put all of the Akka.IO endpoints beneath each server behind an A record or something on your DNS
or maybe a load balancer that can do connection forwarding
2 - synchronize information between them selves and 3 - request one of the servers to do a specific operation
Use Akka.Cluster for the server-to-server stuff
scharada
@scharada
Mar 20 2018 15:31 UTC
@Aaronontheweb thank you for your answer. i think i have a way to solve the first question using IO. here is a scenario and plsconfirm if it makes sense. all mobile clents have an alias known to the server so i can use that alias in the actor name/id to find it . Client1 sends a msg to Client2 through the server, server processes the msg, sends a notification to receiver ... the question is : the server knows the destination address, how can it send a message to a client2 "not aware of anything" to tell him "you got this from Client1" ... does the client need to be connected all the time ? what if he is not ? and reconnects later ...
Aaron Stannard
@Aaronontheweb
Mar 20 2018 15:32 UTC
for being able to send a message to a "specific" server
the servers would need to share data about which clients are connected to which servers
and yeah, you'd want to have some "virtual" way of addressing those clients
so imagine the "virtual" address of the client is literally just a Guid
you could store all pending messages for that client in a database
and always have the client, when it reconnects to a server, push a message over the wire as the very first message it always sends include its Guid
i.e. the Guid has to be shared between client and server somehow
the server could build a Guid, IActorRef mapping
where the IActorRef == the Akka.IO TCP actor that is holding onto that socket connection
you could just have it such that any queued messages for that client get automatically drained from a database upon connection
we literally have a scenario in Petabridge's remoting training that covers some of the "presence" stuff between clients
where the servers broadcast down to the clients
"here are the users on your friends list who are available and here are their addresses"
trick to making all of this work is really just using publish-subscribe communication patterns in the right places
scharada
@scharada
Mar 20 2018 15:36 UTC
this is very similar to what i am trying to do
Aaron Stannard
@Aaronontheweb
Mar 20 2018 15:36 UTC
cool, sounds like you're on the right track then
but yeah man, pub-sub is your friend here
fire notifications upon connect
propagate those down to the clients
let clients reply back through server
propagate replies through other servers connected to the appropriate clients
etc
scharada
@scharada
Mar 20 2018 15:37 UTC
yep. saw your ref to nservicebus on the video. got the idea.
so it sounds like i have to work on the IActorRef class.
thanks a lot @Aaronontheweb , will let you know how it goes. :)
but it'll change the whole platform and how things are done ..
one more thing while you are here. client apps are mobile . is it good enough to connect every n minutes to the server ? is that a good use of actors ? does it cost much (battery usage, connection bandwidth, ....) knowing that messages are a few hundred bytes max ...
Aaron Stannard
@Aaronontheweb
Mar 20 2018 17:48 UTC
I don't know how expensive sockets are on mobile
but if you need to be able to receive push messages from the server
that's the only way to do it aside from the explicit push notification API or having some sort of background-pull model
but actors are very cheap otherwise
only use CPU when they're doing work
and have a small default memory footprint
Aaron Stannard
@Aaronontheweb
Mar 20 2018 22:56 UTC
@annymsMthd you weren't kidding about the Visual Studio docker support
that stuff is pretty amazing
just used it
needed to customize the template it gave me some
but otherwise worked like a charm right out of the box
amazing when that happens
I'm taking https://github.com/petabridge/akkadotnet-bootstrap out for a test drive
with a Docker-ified version of WebCrawler and Lighthouse