From 1cf37f7e23d6f5507f0b308c26875be7fa80653d Mon Sep 17 00:00:00 2001 From: Mihajlo Pavlovic Date: Tue, 16 Jul 2024 10:09:46 +0200 Subject: [PATCH 1/4] Increase number of service agreements for commits fetched from DB --- .../sequelize/repositories/service-agreement-repository.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/modules/repository/implementation/sequelize/repositories/service-agreement-repository.js b/src/modules/repository/implementation/sequelize/repositories/service-agreement-repository.js index 062a6876e..7d967e335 100644 --- a/src/modules/repository/implementation/sequelize/repositories/service-agreement-repository.js +++ b/src/modules/repository/implementation/sequelize/repositories/service-agreement-repository.js @@ -190,7 +190,7 @@ class ServiceAgreementRepository { ['scoreFunctionId', 'DESC'], [Sequelize.col('timeLeftInSubmitCommitWindow'), 'ASC'], ], - limit: 100, + limit: 500, raw: true, }); } From f1f8e46f059667b35f420e915630831a0991683d Mon Sep 17 00:00:00 2001 From: Mihajlo Pavlovic Date: Tue, 16 Jul 2024 10:10:36 +0200 Subject: [PATCH 2/4] Increase number of service agreements for commits fetched from DB --- .../sequelize/repositories/service-agreement-repository.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/modules/repository/implementation/sequelize/repositories/service-agreement-repository.js b/src/modules/repository/implementation/sequelize/repositories/service-agreement-repository.js index 7d967e335..813cf7be5 100644 --- a/src/modules/repository/implementation/sequelize/repositories/service-agreement-repository.js +++ b/src/modules/repository/implementation/sequelize/repositories/service-agreement-repository.js @@ -249,7 +249,7 @@ class ServiceAgreementRepository { ['scoreFunctionId', 'DESC'], [Sequelize.col('timeLeftInSubmitProofWindow'), 'ASC'], ], - limit: 100, + limit: 500, raw: true, }); } From dd4ec5b918a25e7921a62931096a2fce4cdc8864 Mon Sep 17 00:00:00 2001 From: Mihajlo Pavlovic Date: Tue, 16 Jul 2024 11:04:01 +0200 Subject: [PATCH 3/4] Increse limit and command queue pararelism --- .../common/epoch-check/blockchain-epoch-check-command.js | 2 +- src/constants/constants.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/commands/protocols/common/epoch-check/blockchain-epoch-check-command.js b/src/commands/protocols/common/epoch-check/blockchain-epoch-check-command.js index baea3a9ec..f125f730b 100644 --- a/src/commands/protocols/common/epoch-check/blockchain-epoch-check-command.js +++ b/src/commands/protocols/common/epoch-check/blockchain-epoch-check-command.js @@ -54,7 +54,7 @@ class BlockchainEpochCheckCommand extends Command { // We don't expect to have this many transactions in one epoch check window. // This is just to make sure we don't schedule too many commands and block the queue // TODO: find general solution for all commands scheduling blockchain transactions - totalTransactions = Math.min(totalTransactions, COMMAND_QUEUE_PARALLELISM * 0.3); + totalTransactions = Math.min(totalTransactions, Math.floor(COMMAND_QUEUE_PARALLELISM / 3)); const transactionQueueLength = this.blockchainModuleManager.getTotalTransactionQueueLength(blockchain); diff --git a/src/constants/constants.js b/src/constants/constants.js index ea771a96f..e06bf467a 100644 --- a/src/constants/constants.js +++ b/src/constants/constants.js @@ -555,7 +555,7 @@ export const ARCHIVE_UPDATE_RESPONSES_FOLDER = 'update_responses'; * How many commands will run in parallel * @type {number} */ -export const COMMAND_QUEUE_PARALLELISM = 100; +export const COMMAND_QUEUE_PARALLELISM = 150; export const GET_LATEST_SERVICE_AGREEMENT_BATCH_SIZE = 50; From a089d05ff4e57dfa6875690516215766c6e76d0b Mon Sep 17 00:00:00 2001 From: Mihajlo Pavlovic Date: Wed, 17 Jul 2024 15:20:58 +0200 Subject: [PATCH 4/4] Add dynamic scaling factor when scheduling commits and proofs --- .../common/epoch-check/blockchain-epoch-check-command.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/commands/protocols/common/epoch-check/blockchain-epoch-check-command.js b/src/commands/protocols/common/epoch-check/blockchain-epoch-check-command.js index f125f730b..3374cc680 100644 --- a/src/commands/protocols/common/epoch-check/blockchain-epoch-check-command.js +++ b/src/commands/protocols/common/epoch-check/blockchain-epoch-check-command.js @@ -51,10 +51,15 @@ class BlockchainEpochCheckCommand extends Command { command.period, ); + const numberOfBlockchains = this.blockchainModuleManager.getImplementations().length(); + // We don't expect to have this many transactions in one epoch check window. // This is just to make sure we don't schedule too many commands and block the queue // TODO: find general solution for all commands scheduling blockchain transactions - totalTransactions = Math.min(totalTransactions, Math.floor(COMMAND_QUEUE_PARALLELISM / 3)); + totalTransactions = Math.min( + totalTransactions, + Math.floor(COMMAND_QUEUE_PARALLELISM / numberOfBlockchains), + ); const transactionQueueLength = this.blockchainModuleManager.getTotalTransactionQueueLength(blockchain);