Improve performance of database::update_expired_feeds()
#1093
Labels
2d Developing
Status indicating currently designing and developing a solution
3c Enhancement
Classification indicating a change to the functionality of the existing imlementation
4b Normal Priority
Priority indicating the moderate impact to system/user -OR- existing workaround is costly to perform
6 Performance
Impacts flag identifying system/user efficiency, performance, etc.
9c Large
Effort estimation indicating TBD
performance
Milestone
According to profiling data mentioned in #1083,
update_expired_feeds()
plays a significant role while replaying.The 11th entry
database::update_expired_feeds()
is it itself;the 7th entry
index<asset_bitasset_data_object>::find()
is caused by it here:bitshares-core/libraries/chain/db_update.cpp
Line 483 in 06aee78
the 9th entry
index<asset_object>::find()
is caused by it due to an unnecessary call here:bitshares-core/libraries/chain/db_update.cpp
Line 494 in 06aee78
These 3 entries sum up to 10% of replay time.
Current code iterates through all
asset_object
s who is a bit asset or a prediction market on every new block, then fetch theirasset_bitasset_data_object
, then check if feed is expired. However, we have more than500
bit assets / prediction markets on the chain now, it's inefficient to iterate through them all on every block.Another issue is related to cryptonomex/graphene#615. For the first
5,000,000
blocks or so,update_median_feeds()
is almost called for every bit asset on every block. Although the bug has been fixed with a hard fork, the buggy code is still there for processing blocks before the hard fork, thus wasting our time for every sync/replay.To optimize, things need to be done:
by_expiration
index inasset_bitasset_index
, only iterate through and process expired onesasset_update_operation
)This is a sub-task of #982.
The text was updated successfully, but these errors were encountered: