From f716ca8e276d3b62ae033cf75dec316372adbbdc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marin=20Ver=C5=A1i=C4=87?= Date: Fri, 27 Oct 2023 13:28:47 +0300 Subject: [PATCH] [refactor]: change parameters to more optimal values determined with perf testing MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Marin Veršić --- cli/README.md | 2 +- config/iroha_test_config.json | 6 +++--- config/src/block_sync.rs | 2 +- config/src/sumeragi.rs | 6 +++--- configs/peer/config.json | 8 ++++---- configs/peer/genesis.json | 6 +++--- docs/source/references/config.md | 24 ++++++++++++------------ 7 files changed, 27 insertions(+), 27 deletions(-) diff --git a/cli/README.md b/cli/README.md index 9da57cc943e..05ee34bcb13 100644 --- a/cli/README.md +++ b/cli/README.md @@ -83,7 +83,7 @@ The environment variables replacing `config.json` should be passed as JSON strin
Expand to see the example ``` bash -IROHA_TORII="{\"P2P_ADDR\": \"127.0.0.1:1339\", \"API_URL\": \"127.0.0.1:8080\"}" IROHA_SUMERAGI="{\"TRUSTED_PEERS\": [{\"address\": \"127.0.0.1:1337\",\"public_key\": \"ed01201C61FAF8FE94E253B93114240394F79A607B7FA55F9E5A41EBEC74B88055768B\"},{\"address\": \"127.0.0.1:1338\",\"public_key\": \"ed0120CC25624D62896D3A0BFD8940F928DC2ABF27CC57CEFEB442AA96D9081AAE58A1\"},{\"address\": \"127.0.0.1:1339\",\"public_key\": \"ed0120FACA9E8AA83225CB4D16D67F27DD4F93FC30FFA11ADC1F5C88FD5495ECC91020\"},{\"address\": \"127.0.0.1:1340\",\"public_key\": \"ed01208E351A70B6A603ED285D666B8D689B680865913BA03CE29FB7D13A166C4E7F1F\"}]}" IROHA_KURA="{\"INIT_MODE\": \"strict\",\"BLOCK_STORE_PATH\": \"./storage\"}" IROHA_BLOCK_SYNC="{\"GOSSIP_PERIOD_MS\": 10000,\"BATCH_SIZE\": 2}" IROHA_PUBLIC_KEY="ed01201C61FAF8FE94E253B93114240394F79A607B7FA55F9E5A41EBEC74B88055768B" IROHA_PRIVATE_KEY="{\"digest_function\": \"ed25519\",\"payload\": \"282ED9F3CF92811C3818DBC4AE594ED59DC1A2F78E4241E31924E101D6B1FB831C61FAF8FE94E253B93114240394F79A607B7FA55F9E5A41EBEC74B88055768B\"}" IROHA_GENESIS="{\"ACCOUNT_PUBLIC_KEY\": \"ed01204CFFD0EE429B1BDD36B3910EC570852B8BB63F18750341772FB46BC856C5CAAF\",\"ACCOUNT_PRIVATE_KEY\": {\"digest_function\": \"ed25519\",\"payload\": \"D748E18CE60CB30DEA3E73C9019B7AF45A8D465E3D71BCC9A5EF99A008205E534CFFD0EE429B1BDD36B3910EC570852B8BB63F18750341772FB46BC856C5CAAF\"}}" ./iroha +IROHA_TORII="{\"P2P_ADDR\": \"127.0.0.1:1339\", \"API_URL\": \"127.0.0.1:8080\"}" IROHA_SUMERAGI="{\"TRUSTED_PEERS\": [{\"address\": \"127.0.0.1:1337\",\"public_key\": \"ed01201C61FAF8FE94E253B93114240394F79A607B7FA55F9E5A41EBEC74B88055768B\"},{\"address\": \"127.0.0.1:1338\",\"public_key\": \"ed0120CC25624D62896D3A0BFD8940F928DC2ABF27CC57CEFEB442AA96D9081AAE58A1\"},{\"address\": \"127.0.0.1:1339\",\"public_key\": \"ed0120FACA9E8AA83225CB4D16D67F27DD4F93FC30FFA11ADC1F5C88FD5495ECC91020\"},{\"address\": \"127.0.0.1:1340\",\"public_key\": \"ed01208E351A70B6A603ED285D666B8D689B680865913BA03CE29FB7D13A166C4E7F1F\"}]}" IROHA_KURA="{\"INIT_MODE\": \"strict\",\"BLOCK_STORE_PATH\": \"./storage\"}" IROHA_BLOCK_SYNC="{\"GOSSIP_PERIOD_MS\": 1000,\"BATCH_SIZE\": 2}" IROHA_PUBLIC_KEY="ed01201C61FAF8FE94E253B93114240394F79A607B7FA55F9E5A41EBEC74B88055768B" IROHA_PRIVATE_KEY="{\"digest_function\": \"ed25519\",\"payload\": \"282ED9F3CF92811C3818DBC4AE594ED59DC1A2F78E4241E31924E101D6B1FB831C61FAF8FE94E253B93114240394F79A607B7FA55F9E5A41EBEC74B88055768B\"}" IROHA_GENESIS="{\"ACCOUNT_PUBLIC_KEY\": \"ed01204CFFD0EE429B1BDD36B3910EC570852B8BB63F18750341772FB46BC856C5CAAF\",\"ACCOUNT_PRIVATE_KEY\": {\"digest_function\": \"ed25519\",\"payload\": \"D748E18CE60CB30DEA3E73C9019B7AF45A8D465E3D71BCC9A5EF99A008205E534CFFD0EE429B1BDD36B3910EC570852B8BB63F18750341772FB46BC856C5CAAF\"}}" ./iroha ```
diff --git a/config/iroha_test_config.json b/config/iroha_test_config.json index ad415a54587..f6b1a900a08 100644 --- a/config/iroha_test_config.json +++ b/config/iroha_test_config.json @@ -32,8 +32,8 @@ "public_key": "ed01208E351A70B6A603ED285D666B8D689B680865913BA03CE29FB7D13A166C4E7F1F" } ], - "COMMIT_TIME_LIMIT_MS": 2000, - "MAX_TRANSACTIONS_IN_BLOCK": 8192, + "COMMIT_TIME_LIMIT_MS": 120000, + "MAX_TRANSACTIONS_IN_BLOCK": 20, "ACTOR_CHANNEL_CAPACITY": 100, "GOSSIP_BATCH_SIZE": 500, "GOSSIP_PERIOD_MS": 1000, @@ -47,7 +47,7 @@ "FETCH_SIZE": 10 }, "BLOCK_SYNC": { - "GOSSIP_PERIOD_MS": 10000, + "GOSSIP_PERIOD_MS": 1000, "BLOCK_BATCH_SIZE": 4, "ACTOR_CHANNEL_CAPACITY": 100 }, diff --git a/config/src/block_sync.rs b/config/src/block_sync.rs index 6802fcce9c9..24771aba681 100644 --- a/config/src/block_sync.rs +++ b/config/src/block_sync.rs @@ -3,7 +3,7 @@ use iroha_config_base::derive::{Documented, Proxy}; use serde::{Deserialize, Serialize}; const DEFAULT_BLOCK_BATCH_SIZE: u32 = 4; -const DEFAULT_GOSSIP_PERIOD_MS: u64 = 10000; +const DEFAULT_GOSSIP_PERIOD_MS: u64 = 1000; const DEFAULT_ACTOR_CHANNEL_CAPACITY: u32 = 100; /// Configuration for `BlockSynchronizer`. diff --git a/config/src/sumeragi.rs b/config/src/sumeragi.rs index c6929d441d6..f76df6dc6b2 100644 --- a/config/src/sumeragi.rs +++ b/config/src/sumeragi.rs @@ -13,9 +13,9 @@ use self::default::*; /// Module with a set of default values. pub mod default { /// Default number of miliseconds the peer waits for transactions before creating a block. - pub const DEFAULT_BLOCK_TIME_MS: u64 = 2000; + pub const DEFAULT_BLOCK_TIME_MS: u64 = 1000; /// Default amount of time allocated for voting on a block before a peer can ask for a view change. - pub const DEFAULT_COMMIT_TIME_LIMIT_MS: u64 = 4000; + pub const DEFAULT_COMMIT_TIME_LIMIT_MS: u64 = 120000; /// Unused const. Should be removed in the future. pub const DEFAULT_ACTOR_CHANNEL_CAPACITY: u32 = 100; /// Default duration in ms between every transaction gossip. @@ -23,7 +23,7 @@ pub mod default { /// Default maximum number of transactions sent in single gossip message. pub const DEFAULT_GOSSIP_BATCH_SIZE: u32 = 500; /// Default maximum number of transactions in block. - pub const DEFAULT_MAX_TRANSACTIONS_IN_BLOCK: u32 = 2_u32.pow(9); + pub const DEFAULT_MAX_TRANSACTIONS_IN_BLOCK: u32 = 20; /// Default estimation of consensus duration. #[allow(clippy::integer_division)] diff --git a/configs/peer/config.json b/configs/peer/config.json index 02211ed3072..89d4668bac1 100644 --- a/configs/peer/config.json +++ b/configs/peer/config.json @@ -12,10 +12,10 @@ "SUMERAGI": { "KEY_PAIR": null, "PEER_ID": null, - "BLOCK_TIME_MS": 2000, + "BLOCK_TIME_MS": 1000, "TRUSTED_PEERS": null, - "COMMIT_TIME_LIMIT_MS": 4000, - "MAX_TRANSACTIONS_IN_BLOCK": 512, + "COMMIT_TIME_LIMIT_MS": 120000, + "MAX_TRANSACTIONS_IN_BLOCK": 20, "ACTOR_CHANNEL_CAPACITY": 100, "GOSSIP_BATCH_SIZE": 500, "GOSSIP_PERIOD_MS": 1000 @@ -28,7 +28,7 @@ "FETCH_SIZE": 10 }, "BLOCK_SYNC": { - "GOSSIP_PERIOD_MS": 10000, + "GOSSIP_PERIOD_MS": 1000, "BLOCK_BATCH_SIZE": 4, "ACTOR_CHANNEL_CAPACITY": 100 }, diff --git a/configs/peer/genesis.json b/configs/peer/genesis.json index 2ca5d0365ed..28fc71cd029 100644 --- a/configs/peer/genesis.json +++ b/configs/peer/genesis.json @@ -119,17 +119,17 @@ "Sequence": [ { "NewParameter": { - "Parameter": "?MaxTransactionsInBlock=512" + "Parameter": "?MaxTransactionsInBlock=20" } }, { "NewParameter": { - "Parameter": "?BlockTime=2000" + "Parameter": "?BlockTime=1000" } }, { "NewParameter": { - "Parameter": "?CommitTimeLimit=4000" + "Parameter": "?CommitTimeLimit=120000" } }, { diff --git a/docs/source/references/config.md b/docs/source/references/config.md index a3f4468ca4b..2b720df29b3 100644 --- a/docs/source/references/config.md +++ b/docs/source/references/config.md @@ -43,10 +43,10 @@ The following is the default configuration used by Iroha. "SUMERAGI": { "KEY_PAIR": null, "PEER_ID": null, - "BLOCK_TIME_MS": 2000, + "BLOCK_TIME_MS": 1000, "TRUSTED_PEERS": null, - "COMMIT_TIME_LIMIT_MS": 4000, - "MAX_TRANSACTIONS_IN_BLOCK": 512, + "COMMIT_TIME_LIMIT_MS": 120000, + "MAX_TRANSACTIONS_IN_BLOCK": 20, "ACTOR_CHANNEL_CAPACITY": 100, "GOSSIP_BATCH_SIZE": 500, "GOSSIP_PERIOD_MS": 1000 @@ -59,7 +59,7 @@ The following is the default configuration used by Iroha. "FETCH_SIZE": 10 }, "BLOCK_SYNC": { - "GOSSIP_PERIOD_MS": 10000, + "GOSSIP_PERIOD_MS": 1000, "BLOCK_BATCH_SIZE": 4, "ACTOR_CHANNEL_CAPACITY": 100 }, @@ -141,7 +141,7 @@ Has type `Option`[^1]. Can be configured via env { "ACTOR_CHANNEL_CAPACITY": 100, "BLOCK_BATCH_SIZE": 4, - "GOSSIP_PERIOD_MS": 10000 + "GOSSIP_PERIOD_MS": 1000 } ``` @@ -172,7 +172,7 @@ The period of time to wait between sending requests for the latest block. Has type `Option`[^1]. Can be configured via environment variable `BLOCK_SYNC_GOSSIP_PERIOD_MS` ```json -10000 +1000 ``` ## `disable_panic_terminal_colors` @@ -522,12 +522,12 @@ Has type `Option>`[^1]. Can be configured via ```json { "ACTOR_CHANNEL_CAPACITY": 100, - "BLOCK_TIME_MS": 2000, - "COMMIT_TIME_LIMIT_MS": 4000, + "BLOCK_TIME_MS": 1000, + "COMMIT_TIME_LIMIT_MS": 120000, "GOSSIP_BATCH_SIZE": 500, "GOSSIP_PERIOD_MS": 1000, "KEY_PAIR": null, - "MAX_TRANSACTIONS_IN_BLOCK": 512, + "MAX_TRANSACTIONS_IN_BLOCK": 20, "PEER_ID": null, "TRUSTED_PEERS": null } @@ -550,7 +550,7 @@ The period of time a peer waits for the `CreatedBlock` message after getting a ` Has type `Option`[^1]. Can be configured via environment variable `SUMERAGI_BLOCK_TIME_MS` ```json -2000 +1000 ``` ### `sumeragi.commit_time_limit_ms` @@ -560,7 +560,7 @@ The period of time a peer waits for `CommitMessage` from the proxy tail. Has type `Option`[^1]. Can be configured via environment variable `SUMERAGI_COMMIT_TIME_LIMIT_MS` ```json -4000 +120000 ``` ### `sumeragi.gossip_batch_size` @@ -600,7 +600,7 @@ The upper limit of the number of transactions per block. Has type `Option`[^1]. Can be configured via environment variable `SUMERAGI_MAX_TRANSACTIONS_IN_BLOCK` ```json -512 +20 ``` ### `sumeragi.peer_id`