Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Version 1.4.36 Release #5823

Merged
merged 20 commits into from
Apr 5, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
a18c246
v1.4.36 placeholder for nightlies (#5732)
Aaronontheweb Mar 18, 2022
5ef69e9
Update PersistAsync to match docs. (#5736)
NaridaL Mar 21, 2022
ef6718e
[DI] DI fails to throw an exception when DI tried to create an actor …
Arkatufus Mar 21, 2022
4e35c2a
Fix spelling (#5745)
eaba Mar 22, 2022
93a3d7e
Lock cspell on version `5.18.5` (#5744)
eaba Mar 22, 2022
b4b390d
cleanup XUnit TestKit output logger (#5741)
Aaronontheweb Mar 22, 2022
6d3d91f
marked `EventBusUnsubscriber` messages as `INoSerializationVerificati…
Aaronontheweb Mar 22, 2022
0c85653
Fix MSBuild does not copy xunit.runner dlls correctly (#5747)
Arkatufus Mar 23, 2022
9e05894
Add documentation on how to override serializer ids. (#5749)
Arkatufus Mar 24, 2022
b365c06
Add `Member Roles` doc (#5742)
eaba Mar 24, 2022
ab332ea
[DOCS]: Add `Examples` section to Akka.NET Doc (#5739)
eaba Mar 30, 2022
0309498
Bump Hyperion to 0.12.2 (#5805)
Arkatufus Apr 1, 2022
3ee032d
Fix leaky coordinated shutdown (#5816)
Arkatufus Apr 4, 2022
13eea74
Couple of fixes for the TcpConnection (#5817)
ismaelhamed Apr 4, 2022
9c29c84
Update RELEASE_NOTES.md for 1.4.36 release (#5820)
Arkatufus Apr 5, 2022
161c9d5
Revert changes that are unrelated to the memory leak (#5822)
Arkatufus Apr 5, 2022
711c284
Merge branch 'dev'
Arkatufus Apr 5, 2022
da0f734
Be more explicit that a node is shutting down as it was marked as DOW…
ismaelhamed Apr 5, 2022
33d805c
Merge branch 'dev'
Arkatufus Apr 5, 2022
9f7a7a7
Merge remote-tracking branch 'upstream/master'
Arkatufus Apr 5, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions RELEASE_NOTES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,22 @@
#### 1.4.36 April 4 2022 ####
Akka.NET v1.4.36 is a minor release that contains some bug fixes. Most of the changes have been aimed at improving our web documentation and code cleanup to modernize some of our code.

* [Akka: Bump Hyperion to 0.12.2](https://github.com/akkadotnet/akka.net/pull/5805)

__Bug fixes__:
* [Akka: Fix CoordinatedShutdown memory leak](https://github.com/akkadotnet/akka.net/pull/5816)
* [Akka: Fix TcpConnection error handling and death pact de-registration](https://github.com/akkadotnet/akka.net/pull/5817)

If you want to see the [full set of changes made in Akka.NET v1.4.36, click here](https://github.com/akkadotnet/akka.net/milestone/67?closed=1).

| COMMITS | LOC+ | LOC- | AUTHOR |
|---------|------|------|---------------------|
| 5 | 274 | 33 | Gregorius Soedharmo |
| 4 | 371 | 6 | Ebere Abanonu |
| 3 | 9 | 3 | Aaron Stannard |
| 1 | 34 | 38 | Ismael Hamed |
| 1 | 2 | 3 | Adrian Leonhard |

#### 1.4.35 March 18 2022 ####
Akka.NET v1.4.35 is a minor release that contains some bug fixes. Most of the changes have been aimed at improving our web documentation and code cleanup to modernize some of our code.

Expand Down
2 changes: 1 addition & 1 deletion build-system/pr-validation.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
- task: Npm@1
inputs:
command: "custom"
customCommand: "install -g cspell"
customCommand: "install -g cspell@5.17.0"
- task: CmdLine@2
inputs:
script: 'cspell --config ./docs/cSpell.json "docs/**/*.md"'
Expand Down
1 change: 1 addition & 0 deletions docs/articles/clustering/cluster-overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,7 @@ A node might also exit the cluster gracefully, preventing it from being marked a
<iframe width="560" height="315" src="https://www.youtube.com/embed/mUTKvGyxbOA" frameborder="0" allowfullscreen></iframe>
<!-- markdownlint-enable MD033 -->

* [Cluster Member Roles](xref:member-roles)
* [How to Create Scalable Clustered Akka.NET Apps Using Akka.Cluster](https://petabridge.com/blog/intro-to-akka-cluster/)
* [Video: Introduction to Akka.Cluster](https://www.youtube.com/watch?v=mUTKvGyxbOA)
* [Gossip Protocol](https://en.wikipedia.org/wiki/Gossip_protocol)
Expand Down
317 changes: 317 additions & 0 deletions docs/articles/clustering/member-roles.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,317 @@
---
uid: member-roles
title: Member Roles
---

# Member Roles

![cluster roles](/images/cluster/cluster-roles.png)

A cluster can have multiple nodes(machines/servers/vms) with different capabilities.
When you require an application to run on a node(machine/server/vm) with certain capabilities, roles helps you to distinguish the nodes so that application can be deployed on that node.
Specifying cluster role(s) is a best practice; you don't want an application that requires less computational power running and consuming resources meant for a mission-critical and resource-intensive application.
Even if you only have a single type of node in your cluster, you should still use roles for it so you can leverage this infrastructure as your cluster expands in the future; and they add zero overhead in any conceivable way.

# How To Configure Cluster Roles

Below I will show you how the cluster above can be reproduced. I will create a five-nodes(ActorSystems - all having same name, though, but living on different machine/server/vm) cluster with different roles applied:

**Node1**: All of my code that receives requests from users and push same to the cluster will be deployed here!

```hocon
akka
{
cluster
{
roles = ["web"]
}
}
```

**Node2**: All of my code handling fraud detections will be deployed on this node

```hocon
akka
{
cluster
{
roles = ["fraud"]
}
}
```

**Node3**: All me code that retrieves, stores data will be deployed on this node

```hocon
akka
{
cluster
{
roles = ["storage"]
}
}
```

**Node4**: All my code that handles customer orders will be deployed on this node

```hocon
akka
{
cluster
{
roles = ["order"]
}
}
```

**Node5**: All my code that handles customer billing will be deployed on this node

```hocon
akka
{
cluster
{
roles = ["billing"]
}
}
```

Now that we have laid the foundation for what is to follow, Akka.Cluster is made of various ready-made extensions(or modules) you can deploy.
I will show you how you can deploy them on any of the nodes. Apart from the Akka.Cluster modules, if you just want to use the Akka.Cluster core, I will show you how you can deploy your own actor to the cluster node with the required role:

**Cluster Sharding**: Sharding be will deployed on the nodes with the `order` role, `node4`

```hocon
akka
{
cluster
{
roles = ["order"]
sharding
{
role = "order"
}
}
}
```

**Distributed Pub-Sub**: DistributedPubSub will be deployed on the nodes with the `web` role, `node1`.

```hocon
akka
{
cluster
{
roles = ["web"]
pub-sub
{
role = "web"
}
}
}
```

**Distributed Data**: DistributedData will be deployed on the node with the `storage` role, `node3`.

```hocon
akka
{
cluster
{
roles = ["storage"]
distributed-data
{
role = "storage"
}
}
}
```

**Cluster Singleton**: To avoid over charging a customer more than once, my code will be deployed with `ClusterSingleton` on the node with the `billing` role, `node5`

```hocon
akka
{
cluster
{
roles = ["billing"]
singleton
{
role = "billing"
}
}
}
```

I have one more node, `node2`, with nothing running in it. I will deploy my custom fraud detection code there, and the way to do that is:

```csharp
var selfMember = Cluster.Get(_actorSystem).SelfMember;
if (selfMember.HasRole("fraud"))
{
context.ActorOf(Billing.Prop(), "bill-gate");
}
else
{
//sleep, probably!
}
```

Using the Cluster `SelfMember`, I am checking if the current node has the `billing` role and if yes, create the `Billing` actor.

## Cluster-Aware Router

Cluster-Aware routers automate how actors are deployed on the cluster and also how messages are routed based on the role specified! Routers in Akka.NET can be either grouped or pooled and you can read up on them [Routers](https://getakka.net/articles/actors/routers.html)

**Router Group**: I will create Cluster-Aware Router Group for all my applications above!

```hocon
akka
{
actor
{
provider = "Akka.Cluster.ClusterActorRefProvider, Akka.Cluster"
deployment
{
/webdispatcher
{
router = consistent-hashing-group # routing strategy
routees.paths = ["/user/web"] # path of routee on each node
nr-of-instances = 3 # max number of total routees
cluster
{
enabled = on
use-role = "web"
}
}
/frauddispatcher
{
router = consistent-hashing-group # routing strategy
routees.paths = ["/user/fraud"] # path of routee on each node
nr-of-instances = 3 # max number of total routees
cluster
{
enabled = on
use-role = "fraud"
}
}
/billingdispatcher
{
router = consistent-hashing-group # routing strategy
routees.paths = ["/user/billing"] # path of routee on each node
nr-of-instances = 3 # max number of total routees
cluster
{
enabled = on
use-role = "billing"
}
}
/orderdispatcher
{
router = consistent-hashing-group # routing strategy
routees.paths = ["/user/order"] # path of routee on each node
nr-of-instances = 3 # max number of total routees
cluster
{
enabled = on
use-role = "order"
}
}
/storagedispatcher
{
router = consistent-hashing-group # routing strategy
routees.paths = ["/user/storage"] # path of routee on each node
nr-of-instances = 3 # max number of total routees
cluster
{
enabled = on
use-role = "storage"
}
}
}
}
}
```

```csharp
var web = system.ActorOf<Web>("web");
var fraud = system.ActorOf<Fraud>("fraud");
var order = system.ActorOf<Order>("order");
var billing = system.ActorOf<Billing>("billing");
var storage = system.ActorOf<Storage>("storage");

var webRouter = system.ActorOf(Props.Empty.WithRouter(FromConfig.Instance),"webdispatcher");
var fraudRouter = system.ActorOf(Props.Empty.WithRouter(FromConfig.Instance),"frauddispatcher");
var orderRouter = system.ActorOf(Props.Empty.WithRouter(FromConfig.Instance),"orderdispatcher");
var billingRouter = system.ActorOf(Props.Empty.WithRouter(FromConfig.Instance),"billingispatcher");
var storageRouter = system.ActorOf(Props.Empty.WithRouter(FromConfig.Instance),"storagedispatcher");
```

**Router Pool**: I will create Cluster-Aware Router Pool for all my applications above!

```hocon
akka
{
actor
{
provider = "Akka.Cluster.ClusterActorRefProvider, Akka.Cluster"
deployment
{
/webdispatcher
{
router = round-robin-pool # routing strategy
max-nr-of-instances-per-node = 5
cluster
{
enabled = on
use-role = "web"
}
}
/frauddispatcher
{
router = round-robin-pool # routing strategy
max-nr-of-instances-per-node = 5
cluster
{
enabled = on
use-role = "fraud"
}
}
/billingdispatcher
{
router = round-robin-pool # routing strategy
max-nr-of-instances-per-node = 5
cluster
{
enabled = on
use-role = "billing"
}
}
/orderdispatcher
{
router = round-robin-pool # routing strategy
max-nr-of-instances-per-node = 5
cluster
{
enabled = on
use-role = "order"
}
}
/storagedispatcher
{
router = round-robin-pool # routing strategy
max-nr-of-instances-per-node = 5
cluster
{
enabled = on
use-role = "storage"
}
}
}
}
}
```

```csharp
var routerProps = Props.Empty.WithRouter(FromConfig.Instance);
```
2 changes: 2 additions & 0 deletions docs/articles/clustering/toc.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
- name: Overview
href: cluster-overview.md
- name: Member Roles
href: member-roles.md
- name: Cluster Routing
href: cluster-routing.md
- name: Cluster Configuration
Expand Down
Loading