[
https://issues.jboss.org/browse/JGRP-2080?page=com.atlassian.jira.plugin....
]
Bela Ban edited comment on JGRP-2080 at 7/27/16 7:41 AM:
---------------------------------------------------------
Hmm... we could also start from the end and add 'randomness' to an {{IpAddress}};
rather than encoding the IP address and port in the UUID, we could add a 16 byte (or
smaller) UUID to {{IpAddress}}.
The reason we abandoned IpAddress a long time ago is that - if the port was fixed - we
could run into _reincarnation issues_: a member with address {{192.168.1.3:5000}} crashing
and immediately restarting would have the same address {{192.168.1.3:5000}} but still have
state from old members (e.g. in {{NAKACK2}}).
Since the combination of IP address and port is pretty unique, we'd only have to add a
small amount of randomness (perhaps even configurable) to an {{IpAddress}}. Currently,
{{IpAddress}} uses 20 bytes in memory (JOL) and loses 4 due to mapping, so we could use 12
bytes for randomness.
The advantages of this over encoding the IP address in a UUID are:
* To extract an {{IpAddress}} from a UUID when sending a message, we'd need to create
a new {{IpAddress}} instance for every message (high allocation rate). When adding some
randomness to {{IpAddress}}, we can directly use those
* Encoding an IPv4 address in a UUID takes 6 bytes (4 for the address and 2 for the port),
so we have 10 bytes left for randomness in the UUID. For IPv6, the required size is 18
bytes, so we'd need to make the UUID larger to have enough randomness. With the
extension scheme, {{IpAddress}} would always contain the same amount of randomness.
was (Author: belaban):
Hmm... we could also start from the end and add 'randomness' to an {{IpAddress}};
rather than encoding the IP address and port in the UUID, we could add a 16 byte (or
smaller) UUID to {{IpAddress}}.
The reason we abaondoned IpAddress a long time ago is that - if the port was fixed - we
could run into _reincarnation issues_: a member with address {{192.168.1.3:5000}} crashing
and immediately restarting would have the same address {{192.168.1.3:5000}} but still have
state from old members (e.g. in {{NAKACK2}}).
Since the combination of IP address and port is pretty unique, we'd only have to add a
small amount of randomness (perhaps even configurable) to an {{IpAddress}}. Currently,
{{IpAddress}} uses 20 bytes in memory (JOL) and loses 4 due to mapping, so we could use 12
bytes for randomness.
New Address which contains IP address and port
----------------------------------------------
Key: JGRP-2080
URL:
https://issues.jboss.org/browse/JGRP-2080
Project: JGroups
Issue Type: Feature Request
Reporter: Bela Ban
Assignee: Bela Ban
Fix For: 4.0
Currently, UUIDs are mapped to IpAddresses (InetAddress and port). The mappings are
maintained in logical_address_cache in TP and populated via the discovery protocol.
If we encoded the IP address and port (6 bytes in IPv4, 18 bytes in IPv6) directly into
the UUID, we would not have to maintain this cache anymore. At least not for IpAddresses,
but still for UUID/logical_name mappings.
An {{IPv4UUID}} (credits to Neal Dillman) would look like this:
* 4 bytes: IPv4 address
* 2 bytes: port
* 12 bytes: random data (rest of the UUID)
When joining a cluster, the joiner would only need to discover the address of the
coordinator and send a JOIN-REQ to it. The JOIN-RSP would contain the view, which contains
all members, so the joiner has all addresses. Plus, the coord would also send a
VIEW-CHANGE to all existing members, so they have the address of the new member, too.
When sending a unicast, the transport could simply extract the IpAddress from the first 6
bytes of the IPv4UUID to know the destination address. For multicasts, UDP is not an
issue, and TCP would simply iterate over the current view and send the message to each
member separately.
An IPv6UUID would need more than 16 bytes as it already needs 18 bytes for the address
and the port. We might add another 6 bytes for uniqueness, to have a nice padding at 24
bytes.
--
This message was sent by Atlassian JIRA
(v6.4.11#64026)