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

[Feature request] Use several zcash-msghand threads #4142

Open
ytrezq opened this issue Sep 21, 2019 · 4 comments
Open

[Feature request] Use several zcash-msghand threads #4142

ytrezq opened this issue Sep 21, 2019 · 4 comments
Labels
I-performance Problems and improvements with respect to performance

Comments

@ytrezq
Copy link

ytrezq commented Sep 21, 2019

Using a single thread currently cap syncing at 4Mb per seconds on a Cascade Lake cpu (one of the fastest per thread performance in the world). But if different unrelated messages could be processed in parallel nothing would prevent things going 10 times faster for those who have a optical fibre connection.

This would be especially useful for faster syncing (since the process is cpu bound because of this thread).
Of course, I’m talking with the fast syncing option enabled.

@tromer
Copy link
Contributor

tromer commented Sep 21, 2019

Syncing up seems inherently sequential: the validity of every transaction depends on the latest state after taking into account all prior transactions (within this block and prior ones).

This can be partially parallelized: some parts of the transaction verification don't depend on prior state (e.g., checking signatures). But it may be architecturally difficult to separate the two and orchestrate everything reliably, including correctly handling rollbacks.

@Eirik0
Copy link
Contributor

Eirik0 commented Oct 7, 2019

Yes, @tromer is correct that syncing blocks is an inherently sequential operation. While there may be a way to parallelize this, it is unlikely that this will be included in zcashd in the short-term.

@ytrezq
Copy link
Author

ytrezq commented Oct 9, 2019

@Eirik0 : what about thinking that most of the time the info provided by a node is ok (treat everything as valid) in order to go ahead for the next transactions and roll back if a transaction appears to be finally invalid ?

This would allows several threads while fetching them transactions in the right order but in batch (which requires a batch of transactions to complete in order to start the next one).

@daira
Copy link
Contributor

daira commented Oct 10, 2019

It's quite a bit more complicated than that. In order to optimistically validate a transaction, you need to know what its transparent inputs are, which requires you to have validated the transaction(s) with corresponding transparent outputs. There are opportunities for parallelism if you could completely redesign how validation is implemented, but realistically we're not going to do that just for t-addresses: we're more likely to remove transparent address support entirely and (if we're funded to do so) use recursive SNARKs to scale the validation of the shielded protocol.

You can handle signature and proof validation optimistically. However, for transactions before the latest known checkpoint, we already assume that signatures and proofs are valid. So this wouldn't help syncing.

@daira daira added the I-performance Problems and improvements with respect to performance label Oct 10, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
I-performance Problems and improvements with respect to performance
Projects
None yet
Development

No branches or pull requests

4 participants