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

go/worker/txnscheduler: Support multiple txnscheduler workers #3184

Merged
merged 4 commits into from
Aug 20, 2020

Conversation

ptrus
Copy link
Member

@ptrus ptrus commented Aug 11, 2020

Fixes: #1654
Fixes: #1677

Adds support for multiple txnschedulers in runtime committees:

  • txnscheduler grpc endpoint removed, the per-runtime libp2p gossipsub is used for submitting transactions
  • current implementation: added LeadersInterval runtime parameter - txnschedulers switch between leaders in round-robin fashion (switching on each runtime round)
  • leader role removed from scheduler api
  • txnscheduler worker removed (merged into exectuor)
  • txnscheduler committee removed

TODO:

@ptrus ptrus force-pushed the ptrus/feature/multiple-txnschedulers branch from f90d071 to 99460e4 Compare August 11, 2020 15:55
@ptrus ptrus changed the title go/worker/txnscheduler: Support multiple txnscheduler workers. go/worker/txnscheduler: Support multiple txnscheduler workers Aug 11, 2020
@ptrus ptrus force-pushed the ptrus/feature/multiple-txnschedulers branch 2 times, most recently from 88f703b to ddb3838 Compare August 11, 2020 16:00
go/registry/api/api.go Outdated Show resolved Hide resolved
Copy link
Member

@kostko kostko left a comment

Choose a reason for hiding this comment

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

One thing to note, the commitment pool (pool.go) needs to make sure that the batch was proposed by the leader at the time the first commitment was received. I don't see any modifications to the consensus code here.

go/worker/compute/txnscheduler/committee/node.go Outdated Show resolved Hide resolved
go/worker/common/p2p/types.go Outdated Show resolved Hide resolved
go/worker/common/p2p/dispatch.go Show resolved Hide resolved
go/worker/common/p2p/p2p.go Show resolved Hide resolved
go/worker/common/p2p/dispatch.go Show resolved Hide resolved
go/worker/common/p2p/noop.go Outdated Show resolved Hide resolved
go/worker/common/p2p/peermgmt.go Outdated Show resolved Hide resolved
go/worker/common/p2p/peermgmt.go Outdated Show resolved Hide resolved
go/worker/compute/txnscheduler/committee/node.go Outdated Show resolved Hide resolved
go/worker/compute/txnscheduler/committee/node.go Outdated Show resolved Hide resolved
@ptrus ptrus force-pushed the ptrus/feature/multiple-txnschedulers branch 7 times, most recently from 416796c to 43fc3d4 Compare August 15, 2020 06:59
@codecov
Copy link

codecov bot commented Aug 15, 2020

Codecov Report

Merging #3184 into master will increase coverage by 0.01%.
The diff coverage is 72.84%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #3184      +/-   ##
==========================================
+ Coverage   67.45%   67.46%   +0.01%     
==========================================
  Files         380      371       -9     
  Lines       36474    36107     -367     
==========================================
- Hits        24603    24361     -242     
+ Misses       8701     8580     -121     
+ Partials     3170     3166       -4     
Impacted Files Coverage Δ
.../consensus/tendermint/apps/roothash/state/state.go 72.54% <ø> (+3.92%) ⬆️
go/registry/api/runtime.go 54.00% <ø> (ø)
go/runtime/committee/committee.go 55.55% <ø> (-23.24%) ⬇️
go/worker/common/p2p/peermgmt.go 75.38% <ø> (-0.74%) ⬇️
go/worker/compute/executor/committee/state.go 85.18% <ø> (ø)
go/worker/keymanager/worker.go 63.73% <0.00%> (ø)
go/registry/api/api.go 42.29% <12.00%> (-0.82%) ⬇️
go/oasis-node/cmd/registry/runtime/runtime.go 57.53% <33.33%> (-0.61%) ⬇️
...consensus/tendermint/apps/roothash/transactions.go 53.65% <37.50%> (-5.81%) ⬇️
go/oasis-node/cmd/node/node.go 55.82% <37.50%> (-0.31%) ⬇️
... and 69 more

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 2667194...16499ba. Read the comment docs.

Copy link
Member

@kostko kostko left a comment

Choose a reason for hiding this comment

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

So this removes the transaction scheduler worker but not the transaction scheduler committee? There is no need for a separate committee AFAIK, it makes more sense that one of the executor nodes is the transaction scheduler (proposer).

go/consensus/tendermint/apps/roothash/transactions.go Outdated Show resolved Hide resolved
go/consensus/tendermint/apps/scheduler/scheduler.go Outdated Show resolved Hide resolved
go/runtime/client/watcher.go Outdated Show resolved Hide resolved
go/runtime/client/watcher.go Outdated Show resolved Hide resolved
go/worker/common/committee/node.go Outdated Show resolved Hide resolved
@ptrus
Copy link
Member Author

ptrus commented Aug 16, 2020

So this removes the transaction scheduler worker but not the transaction scheduler committee? There is no need for a separate committee AFAIK, it makes more sense that one of the executor nodes is the transaction scheduler (proposer).

