aboutsummaryrefslogtreecommitdiffstats
path: root/bootstrap
diff options
context:
space:
mode:
authorAnders Svensson <[email protected]>2015-12-07 17:06:38 +0100
committerAnders Svensson <[email protected]>2016-02-09 10:45:39 +0100
commit2ada9c5a0d1b7de4ff8595878ff035dbb2c96cd3 (patch)
tree9ba7d3b7dbf3b140e08a4c64c44c88df68c5235f /bootstrap
parent90ce90b20a750d39b0b1b470ccb584e3b064df95 (diff)
downloadotp-2ada9c5a0d1b7de4ff8595878ff035dbb2c96cd3.tar.gz
otp-2ada9c5a0d1b7de4ff8595878ff035dbb2c96cd3.tar.bz2
otp-2ada9c5a0d1b7de4ff8595878ff035dbb2c96cd3.zip
Make peer handling more efficient
Each service process maintains a dictionary of peers, mapping an application alias to a {pid(), #diameter_caps{}} list of connected peers. These lists are potentially large, peers were appended to the end of the list for no particular reason, and these long lists were constructed/deconstructed when filtering them for pick_peer callbacks. Many simultaneous outgoing request could then slow the VM to a crawl, with many scheduled processes mired in list manipulation. The pseudo-dicts are now replaced by plain ets tables. The reason for them was (once upon a time) to have an interface interchangeable with a plain dict for debugging purposes, but strict swapablity hasn't been the case for some time now, and in practice a swap has never taken place. Additional tables mapping Origin-Host/Realm have also been introduced, to minimize the size of the peers lists when peers are filtered on host/realm. For example, a filter like {any, [{all, [realm, host]}, realm]} is probably a very common case: preferring a Destination-Realm/Host match before falling back on Destination-Realm alone. This is now more efficiently (but not equivalently) expressed as {first, [{all, [realm, host]}, realm]} to stop the search when the best match is made, and extracts peers from host/realm tables instead of searching through the list of all peers supporting the application in question. The code to try and start with a lookup isn't exhaustive, and the 'any' filter is still as inefficient as previously.
Diffstat (limited to 'bootstrap')
0 files changed, 0 insertions, 0 deletions