Skip to content

Conversation

@belikeswap
Copy link

Brief

Tried to resolve a currently ongoing issue with the beckn gateway wherein lots of localtunnel bpps being registered on the gateway are slowing search calls, 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_interaction in the Subscriber class (in [beckn-sdk-java](https://github.com/beckn-on-succinct/beckn-sdk-java) codebase) as well as NetworkRole model (in [beckn-registry](https://github.com/beckn-on-succinct/beckn-registry) codebase).

The lastInteraction field 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

  • While the commits made by me aim to modify the various involved codebases, this is just the logic side of things, database schema changes are also required to accomodate this change.
  • The changes committed by me might not also be complete and the change might need to be propagated accross other parts of the system as well, in order to avoid breaking anything. I'd be happy to help out with the same with necessary guidance.
  • This change is NOT backward-compatible.
  • As a future consideration, before deploying this change, it should also be evaluated in terms of how much it might hamper the overall performance of the current system.

@belikeswap belikeswap marked this pull request as ready for review July 6, 2024 21:57
@belikeswap belikeswap marked this pull request as draft July 7, 2024 06:04
@belikeswap belikeswap marked this pull request as ready for review July 7, 2024 06:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant