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

pool channel capacity #3989

Merged
merged 2 commits into from
May 26, 2023
Merged
Show file tree
Hide file tree
Changes from all 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
10 changes: 7 additions & 3 deletions massa-models/src/config/constants.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ lazy_static::lazy_static! {
/// node version
pub static ref VERSION: Version = {
if cfg!(feature = "sandbox") {
"SAND.22.1"
"SAND.23.0"
} else {
"TEST.23.0"
}
Expand Down Expand Up @@ -225,8 +225,12 @@ pub const MAX_BOOTSTRAP_ERROR_LENGTH: u64 = 10000;
pub const PROTOCOL_CONTROLLER_CHANNEL_SIZE: usize = 1024;
/// Protocol event channel size
pub const PROTOCOL_EVENT_CHANNEL_SIZE: usize = 1024;
/// Pool controller channel size
pub const POOL_CONTROLLER_CHANNEL_SIZE: usize = 1024;
/// Pool controller operations channel size
pub const POOL_CONTROLLER_OPERATIONS_CHANNEL_SIZE: usize = 1024;
/// Pool controller endorsements channel size
pub const POOL_CONTROLLER_ENDORSEMENTS_CHANNEL_SIZE: usize = 1024;
/// Pool controller denunciations channel size
pub const POOL_CONTROLLER_DENUNCIATIONS_CHANNEL_SIZE: usize = 1024;

// ***********************
// Constants used for execution module (injected from ConsensusConfig)
Expand Down
16 changes: 10 additions & 6 deletions massa-node/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,14 @@ use massa_models::config::constants::{
MAX_SIZE_CHANNEL_NETWORK_TO_ENDORSEMENT_HANDLER, MAX_SIZE_CHANNEL_NETWORK_TO_OPERATION_HANDLER,
MAX_SIZE_CHANNEL_NETWORK_TO_PEER_HANDLER, MIP_STORE_STATS_BLOCK_CONSIDERED,
MIP_STORE_STATS_COUNTERS_MAX, OPERATION_VALIDITY_PERIODS, PERIODS_PER_CYCLE,
POOL_CONTROLLER_CHANNEL_SIZE, POS_MISS_RATE_DEACTIVATION_THRESHOLD, POS_SAVED_CYCLES,
PROTOCOL_CONTROLLER_CHANNEL_SIZE, PROTOCOL_EVENT_CHANNEL_SIZE,
ROLL_COUNT_TO_SLASH_ON_DENUNCIATION, ROLL_PRICE, SELECTOR_DRAW_CACHE_SIZE, T0, THREAD_COUNT,
VERSION,
POS_MISS_RATE_DEACTIVATION_THRESHOLD, POS_SAVED_CYCLES, PROTOCOL_CONTROLLER_CHANNEL_SIZE,
PROTOCOL_EVENT_CHANNEL_SIZE, ROLL_COUNT_TO_SLASH_ON_DENUNCIATION, ROLL_PRICE,
SELECTOR_DRAW_CACHE_SIZE, T0, THREAD_COUNT, VERSION,
};
use massa_models::config::{
MAX_MESSAGE_SIZE, POOL_CONTROLLER_DENUNCIATIONS_CHANNEL_SIZE,
POOL_CONTROLLER_ENDORSEMENTS_CHANNEL_SIZE, POOL_CONTROLLER_OPERATIONS_CHANNEL_SIZE,
};
use massa_models::config::MAX_MESSAGE_SIZE;
use massa_pool_exports::{PoolChannels, PoolConfig, PoolManager};
use massa_pool_worker::start_pool_controller;
use massa_pos_exports::{PoSConfig, SelectorConfig, SelectorManager};
Expand Down Expand Up @@ -498,7 +500,9 @@ async fn launch(
max_operations_per_block: MAX_OPERATIONS_PER_BLOCK,
max_operation_pool_size_per_thread: SETTINGS.pool.max_pool_size_per_thread,
max_endorsements_pool_size_per_thread: SETTINGS.pool.max_pool_size_per_thread,
channels_size: POOL_CONTROLLER_CHANNEL_SIZE,
operations_channel_size: POOL_CONTROLLER_OPERATIONS_CHANNEL_SIZE,
endorsements_channel_size: POOL_CONTROLLER_ENDORSEMENTS_CHANNEL_SIZE,
denunciations_channel_size: POOL_CONTROLLER_DENUNCIATIONS_CHANNEL_SIZE,
broadcast_enabled: SETTINGS.api.enable_broadcast,
broadcast_endorsements_channel_capacity: SETTINGS
.pool
Expand Down
8 changes: 6 additions & 2 deletions massa-pool-exports/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,12 @@ pub struct PoolConfig {
pub max_endorsements_pool_size_per_thread: usize,
/// max number of endorsements per block
pub max_block_endorsement_count: u32,
/// operations and endorsements communication channels size
pub channels_size: usize,
/// operations channel capacity
pub operations_channel_size: usize,
/// endorsements channel capacity
pub endorsements_channel_size: usize,
/// denunciations channel capacity
pub denunciations_channel_size: usize,
/// whether operations broadcast is enabled
pub broadcast_enabled: bool,
/// endorsements channel capacity
Expand Down
4 changes: 3 additions & 1 deletion massa-pool-exports/src/test_exports/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@ impl Default for PoolConfig {
max_endorsements_pool_size_per_thread: 1000,
max_operations_per_block: MAX_OPERATIONS_PER_BLOCK,
max_block_endorsement_count: ENDORSEMENT_COUNT,
channels_size: 1024,
operations_channel_size: 1024,
endorsements_channel_size: 1024,
denunciations_channel_size: 1024,
broadcast_enabled: false,
broadcast_endorsements_channel_capacity: 2000,
broadcast_operations_channel_capacity: 5000,
Expand Down
7 changes: 4 additions & 3 deletions massa-pool-worker/src/worker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -182,11 +182,12 @@ pub fn start_pool_controller(
// denunciation_factory_tx: Sender<DenunciationPrecursor>,
// denunciation_factory_rx: Receiver<DenunciationPrecursor>,
) -> (Box<dyn PoolManager>, Box<dyn PoolController>) {
let (operations_input_sender, operations_input_receiver) = sync_channel(config.channels_size);
let (operations_input_sender, operations_input_receiver) =
sync_channel(config.operations_channel_size);
let (endorsements_input_sender, endorsements_input_receiver) =
sync_channel(config.channels_size);
sync_channel(config.endorsements_channel_size);
let (denunciations_input_sender, denunciations_input_receiver) =
sync_channel(config.channels_size);
sync_channel(config.denunciations_channel_size);
let operation_pool = Arc::new(RwLock::new(OperationPool::init(
config,
storage,
Expand Down