GitHub PullRequestEvent at 2014-09-17 04:10:47
Repository: akka.net
Actor: Aaronontheweb
Payload: {"action":"opened","number":400,"pull_request":{"url":"https://api.github.com/repos/akkadotnet/akka.net/pulls/400","id":21344016,"html_url":"https://github.com/akkadotnet/akka.net/pull/400","diff_url":"https://github.com/akkadotnet/akka.net/pull/400.diff","patch_url":"https://github.com/akkadotnet/akka.net/pull/400.patch","issue_url":"https://api.github.com/repos/akkadotnet/akka.net/issues/400","number":400,"state":"open","locked":false,"title":"Akka.Cluster development - usable beta","user":{"login":"Aaronontheweb","id":326939,"avatar_url":"https://avatars.githubusercontent.com/u/326939?v=2","gravatar_id":"ceb466e3992c9957759222a871897300","url":"https://api.github.com/users/Aaronontheweb","html_url":"https://github.com/Aaronontheweb","followers_url":"https://api.github.com/users/Aaronontheweb/followers","following_url":"https://api.github.com/users/Aaronontheweb/following{/other_user}","gists_url":"https://api.github.com/users/Aaronontheweb/gists{/gist_id}","starred_url":"https://api.github.com/users/Aaronontheweb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Aaronontheweb/subscriptions","organizations_url":"https://api.github.com/users/Aaronontheweb/orgs","repos_url":"https://api.github.com/users/Aaronontheweb/repos","events_url":"https://api.github.com/users/Aaronontheweb/events{/privacy}","received_events_url":"https://api.github.com/users/Aaronontheweb/received_events","type":"User","site_admin":false},"body":"After a couple month's of work, @smalldave and I have an initial beta of Akka.Cluster available to use.\r\n\r\nWe're in the process of porting the multi-node unit tests and doing bugfixes on the `ClusterDaemon`, but the core of Akka.Cluster is running smoothly and includes a couple of examples.\r\n\r\nI'm going to leave this PR open for a bit as it explains some of the conceptual underpinnings of how clustering works, but also because it includes many new additions. Most of this work has been going into the `akka-cluster` branch but I think now is the right time to begin making this work available to other developers for review, testing, and having fun.\r\n\r\n## How Clustering Works\r\nAkka.Cluster is easy to use, but it's important to understand conceptually how it works as this will have an impact on how you design your clusters when using it in production. It's a straight port of Akka's clustering module, which itself borrows concepts from verifiably successful clustering implementations such as Cassandra, Riak, and others. \r\n\r\nI'll explain some of the terminology as we go.\r\n\r\nFirst, here's what the initial state of a new Akka cluster looks like:\r\n\r\n![image](https://cloud.githubusercontent.com/assets/326939/4298098/426d9b44-3e1a-11e4-99b0-482917c20005.png)\r\n\r\nThere are two types of nodes in an Akka.Cluster:\r\n* __Seed nodes__, which have well-known addresses that are described inside your `Config`\r\n* __Non-seed nodes__, which are dynamically deployed nodes that join the cluster by establishing contact with a seed nodes.\r\n\r\nThe majority of your nodes will typically be __non-seed nodes__ for production clusters - this is because they're easier to manage from a configuration standpoint and it also requires fewer static IP addresses and deployment overhead. \r\n\r\nSo here's why seed nodes are important:\r\n\r\n![image](https://cloud.githubusercontent.com/assets/326939/4298128/e2886046-3e1a-11e4-9188-46ef2dcc4318.png)\r\n\r\nSeed nodes are used to start the conversation (known as _gossip_) between all nodes - every node has to contact them in order to join the cluster. You can have a cluster with a single seed node - if it goes down then you can't deploy any new nodes without changing your configuration, which is why you typically see 2-3 seed nodes in live deployments.\r\n\r\nFor this example, I gave all of the nodes different deployment configurations just to show how establishing a cluster works - in real-life these nodes would all be deployed with the same configuration usually.\r\n\r\n![image](https://cloud.githubusercontent.com/assets/326939/4298147/58cbe584-3e1b-11e4-8984-dd15c30770d2.png)\r\n\r\nOnce nodes establish connectivity to each other, they begin exchanging information using what's known as a [Gossip protocol](http://en.wikipedia.org/wiki/Gossip_protocol) - regularly delivered peer-to-peer messages that contain time-versioned information about the status of all known peers in the network. Each of these gossip messages includes a version number expressed as a [Vector clock](http://en.wikipedia.org/wiki/Vector_clock) which gives each node the ability to determine which information arriving from the network is actually more recent than what the node's most recent gossip state already contains.\r\n\r\nAfter a period of initial gossip, the nodes have begun to establish connectivity with each other and know now about at least 1 neighbor each. In addition, a `leader` node has been elected for every role in the cluster (more on that later.) The leader's job is to dictate which nodes are up and which nodes are down, based on the consensus of gossip information from the other peers.\r\n\r\n![image](https://cloud.githubusercontent.com/assets/326939/4298217/e73f701e-3e1c-11e4-9dd5-1f0619daa5ad.png)\r\n\r\nOnce the gossip has had a chance to propagate across the cluster, all nodes are now aware of each other and the ring of nodes are all considered `Up` - therefore you can start doing things such as cluster-aware routers.\r\n\r\n![image](https://cloud.githubusercontent.com/assets/326939/4298247/759479b8-3e1d-11e4-86b9-a8f3a902d237.png)\r\n\r\nWhoops! Looks like a node just died! At least two of the other nodes in the cluster (usually nodes that _are not_ adjacent to it) noticed either because (1) C started missing cluster heartbeats or (2) the TCP connection to C died. The remaining nodes will gossip this information and mark the node as unreachable for now and will eventually prune it from the set of known nodes if the node doesn't return after a period of time.\r\n\r\nIf the node that died was the leader, a new leader would be elected.\r\n\r\n![image](https://cloud.githubusercontent.com/assets/326939/4298297/5e9c0d7e-3e1e-11e4-89f4-52d62951dc6e.png)\r\n\r\nAnd thus the cluster's network topology changes. New nodes may join later and other nodes may still leave, but the gossip protocol and interconnectivity between peers is what keeps the wheels turning no matter how things change.\r\n\r\n## Using Akka.Cluster\r\nI haven't added build support for Akka.Cluster NuGet packages just yet, but for the time being you can manually reference Akka.Cluster and its dependencies (Akka.Remote and Microsoft.Bcl.Immutable.)\r\n\r\nTo run Akka.Cluster inside your application, use this as a base configuration:\r\n\r\n````\r\nakka {\r\n            actor {\r\n              provider = \"Akka.Cluster.ClusterActorRefProvider, Akka.Cluster\"\r\n            }\r\n            \r\n            remote {\r\n              log-remote-lifecycle-events = DEBUG\r\n              helios.tcp {\r\n                hostname = \"127.0.0.1\"\r\n                port = 0\r\n              }\r\n            }\r\n\r\n            cluster {\r\n              seed-nodes = [\r\n                \"akka.tcp://ClusterSystem@127.0.0.1:2551\",\r\n                \"akka.tcp://ClusterSystem@127.0.0.1:2552\"]\r\n\r\n              auto-down-unreachable-after = 10s\r\n            }\r\n          }\r\n````\r\n\r\nThis gives you access to the `Cluster` actor system extension, specifies a couple of seed nodes, and the `ClusterActorRefProvider` gives you access to cluster routers, which are the primary way you integrate clusters into your existing applications.\r\n\r\nHere's how you can configure a cluster router:\r\n````\r\n/myAppRouter {\r\n router = consistent-hashing-pool\r\n      nr-of-instances = 100\r\n      cluster {\r\n        enabled = on\r\n        max-nr-of-instances-per-node = 3\r\n        allow-local-routees = off\r\n      }\r\n}\r\n````\r\n\r\nSo this defines a consistent hashing pool router that automatically deploys actors on active nodes participating in the cluster, and it explicitly forbids running any actors locally on the calling machine (`allow-local-routees = off`).\r\n\r\nI'll be including some more examples and better documentation on all of the cluster options available for each type of router.\r\n\r\n## Roles and Clusters\r\nFrom one of the new samples added to `examples/Cluster` in this pull request:\r\n`akka.cluster.roles = [backend]`\r\n\r\nClustering would not be very useful if you could only cluster identical pieces of software together - so that's why you can define __roles__ for each node in your cluster. That way if you can have multiple different pieces of software built on Akka.NET still form a cluster together, but only assign work to nodes that fulfill specific roles - and this is something you can specify in your routing configuration:\r\n\r\n````\r\n/myAppRouter {\r\n router = consistent-hashing-pool\r\n      nr-of-instances = 100\r\n      cluster {\r\n        enabled = on\r\n        max-nr-of-instances-per-node = 3\r\n        allow-local-routees = off\r\n        use-role = backend\r\n      }\r\n}\r\n````\r\n\r\nNow this router will only assign work to nodes that have the `backend` role enabled in their configuration.\r\n\r\n## Wrap Up\r\n@smalldave and I still have more work to do yet, and we'll be periodically submitting PRs to dev. In the meantime though, we would love it if you could run the samples, document bugs, or help us port the MultiNode testkit (located in Akka.Remote.TestKit.).\r\n\r\nIf you have any questions about this PR, put them here - if you have any questions about the design or usage please post on the [Akka.NET users group](https://groups.google.com/forum/?utm_medium=email&utm_source=footer#!forum/akkadotnet-user-list) or create an issue here.","created_at":"2014-09-17T04:10:47Z","updated_at":"2014-09-17T04:10:47Z","closed_at":null,"merged_at":null,"merge_commit_sha":null,"assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/akkadotnet/akka.net/pulls/400/commits","review_comments_url":"https://api.github.com/repos/akkadotnet/akka.net/pulls/400/comments","review_comment_url":"https://api.github.com/repos/akkadotnet/akka.net/pulls/comments/{number}","comments_url":"https://api.github.com/repos/akkadotnet/akka.net/issues/400/comments","statuses_url":"https://api.github.com/repos/akkadotnet/akka.net/statuses/fdb725535ea5a8d311f447ee3ce84e26073e3344","head":{"label":"Aaronontheweb:akka-cluster","ref":"akka-cluster","sha":"fdb725535ea5a8d311f447ee3ce84e26073e3344","user":{"login":"Aaronontheweb","id":326939,"avatar_url":"https://avatars.githubusercontent.com/u/326939?v=2","gravatar_id":"ceb466e3992c9957759222a871897300","url":"https://api.github.com/users/Aaronontheweb","html_url":"https://github.com/Aaronontheweb","followers_url":"https://api.github.com/users/Aaronontheweb/followers","following_url":"https://api.github.com/users/Aaronontheweb/following{/other_user}","gists_url":"https://api.github.com/users/Aaronontheweb/gists{/gist_id}","starred_url":"https://api.github.com/users/Aaronontheweb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Aaronontheweb/subscriptions","organizations_url":"https://api.github.com/users/Aaronontheweb/orgs","repos_url":"https://api.github.com/users/Aaronontheweb/repos","events_url":"https://api.github.com/users/Aaronontheweb/events{/privacy}","received_events_url":"https://api.github.com/users/Aaronontheweb/received_events","type":"User","site_admin":false},"repo":{"id":16661964,"name":"akka.net","full_name":"Aaronontheweb/akka.net","owner":{"login":"Aaronontheweb","id":326939,"avatar_url":"https://avatars.githubusercontent.com/u/326939?v=2","gravatar_id":"ceb466e3992c9957759222a871897300","url":"https://api.github.com/users/Aaronontheweb","html_url":"https://github.com/Aaronontheweb","followers_url":"https://api.github.com/users/Aaronontheweb/followers","following_url":"https://api.github.com/users/Aaronontheweb/following{/other_user}","gists_url":"https://api.github.com/users/Aaronontheweb/gists{/gist_id}","starred_url":"https://api.github.com/users/Aaronontheweb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Aaronontheweb/subscriptions","organizations_url":"https://api.github.com/users/Aaronontheweb/orgs","repos_url":"https://api.github.com/users/Aaronontheweb/repos","events_url":"https://api.github.com/users/Aaronontheweb/events{/privacy}","received_events_url":"https://api.github.com/users/Aaronontheweb/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/Aaronontheweb/akka.net","description":"Port of Akka actors for .NET","fork":true,"url":"https://api.github.com/repos/Aaronontheweb/akka.net","forks_url":"https://api.github.com/repos/Aaronontheweb/akka.net/forks","keys_url":"https://api.github.com/repos/Aaronontheweb/akka.net/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Aaronontheweb/akka.net/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Aaronontheweb/akka.net/teams","hooks_url":"https://api.github.com/repos/Aaronontheweb/akka.net/hooks","issue_events_url":"https://api.github.com/repos/Aaronontheweb/akka.net/issues/events{/number}","events_url":"https://api.github.com/repos/Aaronontheweb/akka.net/events","assignees_url":"https://api.github.com/repos/Aaronontheweb/akka.net/assignees{/user}","branches_url":"https://api.github.com/repos/Aaronontheweb/akka.net/branches{/branch}","tags_url":"https://api.github.com/repos/Aaronontheweb/akka.net/tags","blobs_url":"https://api.github.com/repos/Aaronontheweb/akka.net/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Aaronontheweb/akka.net/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Aaronontheweb/akka.net/git/refs{/sha}","trees_url":"https://api.github.com/repos/Aaronontheweb/akka.net/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Aaronontheweb/akka.net/statuses/{sha}","languages_url":"https://api.github.com/repos/Aaronontheweb/akka.net/languages","stargazers_url":"https://api.github.com/repos/Aaronontheweb/akka.net/stargazers","contributors_url":"https://api.github.com/repos/Aaronontheweb/akka.net/contributors","subscribers_url":"https://api.github.com/repos/Aaronontheweb/akka.net/subscribers","subscription_url":"https://api.github.com/repos/Aaronontheweb/akka.net/subscription","commits_url":"https://api.github.com/repos/Aaronontheweb/akka.net/commits{/sha}","git_commits_url":"https://api.github.com/repos/Aaronontheweb/akka.net/git/commits{/sha}","comments_url":"https://api.github.com/repos/Aaronontheweb/akka.net/comments{/number}","issue_comment_url":"https://api.github.com/repos/Aaronontheweb/akka.net/issues/comments/{number}","contents_url":"https://api.github.com/repos/Aaronontheweb/akka.net/contents/{+path}","compare_url":"https://api.github.com/repos/Aaronontheweb/akka.net/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Aaronontheweb/akka.net/merges","archive_url":"https://api.github.com/repos/Aaronontheweb/akka.net/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Aaronontheweb/akka.net/downloads","issues_url":"https://api.github.com/repos/Aaronontheweb/akka.net/issues{/number}","pulls_url":"https://api.github.com/repos/Aaronontheweb/akka.net/pulls{/number}","milestones_url":"https://api.github.com/repos/Aaronontheweb/akka.net/milestones{/number}","notifications_url":"https://api.github.com/repos/Aaronontheweb/akka.net/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Aaronontheweb/akka.net/labels{/name}","releases_url":"https://api.github.com/repos/Aaronontheweb/akka.net/releases{/id}","created_at":"2014-02-09T07:12:05Z","updated_at":"2014-07-03T21:19:06Z","pushed_at":"2014-09-17T02:15:01Z","git_url":"git://github.com/Aaronontheweb/akka.net.git","ssh_url":"git@github.com:Aaronontheweb/akka.net.git","clone_url":"https://github.com/Aaronontheweb/akka.net.git","svn_url":"https://github.com/Aaronontheweb/akka.net","homepage":"","size":39108,"stargazers_count":0,"watchers_count":0,"language":"C#","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":1,"mirror_url":null,"open_issues_count":0,"forks":1,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"akkadotnet:dev","ref":"dev","sha":"0308f79ffaca3f0c8c39b0e2a98f6068094324ea","user":{"login":"akkadotnet","id":7003835,"avatar_url":"https://avatars.githubusercontent.com/u/7003835?v=2","gravatar_id":"19a15410bba88a8d35755fc3528a069a","url":"https://api.github.com/users/akkadotnet","html_url":"https://github.com/akkadotnet","followers_url":"https://api.github.com/users/akkadotnet/followers","following_url":"https://api.github.com/users/akkadotnet/following{/other_user}","gists_url":"https://api.github.com/users/akkadotnet/gists{/gist_id}","starred_url":"https://api.github.com/users/akkadotnet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/akkadotnet/subscriptions","organizations_url":"https://api.github.com/users/akkadotnet/orgs","repos_url":"https://api.github.com/users/akkadotnet/repos","events_url":"https://api.github.com/users/akkadotnet/events{/privacy}","received_events_url":"https://api.github.com/users/akkadotnet/received_events","type":"Organization","site_admin":false},"repo":{"id":15509440,"name":"akka.net","full_name":"akkadotnet/akka.net","owner":{"login":"akkadotnet","id":7003835,"avatar_url":"https://avatars.githubusercontent.com/u/7003835?v=2","gravatar_id":"19a15410bba88a8d35755fc3528a069a","url":"https://api.github.com/users/akkadotnet","html_url":"https://github.com/akkadotnet","followers_url":"https://api.github.com/users/akkadotnet/followers","following_url":"https://api.github.com/users/akkadotnet/following{/other_user}","gists_url":"https://api.github.com/users/akkadotnet/gists{/gist_id}","starred_url":"https://api.github.com/users/akkadotnet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/akkadotnet/subscriptions","organizations_url":"https://api.github.com/users/akkadotnet/orgs","repos_url":"https://api.github.com/users/akkadotnet/repos","events_url":"https://api.github.com/users/akkadotnet/events{/privacy}","received_events_url":"https://api.github.com/users/akkadotnet/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/akkadotnet/akka.net","description":"Port of Akka actors for .NET","fork":false,"url":"https://api.github.com/repos/akkadotnet/akka.net","forks_url":"https://api.github.com/repos/akkadotnet/akka.net/forks","keys_url":"https://api.github.com/repos/akkadotnet/akka.net/keys{/key_id}","collaborators_url":"https://api.github.com/repos/akkadotnet/akka.net/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/akkadotnet/akka.net/teams","hooks_url":"https://api.github.com/repos/akkadotnet/akka.net/hooks","issue_events_url":"https://api.github.com/repos/akkadotnet/akka.net/issues/events{/number}","events_url":"https://api.github.com/repos/akkadotnet/akka.net/events","assignees_url":"https://api.github.com/repos/akkadotnet/akka.net/assignees{/user}","branches_url":"https://api.github.com/repos/akkadotnet/akka.net/branches{/branch}","tags_url":"https://api.github.com/repos/akkadotnet/akka.net/tags","blobs_url":"https://api.github.com/repos/akkadotnet/akka.net/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/akkadotnet/akka.net/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/akkadotnet/akka.net/git/refs{/sha}","trees_url":"https://api.github.com/repos/akkadotnet/akka.net/git/trees{/sha}","statuses_url":"https://api.github.com/repos/akkadotnet/akka.net/statuses/{sha}","languages_url":"https://api.github.com/repos/akkadotnet/akka.net/languages","stargazers_url":"https://api.github.com/repos/akkadotnet/akka.net/stargazers","contributors_url":"https://api.github.com/repos/akkadotnet/akka.net/contributors","subscribers_url":"https://api.github.com/repos/akkadotnet/akka.net/subscribers","subscription_url":"https://api.github.com/repos/akkadotnet/akka.net/subscription","commits_url":"https://api.github.com/repos/akkadotnet/akka.net/commits{/sha}","git_commits_url":"https://api.github.com/repos/akkadotnet/akka.net/git/commits{/sha}","comments_url":"https://api.github.com/repos/akkadotnet/akka.net/comments{/number}","issue_comment_url":"https://api.github.com/repos/akkadotnet/akka.net/issues/comments/{number}","contents_url":"https://api.github.com/repos/akkadotnet/akka.net/contents/{+path}","compare_url":"https://api.github.com/repos/akkadotnet/akka.net/compare/{base}...{head}","merges_url":"https://api.github.com/repos/akkadotnet/akka.net/merges","archive_url":"https://api.github.com/repos/akkadotnet/akka.net/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/akkadotnet/akka.net/downloads","issues_url":"https://api.github.com/repos/akkadotnet/akka.net/issues{/number}","pulls_url":"https://api.github.com/repos/akkadotnet/akka.net/pulls{/number}","milestones_url":"https://api.github.com/repos/akkadotnet/akka.net/milestones{/number}","notifications_url":"https://api.github.com/repos/akkadotnet/akka.net/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/akkadotnet/akka.net/labels{/name}","releases_url":"https://api.github.com/repos/akkadotnet/akka.net/releases{/id}","created_at":"2013-12-29T14:17:38Z","updated_at":"2014-09-17T02:26:24Z","pushed_at":"2014-09-11T22:12:40Z","git_url":"git://github.com/akkadotnet/akka.net.git","ssh_url":"git@github.com:akkadotnet/akka.net.git","clone_url":"https://github.com/akkadotnet/akka.net.git","svn_url":"https://github.com/akkadotnet/akka.net","homepage":"http://akkadotnet.github.io/","size":57193,"stargazers_count":311,"watchers_count":311,"language":"C#","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":52,"mirror_url":null,"open_issues_count":69,"forks":52,"open_issues":69,"watchers":311,"default_branch":"dev"}},"_links":{"self":{"href":"https://api.github.com/repos/akkadotnet/akka.net/pulls/400"},"html":{"href":"https://github.com/akkadotnet/akka.net/pull/400"},"issue":{"href":"https://api.github.com/repos/akkadotnet/akka.net/issues/400"},"comments":{"href":"https://api.github.com/repos/akkadotnet/akka.net/issues/400/comments"},"review_comments":{"href":"https://api.github.com/repos/akkadotnet/akka.net/pulls/400/comments"},"review_comment":{"href":"https://api.github.com/repos/akkadotnet/akka.net/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/akkadotnet/akka.net/pulls/400/commits"},"statuses":{"href":"https://api.github.com/repos/akkadotnet/akka.net/statuses/fdb725535ea5a8d311f447ee3ce84e26073e3344"}},"merged":false,"mergeable":null,"mergeable_state":"unknown","merged_by":null,"comments":0,"review_comments":0,"commits":114,"additions":28764,"deletions":816,"changed_files":133}}