Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Updates for parallel processing #218

Merged
merged 10 commits into from
May 18, 2022

Conversation

peterbroadhurst
Copy link
Contributor

@peterbroadhurst peterbroadhurst commented May 16, 2022

Three related changes from analysis of some performance tests:

  1. The sendConcurrency setting is not currently providing the full concurrency support it was intended to. This is because the concurrencySlots channel was being allocated in the constructor of the TxnProcessor which is before SetConf is called. So we need to allocated it in Init(). This results in us using pipelining between the Send and in-flight nonce allocation, but not performing multiple Send calls in parallel.

  2. In the case that a Send fails due to an intermittent error, such as a timeout, this is problem for end-users because they do not know if the transaction was submitted or not. However, in cases where EthConnect is in control of the nonce it is safe for EthConnect to retry. So this PR introduces an option for retries, and enables these by default (with a small number - 5) to deal with glitches without pushing those errors all the way back to the requester.

  3. Currently the addressbook lookup is performed on the single-threaded processing, before we dispatch a concurrent worker to the inflight action. As there is a JSON/RPC healthcheck call that is part of this (net_version) this is inefficient. So this PR moves it to the concurrent worker, after inflight is generated.

Signed-off-by: Peter Broadhurst <peter.broadhurst@kaleido.io>
@codecov-commenter
Copy link

codecov-commenter commented May 16, 2022

Codecov Report

Merging #218 (0008bad) into main (442cfb3) will increase coverage by 0.05%.
The diff coverage is n/a.

@@            Coverage Diff             @@
##             main     #218      +/-   ##
==========================================
+ Coverage   97.15%   97.20%   +0.05%     
==========================================
  Files          70       70              
  Lines        7579     7661      +82     
==========================================
+ Hits         7363     7447      +84     
+ Misses        165      164       -1     
+ Partials       51       50       -1     
Impacted Files Coverage Δ
ethconnect/internal/tx/txnprocessor.go 100.00% <0.00%> (ø)
ethconnect/internal/tx/addressbook.go 100.00% <0.00%> (+2.66%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 442cfb3...0008bad. Read the comment docs.

Signed-off-by: Peter Broadhurst <peter.broadhurst@kaleido.io>
Signed-off-by: Peter Broadhurst <peter.broadhurst@kaleido.io>
Signed-off-by: Peter Broadhurst <peter.broadhurst@kaleido.io>
Signed-off-by: Peter Broadhurst <peter.broadhurst@kaleido.io>
# This is the 1st commit message:

Add concurrency debug

Signed-off-by: Peter Broadhurst <peter.broadhurst@kaleido.io>

# This is the commit message hyperledger#2:

Debug time in OnMessage

Signed-off-by: Peter Broadhurst <peter.broadhurst@kaleido.io>
Signed-off-by: Peter Broadhurst <peter.broadhurst@kaleido.io>
…g retry

Signed-off-by: Peter Broadhurst <peter.broadhurst@kaleido.io>
Signed-off-by: Peter Broadhurst <peter.broadhurst@kaleido.io>
@peterbroadhurst peterbroadhurst changed the title Perform the address book lookup and cached RPC healthcheck in parallel Updates for parallel processing May 17, 2022
@@ -133,6 +150,25 @@ func (p *txnProcessor) Init(rpc eth.RPCClient) {
if p.conf.HDWalletConf.URLTemplate != "" {
p.hdwallet = newHDWallet(&p.conf.HDWalletConf)
}
p.concurrencySlots = make(chan bool, p.conf.SendConcurrency)
Copy link
Contributor

Choose a reason for hiding this comment

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

After a discussion with @peterbroadhurst , I note that this needs to be setup in Init() because of the way this function and the caller of this function NewKafkaBridge() is called:

kafkaBridge := kafka.NewKafkaBridge(&dontPrintYaml)
kafkaBridge.SetConf(conf)

The config is set after the constructor is invoked, so setting it in the constructor doesn't have the intended effect.

Signed-off-by: Peter Broadhurst <peter.broadhurst@kaleido.io>
@peterbroadhurst peterbroadhurst merged commit c86cb21 into hyperledger:main May 18, 2022
@peterbroadhurst peterbroadhurst deleted the parallel-addrbook branch May 18, 2022 03:34
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants