lotus icon indicating copy to clipboard operation
lotus copied to clipboard

Poor performance of `Filecoin.StateGetBeaconEntry` for old beacons

Open LesnyRumcajs opened this issue 4 months ago • 9 comments

Checklist

  • [X] This is not a security-related bug/issue. If it is, please follow please follow the security policy.
  • [X] I have searched on the issue tracker and the lotus forum, and there is no existing related issue or discussion.
  • [X] I am running the Latest release, the most recent RC(release canadiate) for the upcoming release or the dev branch(master), or have an issue updating to any of these.
  • [X] I did not make any code changes to lotus.

Lotus component

  • [X] lotus daemon - chain sync
  • [ ] lotus fvm/fevm - Lotus FVM and FEVM interactions
  • [ ] lotus miner/worker - sealing
  • [ ] lotus miner - proving(WindowPoSt/WinningPoSt)
  • [X] lotus JSON-RPC API
  • [ ] lotus message management (mpool)
  • [ ] Other

Lotus Version

❯ ./lotus version
Daemon:  1.29.2-rc1+calibnet+git.4004ca691+api1.5.0
Local: lotus version 1.29.2-rc1+calibnet+git.4004ca691

Repro Steps

curl --silent -X POST -H "Content-Type: application/json" \
             --data '{"jsonrpc":"2.0","id":2,"method":"Filecoin.StateGetBeaconEntry","params": [ 1 ] }' \
             "http://127.0.0.1:1234/rpc/v1"

First run takes well over a minute (91s on my machine)

Describe the Bug

It is a regression from old performance (pre https://github.com/filecoin-project/lotus/issues/12414 and pre change that lead to creation of this issue), where it took significantly less time to get that beacon information (the results are identical).

Logging Information

Lotus v1.29.2-rc1

❯ time curl --silent -X POST -H "Content-Type: application/json" \
             --data '{"jsonrpc":"2.0","id":2,"method":"Filecoin.StateGetBeaconEntry","params": [ 1 ] }' \
             "http://127.0.0.1:1234/rpc/v1"
{"id":2,"jsonrpc":"2.0","result":{"Round":2396511,"Data":"okAr/DU2fJ9WFpyqunhK3kkI6Z6dG5uZqBk+kfcEYXSTYIbHLL/y5ka0ZRopqAdEGAfODlP4wUaYnWh0c1COMWBtkfFGXBWGc15oU8LTDs2oZB9Sr/DNkfTQLJD9BtcA"}}

________________________________________________________
Executed in  184.56 secs      fish           external
   usr time    7.72 millis    0.00 micros    7.72 millis
   sys time    4.42 millis  566.00 micros    3.86 millis

Lotus v1.28.0 in comparison:

❯ time curl --silent -X POST -H "Content-Type: application/json" \
             --data '{"jsonrpc":"2.0","id":2,"method":"Filecoin.StateGetBeaconEntry","params": [ 1 ] }' \
             "http://127.0.0.1:1234/rpc/v1"
{"id":2,"jsonrpc":"2.0","result":{"Round":2396511,"Data":"okAr/DU2fJ9WFpyqunhK3kkI6Z6dG5uZqBk+kfcEYXSTYIbHLL/y5ka0ZRopqAdEGAfODlP4wUaYnWh0c1COMWBtkfFGXBWGc15oU8LTDs2oZB9Sr/DNkfTQLJD9BtcA"}}

________________________________________________________
Executed in  277.03 millis    fish           external
   usr time    6.21 millis    0.00 micros    6.21 millis
   sys time    4.93 millis  771.00 micros    4.16 millis


LesnyRumcajs avatar Sep 30 '24 09:09 LesnyRumcajs