There seems a issue on `estimate_gas_price` API implement

The performance of this API is bad, and i opened a issue here: [Bug][API] `estimate_gas_price` API has performance issue · Issue #4486 · aptos-labs/aptos-core · GitHub

I looked into the estimate_gas_price API implement code, here’s my thoughts about the cause:

  1. The GasEstimationCache cache will be always missing
    Because the code does not update last_updated_version when updating the cache, so the cache hit condition will never be satisfied.

  2. Because of cache missed, all requests need to compete for the write lock of GasEstimationCache to continue, which will also effect the performance