steemit / steem

The blockchain for Smart Media Tokens (SMTs) and decentralized applications.
https://steem.com
Other
1.95k stars 793 forks source link

Minimize Dynamic Fields in Objects #1592

Open mvandeberg opened 7 years ago

mvandeberg commented 7 years ago

Dynamic fields in objects are costly because when moving between undo states, those objects are copied and have to use the memory mapped file memory allocator.

This is not a huge concern when reindexing because we do not use undo states, but when live an syncing, this can be a huge cost. (On appbase steemdsync we are averaging 1.9 blocks/sec syncing the most recent 10k blocks)

Plugins, on the other hand, do utilize undo states for custom ops because bad ops cannot be rejected by the blockchain.

Below are all objects with dynamic fields. For each dynamic field we should provide justification for the field and, if possible, refactor the objects such that dynamic fields do not live in objects that have frequent modifications. This requires moving either dynamic or hot data out of the object in question

Consensus:

__account_object:__

account_authority_object:

__owner_authority_history_object:__

__account_recovery_request_object:__

__comment_object:__

comment_content_object:

hardfork_property_object:

__history_object:__

savings_withdraw_object:

feed_history_object:

__transaction_object:__

__witness_object:__

Follow Plugin:

__feed_object:__

mvandeberg commented 7 years ago

As much as the comment implies the by_parent index on comment objects is consensus, it does not appear so which means that parent_author and parent_permlink can be replaces by comment_id_type parent.

Such a refactor directly impacts the efficacy of #1595