Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optimize block start time #867

Merged
merged 12 commits into from
Apr 12, 2023
Merged

Conversation

huangminghuang
Copy link
Contributor

@huangminghuang huangminghuang commented Mar 22, 2023

This PR optimizes the start times for block producing. Before this PR, a producer always starts producing each block at the time point of the multiple of config::block_interval_us (i.e. 500 ms) and spend at most cpu-effort-percent (i.e. 80 by default, so it is 400 ms out of 500 ms) to produce each block. Therefore it leaves 100 ms idle time in between each block producing. In this PR, we leave no gap in between block producing so that the last block in each production round can reach the next producer earlier so that the next producer can start producing on schedule.

Removed configuration options:

  • produce-time-offset-us
  • last-block-time
  • last-block-cpu-percent

The schema for Runtime_Options has changed to

struct runtime_options {
      std::optional<int32_t>   max_transaction_time;
      std::optional<int32_t>   max_irreversible_block_age;
      std::optional<int32_t>   cpu_effort_us;
      std::optional<int32_t>   max_scheduled_transaction_time_per_block_ms;
      std::optional<int32_t>   subjective_cpu_leeway_us;
      std::optional<double>    incoming_defer_ratio;
      std::optional<uint32_t>  greylist_limit;
   };

Resolves #726


add_executable( test_block_timing_util test_block_timing_util.cpp )
target_link_libraries( test_block_timing_util producer_plugin eosio_testing )
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should this have been add_test()ed?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed by 6ee7e1f

@heifner heifner added the OCI Work exclusive to OCI team label Mar 23, 2023
@heifner heifner changed the title optimize block start time Optimize block start time Mar 23, 2023
@heifner
Copy link
Member

heifner commented Mar 23, 2023

info 2023-03-23T14:06:34.304 nodeos producer_plugin.cpp:2700 produce_block ] Produced block ccc88fbdd3f57610... #155 @ 2023-03-23T14:06:35.500 signed by defproducerc [trxs: 0, lib: 95, confirmed: 0, net: 0, cpu: 100, elapsed: 145, time: 4841]
This is the 12th block of the round. It is produced ~1.2 seconds early as expected by default 80% cpu-effort. The first block of the round was produced ~100ms early as expected.

plugins/producer_plugin/producer_plugin.cpp Outdated Show resolved Hide resolved
plugins/producer_plugin/producer_plugin.cpp Outdated Show resolved Hide resolved
plugins/producer_plugin/producer_plugin.cpp Outdated Show resolved Hide resolved
plugins/producer_plugin/producer_plugin.cpp Show resolved Hide resolved
@heifner heifner added the documentation Improvements or additions to documentation label Mar 29, 2023
@stephenpdeos stephenpdeos added this to the Leap v5.0.0-rc1 milestone Apr 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation OCI Work exclusive to OCI team
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

Optimize block start & release timing
5 participants