dashboard icon indicating copy to clipboard operation
dashboard copied to clipboard

reduce number of calls to Horizon when updating caches

Open acharb opened this issue 3 years ago • 0 comments

see if we can reduce the number of calls to Horizon. For example the v1 updateApiLumens method calls Horizon 40 times simultaneously every 10 mins.

commonLumens.totalSupply - 2
commonLumens.circulatingSupply - 22
commonLumens.directDevelopmentAll - 4
commonLumens.distributionEcosystemSupport - 5
commonLumens.distributionUseCaseInvestment - 2
commonLumens.distributionUserAcquisition - 5

Total horizon calls: 40

and some of these calls are repeats (eg. circulatingSupply calls totalSupply).

This large number of calls at once creates intermittent Horizon timeout errors, as well as the length of the tests (when Horizon responses are even slightly slower, because of the many calls it creates a large lag where you have to increase the time of the backend tests to be able to handle, eg).

some possible options to explore are:

  • deprecate endpoints (or deprecate fields w/in endpoints)
  • cache each granular horizon endpoint data, and then on the api endpoints compute the responses from the caches on the fly. This should prevent repeat-horizon calls.
  • possibly use hubble for some/all of this data instead of calling Horizon. Hubble also has some limitations (cost/query, updates every 30 mins), that will need to be looked into though

acharb avatar Jan 11 '22 01:01 acharb