From d3df42db4e34914bdee53316068975e59c82caac Mon Sep 17 00:00:00 2001 From: Chalith Desaman Date: Thu, 19 Aug 2021 19:10:54 +0530 Subject: [PATCH] Increased max queue limits from 64 to 254 (#344) --- src/comm/comm_session.cpp | 2 +- src/p2p/p2p.hpp | 14 +++++++------- src/sc/sc.hpp | 4 ++-- src/usr/read_req.cpp | 7 ++++--- 4 files changed, 14 insertions(+), 13 deletions(-) diff --git a/src/comm/comm_session.cpp b/src/comm/comm_session.cpp index da617700..9ca23fad 100644 --- a/src/comm/comm_session.cpp +++ b/src/comm/comm_session.cpp @@ -10,7 +10,7 @@ namespace comm { constexpr uint32_t INTERVALMS = 60000; constexpr uint32_t UNVERIFIED_INACTIVE_TIMEOUT = 5000; // Time threshold ms for unverified inactive connections. - constexpr uint16_t MAX_IN_MSG_QUEUE_SIZE = 64; // Maximum in message queue size, The size passed is rounded to next number in binary sequence 1(1),11(3),111(7),1111(15),11111(31).... + constexpr uint16_t MAX_IN_MSG_QUEUE_SIZE = 255; // Maximum in message queue size, The size passed is rounded to next number in binary sequence 1(1),11(3),111(7),1111(15),11111(31).... comm_session::comm_session( std::string_view host_address, hpws::client &&hpws_client, const bool is_inbound, const uint64_t (&metric_thresholds)[5]) diff --git a/src/p2p/p2p.hpp b/src/p2p/p2p.hpp index 96d5cb26..0708fb2c 100644 --- a/src/p2p/p2p.hpp +++ b/src/p2p/p2p.hpp @@ -14,13 +14,13 @@ namespace p2p { - constexpr uint16_t PROPOSAL_LIST_CAP = 128; // Maximum proposal count. - constexpr uint16_t NONUNL_PROPOSAL_LIST_CAP = 128; // Maximum nonunl proposal count. - constexpr uint16_t HPFS_REQ_LIST_CAP = 64; // Maximum state request count. - constexpr uint16_t HPFS_RES_LIST_CAP = 64; // Maximum state response count. + constexpr uint16_t PROPOSAL_LIST_CAP = 255; // Maximum proposal count. + constexpr uint16_t NONUNL_PROPOSAL_LIST_CAP = 255; // Maximum nonunl proposal count. + constexpr uint16_t HPFS_REQ_LIST_CAP = 255; // Maximum state request count. + constexpr uint16_t HPFS_RES_LIST_CAP = 255; // Maximum state response count. + constexpr uint16_t LOG_RECORD_REQ_LIST_CAP = 255; // Maximum log record request count. + constexpr uint16_t LOG_RECORD_RES_LIST_CAP = 255; // Maximum log record response count. constexpr uint16_t PEER_LIST_CAP = 128; // Maximum peer count. - constexpr uint16_t LOG_RECORD_REQ_LIST_CAP = 64; // Maximum log record request count. - constexpr uint16_t LOG_RECORD_RES_LIST_CAP = 64; // Maximum log record response count. // Struct to represent information about a peer. // Initially available capacity is set to -1 and timestamp is set to 0. @@ -37,7 +37,7 @@ namespace p2p { std::string pubkey; util::h32 root_hash; // The proposal root hash (hash of all the proposal consensus fields). Only populated for incoming proposals. - bool from_self; // Whether the proposal was sent by this node itself. Only populated for incoming proposals. + bool from_self; // Whether the proposal was sent by this node itself. Only populated for incoming proposals. uint64_t sent_timestamp = 0; // The timestamp of the sender when this proposal was sent. uint64_t recv_timestamp = 0; // The timestamp when we received the proposal. (used for network statistics) diff --git a/src/sc/sc.hpp b/src/sc/sc.hpp index f7b40edb..b339b048 100644 --- a/src/sc/sc.hpp +++ b/src/sc/sc.hpp @@ -16,8 +16,8 @@ */ namespace sc { - constexpr uint16_t MAX_NPL_MSG_QUEUE_SIZE = 64; // Maximum npl message queue size, The size passed is rounded to next number in binary sequence 1(1),11(3),111(7),1111(15),11111(31).... - constexpr uint16_t MAX_CONTROL_MSG_QUEUE_SIZE = 64; // Maximum out message queue size, The size passed is rounded to next number in binary sequence 1(1),11(3),111(7),1111(15),11111(31).... + constexpr uint16_t MAX_NPL_MSG_QUEUE_SIZE = 255; // Maximum npl message queue size, The size passed is rounded to next number in binary sequence 1(1),11(3),111(7),1111(15),11111(31).... + constexpr uint16_t MAX_CONTROL_MSG_QUEUE_SIZE = 255; // Maximum out message queue size, The size passed is rounded to next number in binary sequence 1(1),11(3),111(7),1111(15),11111(31).... struct fd_pair { diff --git a/src/usr/read_req.cpp b/src/usr/read_req.cpp index 5a2db3ab..8045f73b 100644 --- a/src/usr/read_req.cpp +++ b/src/usr/read_req.cpp @@ -12,8 +12,8 @@ */ namespace read_req { - constexpr uint16_t LOOP_WAIT = 100; // Milliseconds. - constexpr uint16_t MAX_QUEUE_SIZE = 64; // Maximum read request queue size, The size passed is rounded up to the next multiple of the block size (32). + constexpr uint16_t LOOP_WAIT = 100; // Milliseconds. + constexpr uint16_t MAX_QUEUE_SIZE = 255; // Maximum read request queue size, The size passed is rounded up to the next multiple of the block size (32). bool is_shutting_down = false; bool init_success = false; @@ -229,7 +229,8 @@ namespace read_req */ void remove_thread(const pthread_t id) { - const auto iter = std::find_if(read_req_threads.begin(), read_req_threads.end(), [=](std::thread &t) { return (t.native_handle() == id); }); + const auto iter = std::find_if(read_req_threads.begin(), read_req_threads.end(), [=](std::thread &t) + { return (t.native_handle() == id); }); if (iter != read_req_threads.end()) { iter->join();