Skip to content

Improve the algorithm that choses the PFS during startup. #5345

@hackaugusto

Description

@hackaugusto

Abstract

Currently during startup Raiden chooses a random PFS which is not too expensive. This does not try to find a cheaper or more performant option.

Motivation

If the random PFS happens to be in a different country/continent the latency of the request will have a significant impact in performance.

Specification

Pseudo algorithm:

indeces = range(registry.get_total_number_of_operators())
shuffle(indeces)
results = list()
while len(results) < sample_size and indeces:
  target = indeces.pop()
  url = registry.get_url_for(target)
  result = request_and_time(url)
  if result:
    results.append(result)
  return heuristic_for_fast_and_cheap(results)

def heuristic_for_fast_and_cheap(results):
  fastest = sort(results, key=fastest)[:5]
  cheapest_among_the_fasted = sort(fastest, key=cheapest)[0]
  return cheapest_among_the_fasted

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions