From ff2e7dbd355cc0d9762acde29ad38aa8652a0563 Mon Sep 17 00:00:00 2001 From: Alexandru Gheorghe <49718502+alexggh@users.noreply.github.com> Date: Tue, 30 Jan 2024 11:05:54 +0200 Subject: [PATCH] Move candidate-validation on blocking tasks (#3122) Candidate validation has a lot of operations that are cpu bound on its main loop things, like: ``` validation_code.hash() sp_maybe_compressed_blob::decompress( &validation_code.0, VALIDATION_CODE_BOMB_LIMIT, ) sp_maybe_compressed_blob::decompress(&pov.block_data.0, POV_BOMB_LIMIT) let code_hash = sp_crypto_hashing::blake2_256(&code).into(); ``` When you add all that you for large POV and CODE it is going to take in the order of 10s of ms and because these are cpu bound operation it is going to hog the executor thread and negatively affect other subsystems around it, so it is better to just move the subsystem on the blocking pool to make sure such unexpected behaviour is avoided. Note! In practice this subsystem does not have a high number of work to be done, so probably the impact of it is really low, but better safe than sorry. Signed-off-by: Alexandru Gheorghe --- polkadot/node/overseer/src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/polkadot/node/overseer/src/lib.rs b/polkadot/node/overseer/src/lib.rs index f4eddf1f41..e16a3fd27a 100644 --- a/polkadot/node/overseer/src/lib.rs +++ b/polkadot/node/overseer/src/lib.rs @@ -465,7 +465,7 @@ pub async fn forward_events>(client: Arc

, mut hand message_capacity=2048, )] pub struct Overseer { - #[subsystem(CandidateValidationMessage, sends: [ + #[subsystem(blocking, CandidateValidationMessage, sends: [ RuntimeApiMessage, ])] candidate_validation: CandidateValidation,