harmony icon indicating copy to clipboard operation
harmony copied to clipboard

Make blockNumber rpc more efficient with atomic uint64

Open rlan35 opened this issue 3 years ago • 2 comments

Previous _blockNumber rpc is retrieving the latest block, copying the header and returning the number from the header, which is very unnecessary and expensive.

Adding a uint64 atomic value to store the latest block number and directly turning it.

Also increase receiptsCacheLimit to 256 and reduce rpcGetBlocksLimit to 64

Change tested locally.

rlan35 avatar Jan 22 '22 02:01 rlan35

How much resources we are saving for blockNumber requests? Is there a benchmark showing the improvement?

No benchmark yet. @AlexiaChen is working on a loadtest and benchmark tool.

rlan35 avatar Jan 26 '22 17:01 rlan35

I really like this PR. I will be resubmitting it.

ONECasey avatar May 31 '23 23:05 ONECasey