yeah but removing the committee will be straightforward so i left it for after i have the rest done :-)

@ptrus ptrus force-pushed the ptrus/feature/multiple-txnschedulers branch from 43fc3d4 to 24b1dfb Compare August 16, 2020 12:43
@ptrus ptrus force-pushed the ptrus/feature/multiple-txnschedulers branch 2 times, most recently from 4b6f595 to cf072ef Compare August 17, 2020 08:46
@ptrus ptrus force-pushed the ptrus/feature/multiple-txnschedulers branch 6 times, most recently from 90e4f15 to 0bf97c0 Compare August 17, 2020 15:34
go/consensus/tendermint/apps/roothash/transactions.go Outdated Show resolved Hide resolved
go/registry/api/runtime.go Outdated Show resolved Hide resolved
go/roothash/api/commitment/pool.go Outdated Show resolved Hide resolved
go/runtime/client/client.go Outdated Show resolved Hide resolved
@ptrus ptrus force-pushed the ptrus/feature/multiple-txnschedulers branch 2 times, most recently from a3924b5 to cced41b Compare August 17, 2020 20:39
@ptrus ptrus force-pushed the ptrus/feature/multiple-txnschedulers branch from 5428c9b to 866e82a Compare August 19, 2020 10:47
@ptrus ptrus marked this pull request as ready for review August 19, 2020 11:03
docs/runtime/index.md Outdated Show resolved Hide resolved
docs/runtime/index.md Outdated Show resolved Hide resolved
docs/runtime/index.md Outdated Show resolved Hide resolved
docs/runtime/index.md Outdated Show resolved Hide resolved
docs/runtime/index.md Outdated Show resolved Hide resolved
go/consensus/tendermint/apps/roothash/transactions.go Outdated Show resolved Hide resolved
@ptrus ptrus force-pushed the ptrus/feature/multiple-txnschedulers branch from 866e82a to 4bf8ee4 Compare August 19, 2020 16:10
// Initialize initializes the internal transaction scheduler state.
// Algorithm should use the provided transaction dispatcher to dispatch
// scheduled transactions.
// Scheduler defines an algorithm for scheduling incoming transaction.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
// Scheduler defines an algorithm for scheduling incoming transaction.
// Scheduler defines an algorithm for scheduling incoming transactions.

Copy link
Member

Choose a reason for hiding this comment

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

Was this reverted, I remember this was already fixed :-)

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah me to 🤔

go/runtime/scheduling/api/api.go Outdated Show resolved Hide resolved
go/runtime/scheduling/batching/incoming_queue.go Outdated Show resolved Hide resolved
@ptrus ptrus force-pushed the ptrus/feature/multiple-txnschedulers branch 2 times, most recently from 78f9f41 to e71147d Compare August 19, 2020 18:04
@ptrus ptrus force-pushed the ptrus/feature/multiple-txnschedulers branch 3 times, most recently from 58a905b to 202b578 Compare August 19, 2020 20:12
go/consensus/tendermint/apps/roothash/state/round.go Outdated Show resolved Hide resolved
go/registry/api/runtime.go Outdated Show resolved Hide resolved
@ptrus ptrus force-pushed the ptrus/feature/multiple-txnschedulers branch from 202b578 to a44b64f Compare August 19, 2020 20:57
@ptrus
Copy link
Member Author

ptrus commented Aug 20, 2020

Did some more (minor) changes see: 5738d83 (in a separate commit for now, for easier review)

@ptrus ptrus force-pushed the ptrus/feature/multiple-txnschedulers branch 3 times, most recently from 511d8cb to 1de4b3b Compare August 20, 2020 09:23
// Initialize initializes the internal transaction scheduler state.
// Algorithm should use the provided transaction dispatcher to dispatch
// scheduled transactions.
// Scheduler defines an algorithm for scheduling incoming transaction.
Copy link
Member

Choose a reason for hiding this comment

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

Was this reverted, I remember this was already fixed :-)

@ptrus ptrus force-pushed the ptrus/feature/multiple-txnschedulers branch from 1de4b3b to 72a48ae Compare August 20, 2020 10:51
Transaction scheduling committee is removed and the transaction scheduler
worker is merged into the executor. Transaction scheduling gRPC service
is removed and runtime transaction submission is now done via libp2p's
gossipsub.

Each active executor worker now also acts as a transaction scheduler.
Each round one of the executors acts as the scheduler and is expected to
propose a batch for scheduling. Nodes switch between schedulers in round robin
fashion.
@ptrus ptrus force-pushed the ptrus/feature/multiple-txnschedulers branch from 72a48ae to 16499ba Compare August 20, 2020 10:52
@ptrus
Copy link
Member Author

ptrus commented Aug 20, 2020

Really thanks for all the great reviews @kostko !

@ptrus ptrus merged commit e895f3e into master Aug 20, 2020
@ptrus ptrus deleted the ptrus/feature/multiple-txnschedulers branch August 20, 2020 11:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Internal transaction retry Shorten transaction scheduler leader
3 participants