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

Perf test: Transaction group handle/verify #4652

Merged
merged 12 commits into from
Oct 24, 2022
Prev Previous commit
Next Next commit
some comments
  • Loading branch information
algonautshant committed Oct 14, 2022
commit a840455f2f7af746806fae12b5b890d9b04eaed7
11 changes: 5 additions & 6 deletions data/txHandler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,8 @@ func BenchmarkTxHandlerDecoderMsgp(b *testing.B) {
}
}

// BenchmarkIncomingTxHandlerProcessing sends singed transactions to be handled and verified
// It reports the number of dropped transactions
func BenchmarkIncomingTxHandlerProcessing(b *testing.B) {
const numUsers = 100
log := logging.TestingLog(b)
Expand Down Expand Up @@ -288,9 +290,6 @@ func BenchmarkIncomingTxHandlerProcessing(b *testing.B) {
require.NoError(b, err)

l := ledger

cfg.TxPoolSize = 75000
cfg.EnableProcessBlockStats = false
tp := pools.MakeTransactionPool(l.Ledger, cfg, logging.Base())
backlogPool := execpool.MakeBacklog(nil, 0, execpool.LowPriority, nil)
handler := MakeTxHandler(tp, l, &mocks.MockNetwork{}, "", crypto.Digest{}, backlogPool)
Expand Down Expand Up @@ -387,7 +386,7 @@ func BenchmarkIncomingTxHandlerProcessing(b *testing.B) {
}
}()

// Send the transactions
// Send the transactions to the verifier
for _, tg := range encodedSignedTransactionGroups {
// time the streaming of the txns to at most 6000 tps
handler.processIncomingTxn(tg)
Expand All @@ -397,16 +396,17 @@ func BenchmarkIncomingTxHandlerProcessing(b *testing.B) {
close(handler.backlogQueue)
wg.Wait()

// Report the number of transactions dropped because the backlog was busy
var buf strings.Builder
metrics.DefaultRegistry().WriteMetrics(&buf, "")
str := buf.String()
x := strings.Index(str, "\nalgod_transaction_messages_dropped_backlog")
str = str[x+44 : x+44+strings.Index(str[x+44:], "\n")]
str = strings.TrimSpace(strings.ReplaceAll(str, "}", " "))
fmt.Printf("Dropped from backlog: %s\n", str)

}

// Prepare N transaction groups of random sizes with randomly invalid signatures
func makeSignedTxnGroups(N, numUsers int, addresses []basics.Address,
secrets []*crypto.SignatureSecrets) (ret [][]transactions.SignedTxn,
badTxnGroups map[uint64]interface{}) {
Expand All @@ -417,7 +417,6 @@ func makeSignedTxnGroups(N, numUsers int, addresses []basics.Address,
ret = make([][]transactions.SignedTxn, 0, N)
for u := 0; u < N; u++ {
grpSize := rand.Intn(maxGrpSize-1) + 1
grpSize = 1
var txGroup transactions.TxGroup
txns := make([]transactions.Transaction, 0, grpSize)
for g := 0; g < grpSize; g++ {
Expand Down