provenance-io / explorer-service

The server side of the blockchain Explorer app. Allows for UI browsing of the blockchain.
Apache License 2.0
6 stars 3 forks source link

Optimize the `spotlight_cache` implementation #532

Open nullpointer0x00 opened 2 months ago

nullpointer0x00 commented 2 months ago

Summary

Optimize the spotlight_cache implementation by replacing the current database storage approach with an in-memory synchronized singleton to improve performance and reduce database load.

Problem Definition

The current implementation of the spotlight_cache involves a scheduled job that runs every 5 seconds, inserting a new record into the spotlight_cache table each time. The corresponding endpoint retrieves and serves only the most recent record, meaning the historical data is not being utilized.

This approach is inefficient for several reasons:

Proposal


For Admin Use

nullpointer0x00 commented 4 days ago

I decided to go with an in memory cache. This will remove the need to store records in the database.

I will drop the whole database table in a different PR.