{"action":"closed","issue":{"url":"https://api.github.com/repos/hazelcast/hazelcast/issues/5598","labels_url":"https://api.github.com/repos/hazelcast/hazelcast/issues/5598/labels{/name}","comments_url":"https://api.github.com/repos/hazelcast/hazelcast/issues/5598/comments","events_url":"https://api.github.com/repos/hazelcast/hazelcast/issues/5598/events","html_url":"https://github.com/hazelcast/hazelcast/issues/5598","id":91101454,"number":5598,"title":"Multicast joiner slow","user":{"login":"alexturc","id":1728388,"avatar_url":"https://avatars.githubusercontent.com/u/1728388?v=3","gravatar_id":"","url":"https://api.github.com/users/alexturc","html_url":"https://github.com/alexturc","followers_url":"https://api.github.com/users/alexturc/followers","following_url":"https://api.github.com/users/alexturc/following{/other_user}","gists_url":"https://api.github.com/users/alexturc/gists{/gist_id}","starred_url":"https://api.github.com/users/alexturc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alexturc/subscriptions","organizations_url":"https://api.github.com/users/alexturc/orgs","repos_url":"https://api.github.com/users/alexturc/repos","events_url":"https://api.github.com/users/alexturc/events{/privacy}","received_events_url":"https://api.github.com/users/alexturc/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/hazelcast/hazelcast/labels/Team:%20Core","name":"Team: Core","color":"109def"},{"url":"https://api.github.com/repos/hazelcast/hazelcast/labels/Type:%20Defect","name":"Type: Defect","color":"eb6420"}],"state":"closed","locked":false,"assignee":null,"milestone":{"url":"https://api.github.com/repos/hazelcast/hazelcast/milestones/61","html_url":"https://github.com/hazelcast/hazelcast/milestones/3.6","labels_url":"https://api.github.com/repos/hazelcast/hazelcast/milestones/61/labels","id":982584,"number":61,"title":"3.6","description":"","creator":{"login":"enesakar","id":234086,"avatar_url":"https://avatars.githubusercontent.com/u/234086?v=3","gravatar_id":"","url":"https://api.github.com/users/enesakar","html_url":"https://github.com/enesakar","followers_url":"https://api.github.com/users/enesakar/followers","following_url":"https://api.github.com/users/enesakar/following{/other_user}","gists_url":"https://api.github.com/users/enesakar/gists{/gist_id}","starred_url":"https://api.github.com/users/enesakar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/enesakar/subscriptions","organizations_url":"https://api.github.com/users/enesakar/orgs","repos_url":"https://api.github.com/users/enesakar/repos","events_url":"https://api.github.com/users/enesakar/events{/privacy}","received_events_url":"https://api.github.com/users/enesakar/received_events","type":"User","site_admin":false},"open_issues":66,"closed_issues":925,"state":"open","created_at":"2015-02-17T09:27:09Z","updated_at":"2015-11-27T13:02:27Z","due_on":null,"closed_at":null},"comments":0,"created_at":"2015-06-25T23:18:55Z","updated_at":"2015-11-27T13:02:27Z","closed_at":"2015-11-27T13:02:27Z","body":"I noticed that MulticastJoiner can be much slower than configuration parameters imply.\r\n\r\nSee the code below (MulticastJoiner.calculateTryCount()).\r\ntryCount is adjusted by a value which can increase significantly the time a node is waiting to decide if is a master or not. \r\n\r\nFor example, even if I set multicast timeout seconds to 1, it still takes 8 seconds for a node to decide that is a master node. In my case tryCount is initially 10 and then adjusted by 65 to a total value of 75. So even if the MulsticastJoiner is configured to make a decision in one second, it still takes 8 seconds to do so.\r\n\r\nThis is especially painful in tests where 1 or 2 seconds would be just fine and running tests faster is important.\r\n\r\n```java\r\nprivate int calculateTryCount() {\r\n        final NetworkConfig networkConfig = config.getNetworkConfig();\r\n        int timeoutSeconds = networkConfig.getJoin().getMulticastConfig().getMulticastTimeoutSeconds();\r\n        int tryCountCoefficient = 1000 / PUBLISH_INTERVAL;\r\n        int tryCount = timeoutSeconds * tryCountCoefficient;\r\n        String host = node.getThisAddress().getHost();\r\n        int lastDigits;\r\n        try {\r\n            lastDigits = Integer.parseInt(host.substring(host.lastIndexOf('.') + 1));\r\n        } catch (NumberFormatException e) {\r\n            lastDigits = RandomPicker.getInt(512);\r\n        }\r\n        lastDigits = lastDigits % 100;\r\n        int portDiff = node.getThisAddress().getPort() - networkConfig.getPort();\r\n        tryCount += lastDigits + portDiff * timeoutSeconds * 3;\r\n        return tryCount;\r\n    }\r\n```"}}