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

Interleave CPU-heavy operations with I/O events in the sync service #2213

Merged
merged 6 commits into from
Apr 7, 2022

Conversation

tomaka
Copy link
Contributor

@tomaka tomaka commented Apr 6, 2022

Fix #2209

Right now, if the sync service is verifying a warp sync proof, in the meanwhile it doesn't respond to any event anymore.
This causes queues of operations to grow in size, and thus in latency, which causes other kind of small problems to manifest.

This PR makes sure that the sync service processes events at a certain minimum rate by interleaving CPU-heavy operations with responding to events.

Copy link
Contributor

@mergify mergify bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Automatically approving tomaka's pull requests. This auto-approval will be removed once more maintainers are active.

@github-actions
Copy link
Contributor

github-actions bot commented Apr 6, 2022

twiggy diff report

Difference in .wasm size before and after this pull request.


 Delta Bytes │ Item
─────────────┼────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
       -4167 ┊ <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll::hfb4c5951913870cd
       +4103 ┊ <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll::h94180dc30396580a
       -3443 ┊ <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll::h733cb794077df532
       +3230 ┊ smoldot_light_base::sync_service::standalone::Task<TPlat>::process_one_verification_queue::h30343c6c657d4d14
       -2303 ┊ smoldot_light_base::sync_service::standalone::Task<TPlat>::start_requests::h3264895ac85ea711
       +2290 ┊ smoldot_light_base::sync_service::standalone::Task<TPlat>::start_next_request::h9cfbbc752ef6b23e
       +1172 ┊ smoldot::trie::proof_verify::trie_node_info::h0b479b94d153e5c1
       -1172 ┊ smoldot::trie::proof_verify::trie_node_info::h723ba75b5cbe223d
        -494 ┊ <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll::h8c5cb3e97ab97b8c
        +494 ┊ <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll::hf21dcae13a697619
        +446 ┊ <futures_util::future::poll_fn::PollFn<F> as core::future::future::Future>::poll::h1d7968f5a03f5126
        -411 ┊ core::ptr::drop_in_place<core::future::from_generator::GenFuture<smoldot_light_base::sync_service::standalone::start_standalone_chain<smoldot_light_wasm::platform::Platform>::{{closure}}>>::haa7c6d8ff3b3e7ab
        -407 ┊ <futures_util::future::poll_fn::PollFn<F> as core::future::future::Future>::poll::hbd0534ce5ff75b87
        +325 ┊ <core::iter::adapters::map::Map<I,F> as core::iter::traits::iterator::Iterator>::try_fold::h29e6e3b999a10a12
        -325 ┊ <core::iter::adapters::map::Map<I,F> as core::iter::traits::iterator::Iterator>::try_fold::h5f66d5ed81e0af1b
        +283 ┊ <core::iter::adapters::map::Map<I,F> as core::iter::traits::iterator::Iterator>::fold::h7a2e50ebe0b44c90
        -283 ┊ <core::iter::adapters::map::Map<I,F> as core::iter::traits::iterator::Iterator>::fold::hd6c9759714b63b7d
        +257 ┊ <alloc::vec::Vec<T> as alloc::vec::spec_from_iter_nested::SpecFromIterNested<T,I>>::from_iter::hd3810be0be5cc2aa
        -257 ┊ <alloc::vec::Vec<T> as alloc::vec::spec_from_iter_nested::SpecFromIterNested<T,I>>::from_iter::hf997972f5c575e93
        +247 ┊ <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll::h08c3638a3e837ad2
         -10 ┊ ... and 94 more.
       -1500 ┊ Σ [114 Total Rows]

bin/light-base/src/sync_service/standalone.rs Show resolved Hide resolved
bin/light-base/src/sync_service/standalone.rs Show resolved Hide resolved
bin/light-base/src/sync_service/standalone.rs Show resolved Hide resolved
Err(())
}
};
.map_err(|_| ())
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😮

@tomaka tomaka added the automerge Automatically merge pull request as soon as possible label Apr 7, 2022
@mergify mergify bot merged commit 9f0d9cb into paritytech:main Apr 7, 2022
@tomaka tomaka deleted the sync-smoother branch April 7, 2022 06:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
automerge Automatically merge pull request as soon as possible
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Parachains can take a long time to initialize if relay chain sync service is busy
2 participants