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(db): reduce batch size for chain history indexer #105

Merged
merged 2 commits into from
Oct 14, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
9 changes: 8 additions & 1 deletion commands/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,13 @@ var Run = &cli.Command{
Usage: "Start indexing tipsets by walking the chain history",
EnvVars: []string{"VISOR_INDEXHISTORY"},
},
&cli.IntFlag{
Name: "indexhistory-batch",
Aliases: []string{"ihb"},
Value: 25,
Usage: "Batch size for the chain history indexer",
EnvVars: []string{"VISOR_INDEXHISTORY_BATCH"},
},

&cli.DurationFlag{
Name: "statechange-lease",
Expand Down Expand Up @@ -237,7 +244,7 @@ var Run = &cli.Command{
if cctx.Bool("indexhistory") {
scheduler.Add(schedule.TaskConfig{
Name: "ChainHistoryIndexer",
Task: indexer.NewChainHistoryIndexer(rctx.db, rctx.api),
Task: indexer.NewChainHistoryIndexer(rctx.db, rctx.api, cctx.Int("indexhistory-batch")),
Locker: NewGlobalSingleton(ChainHistoryIndexerLockID, rctx.db), // only want one history indexer anywhere to be running
RestartOnFailure: true,
RestartOnCompletion: true,
Expand Down
4 changes: 2 additions & 2 deletions tasks/indexer/chainhistoryindexer.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ import (
"github.com/filecoin-project/sentinel-visor/storage"
)

func NewChainHistoryIndexer(d *storage.Database, node lens.API) *ChainHistoryIndexer {
func NewChainHistoryIndexer(d *storage.Database, node lens.API, batchSize int) *ChainHistoryIndexer {
return &ChainHistoryIndexer{
node: node,
storage: d,
finality: 900,
batchSize: 500,
batchSize: batchSize,
}
}

Expand Down