diff options
author | Anders Svensson <[email protected]> | 2019-03-06 17:13:07 +0100 |
---|---|---|
committer | Anders Svensson <[email protected]> | 2019-03-06 17:42:44 +0100 |
commit | 376e8fac401bd11b3cb3d2f9661eb7ff0b9bbcd7 (patch) | |
tree | fc9937d824a9e24e4724119ed12c62a97c012369 /lib/common_test/ebin | |
parent | 734a7daf2e556d684850a3cb278684ba522a29de (diff) | |
download | otp-376e8fac401bd11b3cb3d2f9661eb7ff0b9bbcd7.tar.gz otp-376e8fac401bd11b3cb3d2f9661eb7ff0b9bbcd7.tar.bz2 otp-376e8fac401bd11b3cb3d2f9661eb7ff0b9bbcd7.zip |
Add consistent hashing to diameter_dist:route_session/2
If the Session-Id optional value to node() mapping fails then hash
Session-Id to a node by default, instead of selecting the local node as
in the parent commit. The previous behaviour is configurable by setting
default = local in an options map.
Nodes make themselves part of the pool from which nodes are selected by
calling diameter_dist:attach/1 with the list of service names they are
willing to handle requests for, the local node being selected in the
absence of any attached nodes. The original idea was to base the node
pool on share_peers and/or use_shared_peers configuration, but that
configuration determines where outgoing requests can be sent, while
route_session/2 deals with incoming requests, so it's not obvious that
conflating the two is a good thing. (Also because
share_peers/use_shared_peers can be used in different ways; the former
could have been skipped entirely.)
The hashing effectively places nodes on a circle, a hashed Session-Id
being mapped to the nearest predecessor node (clockwise). Nodes are
rehashed with each Session-Id (with the id as salt) for a more even
distribution, at the cost of performance, although how high the cost or
how even the distribution has yet to be tested. Obviously, the larger
the number of attached nodes, the higher the cost. Adding/removing an
attached node only affects session ids that hash in the interval between
the added/removed node and its successor (hence consistent hashing).
Options are tweaked slightly compared to the parent commit, and it is
now possible to restrict the optional value mapping to specific Diameter
identities, to avoid mapping an id that was generated at the peer when
the peer is also implemented with the diameter application.
Note that diameter_dist is not yet an officially documented interface,
so could change. Documentation is in the module itself.
Diffstat (limited to 'lib/common_test/ebin')
0 files changed, 0 insertions, 0 deletions