Outbound optimisations #4
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Brief
Tried to resolve a currently ongoing issue with the beckn gateway wherein lots of localtunnel bpps being registered on the gateway are slowing
searchcalls, as the gateway was randomly shuffling the list of bpps and sending a request to them with a 5-second timeout.Approach
For resolving this issue, I've added a new column called
last_interactionin theSubscriberclass (in[beckn-sdk-java](https://github.com/beckn-on-succinct/beckn-sdk-java)codebase) as well asNetworkRolemodel (in[beckn-registry](https://github.com/beckn-on-succinct/beckn-registry)codebase).The
lastInteractionfield aims to store the timestamp of the last successful interfaction (HTTP Status Code 200) of the bpp with the gateway.This codebase has been modified to now sort the bpps list by their lastInteraction times, instead of randomly shuffling them before sending out the requests to the BPP.
This will ensure active and healthy BPP servers are always prioritised by the gateway over inactive ones, so that, consequently the gateway itself doesn't experience an lags. This will also ensure fairness to parties investing in hosting infrastructure to keep their BPP up & running with the best possible health.
Considerations