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

parallel bloom calculation #445

Merged
merged 27 commits into from
Oct 15, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
9281410
parallel bloom calculation
steventranjs Oct 9, 2021
c4bc9de
indent
steventranjs Oct 9, 2021
3ced244
add condition if bloomJobs not nil
steventranjs Oct 9, 2021
6615ccf
add handler for worker
steventranjs Oct 9, 2021
faf3de5
fix format
steventranjs Oct 9, 2021
67f5e0a
bloomWorker should exit when all txs have been processed
steventranjs Oct 9, 2021
58bff6a
rename BloomPair => BloomHash
steventranjs Oct 9, 2021
d829350
merge with develop
steventranjs Oct 11, 2021
f6501f7
add size to map
steventranjs Oct 11, 2021
9b5ebc4
rename & unique variable
steventranjs Oct 11, 2021
234f49f
bloomJobs => bloomProcessors
steventranjs Oct 11, 2021
1b7348c
fix
steventranjs Oct 11, 2021
6be63ca
only assign bloom if empty
steventranjs Oct 11, 2021
4648bd7
abstraction method for processing receipt bloom
steventranjs Oct 13, 2021
7ee2d64
remove duplicate receipt_processor
steventranjs Oct 13, 2021
8bdc9a5
rename Processor
steventranjs Oct 13, 2021
a5567c4
fix ReceiptProcessor
steventranjs Oct 13, 2021
f692fe9
fix ReceiptBloomGenertor typo
steventranjs Oct 15, 2021
7d629e1
reduce worker to 1
steventranjs Oct 15, 2021
5a43a3f
remove empty wg
steventranjs Oct 15, 2021
4ac37c3
add defence code to check if channel is closed
steventranjs Oct 15, 2021
9b080d5
remove nil
steventranjs Oct 15, 2021
a3236ab
format fix
steventranjs Oct 15, 2021
790ea7d
remove thread pool
steventranjs Oct 15, 2021
105e007
use max 100 worker capacity
steventranjs Oct 15, 2021
f61d1ed
reduce worker size
steventranjs Oct 15, 2021
0ae31c9
refactor startWorker
steventranjs Oct 15, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions core/receipt_processor.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ func (p *ReceiptBloomGenerator) Apply(receipt *types.Receipt) {
receipt.Bloom = types.CreateBloom(types.Receipts{receipt})
}

func NewAsyncReceiptBloomGenerator(length, workerSize int) *AsyncReceiptBloomGenerator {
func NewAsyncReceiptBloomGenerator(txNums, workerSize int) *AsyncReceiptBloomGenerator {
generator := &AsyncReceiptBloomGenerator{
receipts: make(chan *types.Receipt, length),
receipts: make(chan *types.Receipt, txNums),
wg: sync.WaitGroup{},
steventranjs marked this conversation as resolved.
Show resolved Hide resolved
}
generator.startWorker(workerSize)
Expand Down
2 changes: 1 addition & 1 deletion core/state_processor.go
Original file line number Diff line number Diff line change
Expand Up @@ -396,7 +396,7 @@ func (p *StateProcessor) Process(block *types.Block, statedb *state.StateDB, cfg
commonTxs := make([]*types.Transaction, 0, txNum)

// initilise bloom processors
bloomProcessors := NewAsyncReceiptBloomGenerator(txNum, gopool.Threads(txNum))
bloomProcessors := NewAsyncReceiptBloomGenerator(txNum, gopool.Threads(1))
steventranjs marked this conversation as resolved.
Show resolved Hide resolved

// usually do have two tx, one for validator set contract, another for system reward contract.
systemTxs := make([]*types.Transaction, 0, 2)
Expand Down
2 changes: 1 addition & 1 deletion miner/worker.go
Original file line number Diff line number Diff line change
Expand Up @@ -772,7 +772,7 @@ func (w *worker) commitTransactions(txs *types.TransactionsByPriceAndNonce, coin
}

// initilise bloom processors
bloomProcessors := core.NewAsyncReceiptBloomGenerator(txs.CurrentSize(), gopool.Threads(txs.CurrentSize()))
bloomProcessors := core.NewAsyncReceiptBloomGenerator(txs.CurrentSize(), gopool.Threads(1))
steventranjs marked this conversation as resolved.
Show resolved Hide resolved

LOOP:
for {
Expand Down