Skip to content
This repository has been archived by the owner on Aug 2, 2022. It is now read-only.

Make subjective_cpu_leeway a config option - 1.8 #8027

Merged
merged 3 commits into from
Oct 4, 2019
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions libraries/chain/include/eosio/chain/config.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ const static uint32_t default_max_block_cpu_usage = 200'000; /
const static uint32_t default_target_block_cpu_usage_pct = 10 * percent_1;
const static uint32_t default_max_transaction_cpu_usage = 3*default_max_block_cpu_usage/4; /// max trx cpu usage in microseconds
const static uint32_t default_min_transaction_cpu_usage = 100; /// min trx cpu usage in microseconds (10000 TPS equiv)
const static uint32_t default_subjective_cpu_leeway_us = 31000; /// default subjective cpu leeway in microseconds

const static uint32_t default_max_trx_lifetime = 60*60; // 1 hour
const static uint32_t default_deferred_trx_expiration_window = 10*60; // 10 minutes
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ namespace eosio { namespace chain {
bool enforce_whiteblacklist = true;

fc::time_point deadline = fc::time_point::maximum();
fc::microseconds leeway = fc::microseconds(3000);
fc::microseconds leeway = fc::microseconds( config::default_subjective_cpu_leeway_us );
int64_t billed_cpu_time_us = 0;
bool explicit_billed_cpu_time = false;

Expand Down
6 changes: 6 additions & 0 deletions plugins/producer_plugin/producer_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -615,6 +615,8 @@ void producer_plugin::set_program_options(
"offset of last block producing time in microseconds. Negative number results in blocks to go out sooner, and positive number results in blocks to go out later")
("max-scheduled-transaction-time-per-block-ms", boost::program_options::value<int32_t>()->default_value(100),
"Maximum wall-clock time, in milliseconds, spent retiring scheduled transactions in any block before returning to normal transaction processing.")
("subjective-cpu-leeway-us", boost::program_options::value<int32_t>()->default_value( config::default_subjective_cpu_leeway_us ),
larryk85 marked this conversation as resolved.
Show resolved Hide resolved
"Time in microseconds allowed for a transaction that starts with insufficient CPU quota to complete and cover its CPU usage.")
("incoming-defer-ratio", bpo::value<double>()->default_value(1.0),
"ratio between incoming transations and deferred transactions when both are exhausted")
("producer-threads", bpo::value<uint16_t>()->default_value(config::default_controller_thread_pool_size),
Expand Down Expand Up @@ -747,6 +749,10 @@ void producer_plugin::plugin_initialize(const boost::program_options::variables_

my->_max_scheduled_transaction_time_per_block_ms = options.at("max-scheduled-transaction-time-per-block-ms").as<int32_t>();

if( options.at( "subjective-cpu-leeway-us" ).as<int32_t>() != config::default_subjective_cpu_leeway_us ) {
larryk85 marked this conversation as resolved.
Show resolved Hide resolved
chain.set_subjective_cpu_leeway( fc::microseconds( options.at( "subjective-cpu-leeway-us" ).as<int32_t>() ) );
}

my->_max_transaction_time_ms = options.at("max-transaction-time").as<int32_t>();

my->_max_irreversible_block_age_us = fc::seconds(options.at("max-irreversible-block-age").as<int32_t>());
Expand Down