diff options
author | Anders Svensson <[email protected]> | 2015-12-07 17:06:38 +0100 |
---|---|---|
committer | Anders Svensson <[email protected]> | 2015-12-21 17:16:37 +0100 |
commit | 8fd4e5f47efd13a6bad7811239438539ae383966 (patch) | |
tree | 5047570e18b53db9e21c106b0a7d3a299fe882b8 /lib/snmp/test/snmp_appup_mgr.erl | |
parent | 09a4ef659657525b7530416697f92db8a360a28f (diff) | |
download | otp-8fd4e5f47efd13a6bad7811239438539ae383966.tar.gz otp-8fd4e5f47efd13a6bad7811239438539ae383966.tar.bz2 otp-8fd4e5f47efd13a6bad7811239438539ae383966.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 'lib/snmp/test/snmp_appup_mgr.erl')
0 files changed, 0 insertions, 0 deletions