terra-money / fcd-classic

Terra ETL + RestFul API Server
https://fcd.terra.dev/swagger
MIT License
63 stars 42 forks source link

Cache Improvements #1

Closed hanjukim closed 4 years ago

hanjukim commented 4 years ago

Problem

Currently caching is done by collector/cacheStakingReward by accessing every endpoints periodically, which is not horizontally scalable.

To Be

We need to find a cache method that fits the blockchain. Every GET queries can be cached until next block comes. For Dashboard endpoints, we should change queries to calculate yesterday data and add it to another table, now we are querying the whole data from the beginning every single day.

To Do

etienne-napoleone commented 4 years ago

Not sure how relevant to this issue it is, but caching will be implemented on the api gateway layer level. current block data will be cached for 1sec only while other endpoints will have longer retention. This will provide more insight via the api gateway stats on what cache is hitted/missed the most, etc and will help determine if a more advanced service side caching is necessary (or not)