These are chat archives for akkadotnet/akka.net

25th
Apr 2017
Arjen Smits
@Danthar
Apr 25 2017 06:43

Hi, I have a question: how do I unit test persistent actor? I want to write unit test that verifies that actor persists certain events when it receives message of a given type. I cant find any examples or documentation on this topic.

@BartekSTRX Simply setup persistence as you would normally. Only then wrap it into unit test. Then test your actor by sending messages to it, and having it respond with answers. Based on its response you can test if it successfully mutated its state or not. For your test, i'd use the inmemory journal. Makes it easier to test.

If your looking to test the persistence provider itself. Unless its something you wrote yourself. We generally don't recommend it, its being tested by our CI all the time.

@softwaremike @heynickc We moved to the Dotnetty. That is also a reason why all those .NET Standard dependencies are there.
As we move the codebase more to .net standard, this will become more commonplace. Its the reality of the new .NET Core model.
Jeff Pang
@jeff-pang
Apr 25 2017 07:08
  1. anyone has any idea when the netcore version will be officially released?

  2. Also, I am doing my own build for the netcore version, but wasn't able to get the cluster stuff working. I suspect it could be some issue on Helios/DotNetty. Any idea when will Akka Cluster be ported to netcore?

Jeff Pang
@jeff-pang
Apr 25 2017 09:01
nvm, problem solved
Lev Lehn
@llehn
Apr 25 2017 09:41
Can I use structs aka valu types as message types without problems?
ollivogel
@ollivogel
Apr 25 2017 11:05
Has anybody used akka.net on Windows Server 2016 with Windows/HyperV Containers to create a cluster? Are there any restrictions or considerations?
Aaron Stannard
@Aaronontheweb
Apr 25 2017 14:23
@softwaremike yeah, I was really pissed off when I found out we had to add all of that crap
it's because DotNetty depends on a library that targets only .NET Standard 1.1
as @heynickc explained
that's where the dependencies on all of that low-level stuff comes from
it's using the new "binary deployment" model that doesn't require the GAC
and instead fetches everything off of nuget
in .NET, this will be the new normal
even if you're not using .NET Core
anything the targets .NET Standard will have a similar footprint
Jeff Pang
@jeff-pang
Apr 25 2017 14:25
is it? netframework doesn't fetch system.* stuff from nuget
thats what the netframework is for
but yes, netstandard and net core is similar
Aaron Stannard
@Aaronontheweb
Apr 25 2017 14:26
apparently that stuff will work in .NET Standard 2.0
but not right now
https://www.nuget.org/packages/Microsoft.Extensions.Logging/ - this is the dependency that causes the issue
part of DotNetty's internal logging system
to be honest, regarding the "it will work in .NET Standard 2.0 but not right now"
the goal posts on that stuff have been moved enough times now that I'm not confident if that's true or not
either way, there's going to be a lot of growing pains around that ecosystem for the foreseeable future
but the Akka.NET project is pulling its weight... We'll release our 50-some packages onto .NET Standard ;)
Jeff Pang
@jeff-pang
Apr 25 2017 14:34
:+1:
"We'll release our 50-some packages onto .NET Standard" will you have any rough timeline on this?
Aaron Stannard
@Aaronontheweb
Apr 25 2017 14:35
they'll come in phases
all of the core stuff in the main Akka.NET repository, which represents about half of those packages
Jeff Pang
@jeff-pang
Apr 25 2017 14:35
i am banging my head trying to publish some packages onto a temporary nuget server
for akka on netcore
Aaron Stannard
@Aaronontheweb
Apr 25 2017 14:36
that stuff will all go onto NuGet at the same time together roughly, hence why @alexvaluyskiy is working on things like Protobuf3 support
some of the auxiliary packages, like specific Akka.Persistence plugins
may take longer depending on which drivers are available
on .NET Standard already
we don't have a rough date yet for that stuff - sooner rather than later though
Jeff Pang
@jeff-pang
Apr 25 2017 14:37
i see, thanks for that info, look forward to it
in the meantime i guess i'll just try to host a temporary nuget repo for it until you guys get there
fanoI
@fanoI
Apr 25 2017 14:39
Good afternoon!
I've a question is a good idea to use stuct instead of classes as Messages to avoid too much allocations? Or in the end Akka.net boxes under the hood? Or I risk to incur in too much copying?
Aaron Stannard
@Aaronontheweb
Apr 25 2017 14:45
@fanoI the value of struct is negated somewhat once those messages have to go over the wire
IMHO though for local messages
I'd probably stick with classes still
ollivogel
@ollivogel
Apr 25 2017 14:46
Hey everyone. Has anybody used akka.net on Windows Server 2016 with Windows/HyperV Containers to create a cluster? Are there any restrictions or considerations when using NAT for Container intercommunication?
Aaron Stannard
@Aaronontheweb
Apr 25 2017 14:47
I haven't personally but I know @heynickc is working on getting one setup in Docker
cc @ollivogel
Nick Chamberlain
@heynickc
Apr 25 2017 14:50
Yea I didn't have a whole lot of trouble using the default NAT on Windows Containers. This was using static IPs and starting the containers with the --ip flag to assign them static IPs. Should be pretty easy to use a custom NAT, I didn't have much luck using a Transparent network, however
I'm using microsoft/windowsservercore btw. Couldn't get them working on nanoserver
Greatsamps
@Greatsamps
Apr 25 2017 14:51
with a cluster, lets say with 10 nodes, how do the actual IP connections form between the nodes. Is it a full mesh?
ollivogel
@ollivogel
Apr 25 2017 14:53
@heynickc Thx. Could you scale a container with docker-compose scale?
Nick Chamberlain
@heynickc
Apr 25 2017 14:54
@ollivogel Didn't try that yet, but I bet you could
fanoI
@fanoI
Apr 25 2017 14:56
@Aaronontheweb but I don't create too much GC "garbage" using classes?
Aaron Stannard
@Aaronontheweb
Apr 25 2017 14:56
you always create some
but it's a trade off between doing a deep copy of your message every time it changes hands versus having it get GCed once it's done being used
fanoI
@fanoI
Apr 25 2017 14:57
Yet when I pass messages inside the same process? Struct are copied I imagine are not serialized...
Aaron Stannard
@Aaronontheweb
Apr 25 2017 14:57
if your message types are fairly small in footprint
meaning that the copy cost is low
and if the throughput you needed was sufficiently high
i.e. greater than 4-5 million per second
fanoI
@fanoI
Apr 25 2017 14:58
passing them as Ref struct is allowed or not?
Aaron Stannard
@Aaronontheweb
Apr 25 2017 14:58
going with a struct might get you there
I don't think our mailboxes have any special handling for that
it just treats everything like an object
fanoI
@fanoI
Apr 25 2017 15:00
Actually:
Device.Tell(ref DiagnosticFromDevice);
does not compiles...
Is this a "trait" of the fact that Akka derives from Java?
Aaron Stannard
@Aaronontheweb
Apr 25 2017 15:32
no
fanoI
@fanoI
Apr 25 2017 15:40
So in the end there no difference between ReceiveActor and UntypedActor? The first one having Receive<T> made think me to not box value types instead it does? If I send an int is really boxed?
Bartosz Sypytkowski
@Horusiath
Apr 25 2017 16:42
@fanoI if you'll use struct messages, they will be boxed anyway. But tbh I don't think it's an issue (there are systems like grpc+protobuf, which require serialized messages to be classes, yet they can transport millions of messages per second over the wire)
fanoI
@fanoI
Apr 25 2017 16:47
well if you think to use MessagePack for example you expect an Int32 to be transmitted as 4 Byte (it could be in some cases transmitted as 1 byte i really a small int) but if send it as an object the advantage is lost... in any case is correct that Akka.net when I send messages in the same process (no remoting) does not serializes right?
Bartosz Sypytkowski
@Horusiath
Apr 25 2017 16:48
in-proc messages are not serialized
fanoI
@fanoI
Apr 25 2017 16:49
but they are boxed... yes it is pretty obvious as Tell takes an Object not a T
Bartosz Sypytkowski
@Horusiath
Apr 25 2017 16:50
also keep in mind, that you need polymorphic deserialization, so each message need to carry its type
we'll probably move to fully typed mailboxes in v2.0, but this is song of distant future
fanoI
@fanoI
Apr 25 2017 16:52
well I think MessagePack retains types information I think Hiperion does the same... I fear the fact that boxes is Object in the prototype
Tony Morris
@afmorris
Apr 25 2017 16:53
potentially silly question time... is anyone using DI to inject an IActorRef to another actor? storytime: i've got a couple top-level actors who will be used in children actors. options are 1) make the top-level actors be children of the children (downsides? maybe going to spam a db connection pool?), 2) use DI framework to get IActorRef from ActorSystem instance and push into constructor of children actor, 3) use ActorSelection with the known paths of the top-level actors... anyone have any insight onto what the "right pattern" is? i can't seem to find data/examples on passing an IActorRef through DI, which tells me i probably shouldn't be doing it
fanoI
@fanoI
Apr 25 2017 16:54
A C# 7 has pattern matching you would say it is more efficient to use UntypedActor at this point instead to use ReceiveActor? C# 7 could be more efficient and well feel "alien" to declare Receive<T> in the constructor
Strangely C#7 type pattern matching does not work with a generic type... it seems a bug to me sincerely!
Bartosz Sypytkowski
@Horusiath
Apr 25 2017 16:55
@fanoI ReceiveActor is compiling receiver handlers underneat. In some cases I've benchmarked, it's slightly faster than series of if-else statements.
@afmorris there is no support for partially injected constructors right now. Personally I've never used DI for actors (tbh I think DI is useful for stateless systems, but doesn't defend itself in stateful ones)
fanoI
@fanoI
Apr 25 2017 16:58
Hmm indeed using TryRoslyn I've seen that a switch with Pattern Matching is transformed in along chain of if / else if / else it does not seem a lot optimized code too... I expected something more clever sincerely (an hashtable?)
Tony Morris
@afmorris
Apr 25 2017 16:59
@Horusiath fair point regarding stateful vs. stateless. my actors are all stateless at the moment, so it's somewhat logical in my implementation. thanks for the input. i think i'm going to land on ActorSelection with the known paths of the top-level actors
Benjamin
@bdparrish
Apr 25 2017 19:26
Install-Package Akka fails for fresh project in VS 2017
anyone else having this issue with <TargetFramework>netcoreapp1.1</TargetFramework>
also, this is a console application just trying to do the home page hello world example
Alex Valuyskiy
@alexvaluyskiy
Apr 25 2017 20:23
Akka is not support netstandard/netcoreapp at the moment
Benjamin
@bdparrish
Apr 25 2017 20:23
is this on the backlog?
BartekSTRX
@BartekSTRX
Apr 25 2017 21:58
@Danthar thanks for help, I did it as you said