{"action":"created","comment":{"url":"https://api.github.com/repos/akka/akka/pulls/comments/242835881","pull_request_review_id":186442331,"id":242835881,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDI0MjgzNTg4MQ==","diff_hunk":"@@ -135,10 +135,26 @@ object ShardCoordinator {\n   /**\n    * The default implementation of [[ShardCoordinator.LeastShardAllocationStrategy]]\n    * allocates new shards to the `ShardRegion` with least number of previously allocated shards.\n-   * It picks shards for rebalancing handoff from the `ShardRegion` with most number of previously allocated shards.\n+   *\n+   * When a node is removed from the cluster the shards on that node will be started on the remaining nodes,\n+   * evenly spread on the remaining nodes (by picking regions with least shards).\n+   *\n+   * When a node is added to the cluster the shards on the existing nodes will be rebalanced to the new node.\n+   * It picks shards for rebalancing from the `ShardRegion` with most number of previously allocated shards.\n    * They will then be allocated to the `ShardRegion` with least number of previously allocated shards,\n    * i.e. new members in the cluster. There is a configurable threshold of how large the difference\n-   * must be to begin the rebalancing. The number of ongoing rebalancing processes can be limited.\n+   * must be to begin the rebalancing. The difference between number of shards in the region with most shards and\n+   * the region with least shards must be greater than the `rebalanceThreshold` for the rebalance to occur.\n+   *\n+   * A `rebalanceThreshold` of 1 gives the best distribution and therefore typically the best choice.\n+   * A higher threshold means that more shards can be rebalanced at the same time instead of one-by-one.","path":"akka-cluster-sharding/src/main/scala/akka/cluster/sharding/ShardCoordinator.scala","position":18,"original_position":18,"commit_id":"bbae1ecdb6b0510f8b05ac57ad175e877b58ad74","original_commit_id":"bbae1ecdb6b0510f8b05ac57ad175e877b58ad74","user":{"login":"raboof","id":131856,"node_id":"MDQ6VXNlcjEzMTg1Ng==","avatar_url":"https://avatars2.githubusercontent.com/u/131856?v=4","gravatar_id":"","url":"https://api.github.com/users/raboof","html_url":"https://github.com/raboof","followers_url":"https://api.github.com/users/raboof/followers","following_url":"https://api.github.com/users/raboof/following{/other_user}","gists_url":"https://api.github.com/users/raboof/gists{/gist_id}","starred_url":"https://api.github.com/users/raboof/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/raboof/subscriptions","organizations_url":"https://api.github.com/users/raboof/orgs","repos_url":"https://api.github.com/users/raboof/repos","events_url":"https://api.github.com/users/raboof/events{/privacy}","received_events_url":"https://api.github.com/users/raboof/received_events","type":"User","site_admin":false},"body":"As @johanandren correctly mentioned we have `maxSimultaneousRebalance` for this already so we might not have to use this setting for that?","created_at":"2018-12-19T09:01:38Z","updated_at":"2018-12-19T09:02:32Z","html_url":"https://github.com/akka/akka/pull/26101#discussion_r242835881","pull_request_url":"https://api.github.com/repos/akka/akka/pulls/26101","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/akka/akka/pulls/comments/242835881"},"html":{"href":"https://github.com/akka/akka/pull/26101#discussion_r242835881"},"pull_request":{"href":"https://api.github.com/repos/akka/akka/pulls/26101"}}},"pull_request":{"url":"https://api.github.com/repos/akka/akka/pulls/26101","id":237591027,"node_id":"MDExOlB1bGxSZXF1ZXN0MjM3NTkxMDI3","html_url":"https://github.com/akka/akka/pull/26101","diff_url":"https://github.com/akka/akka/pull/26101.diff","patch_url":"https://github.com/akka/akka/pull/26101.patch","issue_url":"https://api.github.com/repos/akka/akka/issues/26101","number":26101,"state":"open","locked":false,"title":"Improve default shard rebalancing algorithm, #26012","user":{"login":"patriknw","id":336161,"node_id":"MDQ6VXNlcjMzNjE2MQ==","avatar_url":"https://avatars3.githubusercontent.com/u/336161?v=4","gravatar_id":"","url":"https://api.github.com/users/patriknw","html_url":"https://github.com/patriknw","followers_url":"https://api.github.com/users/patriknw/followers","following_url":"https://api.github.com/users/patriknw/following{/other_user}","gists_url":"https://api.github.com/users/patriknw/gists{/gist_id}","starred_url":"https://api.github.com/users/patriknw/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/patriknw/subscriptions","organizations_url":"https://api.github.com/users/patriknw/orgs","repos_url":"https://api.github.com/users/patriknw/repos","events_url":"https://api.github.com/users/patriknw/events{/privacy}","received_events_url":"https://api.github.com/users/patriknw/received_events","type":"User","site_admin":false},"body":"* Use rebalance-threshold=1 because it will give the best distribution,\r\n  and previous default could result in too large difference between nodes\r\n* Off by one error, difference > threshold vs >=\r\n* Added more unit tests\r\n* Note that in some cases it may still not be optimal, stopping more\r\n  shards than necessary, but a different strategy that looks at more\r\n  than most and least is out of scope for this issue. In practise\r\n  those cases shouldn't matter much.\r\n* Also note that the rebalance interval is by default 10 seconds,\r\n  so typically shards will start up before next rebalance tick.\r\n  It's intentionally a slow process to not cause instabilities by\r\n  moving too much at the same time.\r\n\r\nRefs #26012 \r\n\r\n@eloots @WadeWaldron please review","created_at":"2018-12-11T08:38:26Z","updated_at":"2018-12-19T09:02:32Z","closed_at":null,"merged_at":null,"merge_commit_sha":"502427c2377943c5f6aa7881cc86ad09245f22d3","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[{"id":37797347,"node_id":"MDU6TGFiZWwzNzc5NzM0Nw==","url":"https://api.github.com/repos/akka/akka/labels/tested","name":"tested","color":"d7e102","default":false}],"milestone":null,"commits_url":"https://api.github.com/repos/akka/akka/pulls/26101/commits","review_comments_url":"https://api.github.com/repos/akka/akka/pulls/26101/comments","review_comment_url":"https://api.github.com/repos/akka/akka/pulls/comments{/number}","comments_url":"https://api.github.com/repos/akka/akka/issues/26101/comments","statuses_url":"https://api.github.com/repos/akka/akka/statuses/bbae1ecdb6b0510f8b05ac57ad175e877b58ad74","head":{"label":"akka:wip-26012-rebalance-patriknw","ref":"wip-26012-rebalance-patriknw","sha":"bbae1ecdb6b0510f8b05ac57ad175e877b58ad74","user":{"login":"akka","id":1496237,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE0OTYyMzc=","avatar_url":"https://avatars2.githubusercontent.com/u/1496237?v=4","gravatar_id":"","url":"https://api.github.com/users/akka","html_url":"https://github.com/akka","followers_url":"https://api.github.com/users/akka/followers","following_url":"https://api.github.com/users/akka/following{/other_user}","gists_url":"https://api.github.com/users/akka/gists{/gist_id}","starred_url":"https://api.github.com/users/akka/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/akka/subscriptions","organizations_url":"https://api.github.com/users/akka/orgs","repos_url":"https://api.github.com/users/akka/repos","events_url":"https://api.github.com/users/akka/events{/privacy}","received_events_url":"https://api.github.com/users/akka/received_events","type":"Organization","site_admin":false},"repo":{"id":130013,"node_id":"MDEwOlJlcG9zaXRvcnkxMzAwMTM=","name":"akka","full_name":"akka/akka","private":false,"owner":{"login":"akka","id":1496237,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE0OTYyMzc=","avatar_url":"https://avatars2.githubusercontent.com/u/1496237?v=4","gravatar_id":"","url":"https://api.github.com/users/akka","html_url":"https://github.com/akka","followers_url":"https://api.github.com/users/akka/followers","following_url":"https://api.github.com/users/akka/following{/other_user}","gists_url":"https://api.github.com/users/akka/gists{/gist_id}","starred_url":"https://api.github.com/users/akka/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/akka/subscriptions","organizations_url":"https://api.github.com/users/akka/orgs","repos_url":"https://api.github.com/users/akka/repos","events_url":"https://api.github.com/users/akka/events{/privacy}","received_events_url":"https://api.github.com/users/akka/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/akka/akka","description":"Build highly concurrent, distributed, and resilient message-driven applications on the JVM","fork":false,"url":"https://api.github.com/repos/akka/akka","forks_url":"https://api.github.com/repos/akka/akka/forks","keys_url":"https://api.github.com/repos/akka/akka/keys{/key_id}","collaborators_url":"https://api.github.com/repos/akka/akka/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/akka/akka/teams","hooks_url":"https://api.github.com/repos/akka/akka/hooks","issue_events_url":"https://api.github.com/repos/akka/akka/issues/events{/number}","events_url":"https://api.github.com/repos/akka/akka/events","assignees_url":"https://api.github.com/repos/akka/akka/assignees{/user}","branches_url":"https://api.github.com/repos/akka/akka/branches{/branch}","tags_url":"https://api.github.com/repos/akka/akka/tags","blobs_url":"https://api.github.com/repos/akka/akka/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/akka/akka/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/akka/akka/git/refs{/sha}","trees_url":"https://api.github.com/repos/akka/akka/git/trees{/sha}","statuses_url":"https://api.github.com/repos/akka/akka/statuses/{sha}","languages_url":"https://api.github.com/repos/akka/akka/languages","stargazers_url":"https://api.github.com/repos/akka/akka/stargazers","contributors_url":"https://api.github.com/repos/akka/akka/contributors","subscribers_url":"https://api.github.com/repos/akka/akka/subscribers","subscription_url":"https://api.github.com/repos/akka/akka/subscription","commits_url":"https://api.github.com/repos/akka/akka/commits{/sha}","git_commits_url":"https://api.github.com/repos/akka/akka/git/commits{/sha}","comments_url":"https://api.github.com/repos/akka/akka/comments{/number}","issue_comment_url":"https://api.github.com/repos/akka/akka/issues/comments{/number}","contents_url":"https://api.github.com/repos/akka/akka/contents/{+path}","compare_url":"https://api.github.com/repos/akka/akka/compare/{base}...{head}","merges_url":"https://api.github.com/repos/akka/akka/merges","archive_url":"https://api.github.com/repos/akka/akka/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/akka/akka/downloads","issues_url":"https://api.github.com/repos/akka/akka/issues{/number}","pulls_url":"https://api.github.com/repos/akka/akka/pulls{/number}","milestones_url":"https://api.github.com/repos/akka/akka/milestones{/number}","notifications_url":"https://api.github.com/repos/akka/akka/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/akka/akka/labels{/name}","releases_url":"https://api.github.com/repos/akka/akka/releases{/id}","deployments_url":"https://api.github.com/repos/akka/akka/deployments","created_at":"2009-02-16T12:51:54Z","updated_at":"2018-12-19T08:55:19Z","pushed_at":"2018-12-19T08:55:05Z","git_url":"git://github.com/akka/akka.git","ssh_url":"git@github.com:akka/akka.git","clone_url":"https://github.com/akka/akka.git","svn_url":"https://github.com/akka/akka","homepage":"http://akka.io","size":216453,"stargazers_count":9360,"watchers_count":9360,"language":"Scala","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":2926,"mirror_url":null,"archived":false,"open_issues_count":838,"license":{"key":"other","name":"Other","spdx_id":"NOASSERTION","url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":2926,"open_issues":838,"watchers":9360,"default_branch":"master"}},"base":{"label":"akka:master","ref":"master","sha":"229db51eb42853bf7a8e23195fd66c1e71771e35","user":{"login":"akka","id":1496237,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE0OTYyMzc=","avatar_url":"https://avatars2.githubusercontent.com/u/1496237?v=4","gravatar_id":"","url":"https://api.github.com/users/akka","html_url":"https://github.com/akka","followers_url":"https://api.github.com/users/akka/followers","following_url":"https://api.github.com/users/akka/following{/other_user}","gists_url":"https://api.github.com/users/akka/gists{/gist_id}","starred_url":"https://api.github.com/users/akka/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/akka/subscriptions","organizations_url":"https://api.github.com/users/akka/orgs","repos_url":"https://api.github.com/users/akka/repos","events_url":"https://api.github.com/users/akka/events{/privacy}","received_events_url":"https://api.github.com/users/akka/received_events","type":"Organization","site_admin":false},"repo":{"id":130013,"node_id":"MDEwOlJlcG9zaXRvcnkxMzAwMTM=","name":"akka","full_name":"akka/akka","private":false,"owner":{"login":"akka","id":1496237,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE0OTYyMzc=","avatar_url":"https://avatars2.githubusercontent.com/u/1496237?v=4","gravatar_id":"","url":"https://api.github.com/users/akka","html_url":"https://github.com/akka","followers_url":"https://api.github.com/users/akka/followers","following_url":"https://api.github.com/users/akka/following{/other_user}","gists_url":"https://api.github.com/users/akka/gists{/gist_id}","starred_url":"https://api.github.com/users/akka/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/akka/subscriptions","organizations_url":"https://api.github.com/users/akka/orgs","repos_url":"https://api.github.com/users/akka/repos","events_url":"https://api.github.com/users/akka/events{/privacy}","received_events_url":"https://api.github.com/users/akka/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/akka/akka","description":"Build highly concurrent, distributed, and resilient message-driven applications on the JVM","fork":false,"url":"https://api.github.com/repos/akka/akka","forks_url":"https://api.github.com/repos/akka/akka/forks","keys_url":"https://api.github.com/repos/akka/akka/keys{/key_id}","collaborators_url":"https://api.github.com/repos/akka/akka/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/akka/akka/teams","hooks_url":"https://api.github.com/repos/akka/akka/hooks","issue_events_url":"https://api.github.com/repos/akka/akka/issues/events{/number}","events_url":"https://api.github.com/repos/akka/akka/events","assignees_url":"https://api.github.com/repos/akka/akka/assignees{/user}","branches_url":"https://api.github.com/repos/akka/akka/branches{/branch}","tags_url":"https://api.github.com/repos/akka/akka/tags","blobs_url":"https://api.github.com/repos/akka/akka/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/akka/akka/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/akka/akka/git/refs{/sha}","trees_url":"https://api.github.com/repos/akka/akka/git/trees{/sha}","statuses_url":"https://api.github.com/repos/akka/akka/statuses/{sha}","languages_url":"https://api.github.com/repos/akka/akka/languages","stargazers_url":"https://api.github.com/repos/akka/akka/stargazers","contributors_url":"https://api.github.com/repos/akka/akka/contributors","subscribers_url":"https://api.github.com/repos/akka/akka/subscribers","subscription_url":"https://api.github.com/repos/akka/akka/subscription","commits_url":"https://api.github.com/repos/akka/akka/commits{/sha}","git_commits_url":"https://api.github.com/repos/akka/akka/git/commits{/sha}","comments_url":"https://api.github.com/repos/akka/akka/comments{/number}","issue_comment_url":"https://api.github.com/repos/akka/akka/issues/comments{/number}","contents_url":"https://api.github.com/repos/akka/akka/contents/{+path}","compare_url":"https://api.github.com/repos/akka/akka/compare/{base}...{head}","merges_url":"https://api.github.com/repos/akka/akka/merges","archive_url":"https://api.github.com/repos/akka/akka/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/akka/akka/downloads","issues_url":"https://api.github.com/repos/akka/akka/issues{/number}","pulls_url":"https://api.github.com/repos/akka/akka/pulls{/number}","milestones_url":"https://api.github.com/repos/akka/akka/milestones{/number}","notifications_url":"https://api.github.com/repos/akka/akka/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/akka/akka/labels{/name}","releases_url":"https://api.github.com/repos/akka/akka/releases{/id}","deployments_url":"https://api.github.com/repos/akka/akka/deployments","created_at":"2009-02-16T12:51:54Z","updated_at":"2018-12-19T08:55:19Z","pushed_at":"2018-12-19T08:55:05Z","git_url":"git://github.com/akka/akka.git","ssh_url":"git@github.com:akka/akka.git","clone_url":"https://github.com/akka/akka.git","svn_url":"https://github.com/akka/akka","homepage":"http://akka.io","size":216453,"stargazers_count":9360,"watchers_count":9360,"language":"Scala","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":2926,"mirror_url":null,"archived":false,"open_issues_count":838,"license":{"key":"other","name":"Other","spdx_id":"NOASSERTION","url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":2926,"open_issues":838,"watchers":9360,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/akka/akka/pulls/26101"},"html":{"href":"https://github.com/akka/akka/pull/26101"},"issue":{"href":"https://api.github.com/repos/akka/akka/issues/26101"},"comments":{"href":"https://api.github.com/repos/akka/akka/issues/26101/comments"},"review_comments":{"href":"https://api.github.com/repos/akka/akka/pulls/26101/comments"},"review_comment":{"href":"https://api.github.com/repos/akka/akka/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/akka/akka/pulls/26101/commits"},"statuses":{"href":"https://api.github.com/repos/akka/akka/statuses/bbae1ecdb6b0510f8b05ac57ad175e877b58ad74"}},"author_association":"MEMBER"}}
{"actor":{"display_login":"raboof"}}