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

[indexer-alt] Add benchmark command #20352

Merged
merged 5 commits into from
Nov 21, 2024
Merged

[indexer-alt] Add benchmark command #20352

merged 5 commits into from
Nov 21, 2024

Conversation

lxfind
Copy link
Contributor

@lxfind lxfind commented Nov 20, 2024

Description

This PR adds a benchmark command to indexer-alt.
It would start the indexer using the provided parameters, start and stop based on the local ingestion data.
It then measures the time and TPS.
A few structural changes to indexer-alt code:

  1. Moved lag and pruner options to a dedicated sequential pipeline config, since these params only make sense in a sequential pipeline setting.
  2. Moved all the indexer start logic to a dedicated function, so that I can reuse it in the benchmark.
  3. Added option to not bootstrap genesis if not needed.

Test plan

Run locally


Release notes

Check each box that your changes affect. If none of the boxes relate to your changes, release notes aren't required.

For each box you select, include information after the relevant heading that describes the impact of your changes that a user might notice and any actions they must take to implement updates.

  • Protocol:
  • Nodes (Validators and Full nodes):
  • Indexer:
  • JSON-RPC:
  • GraphQL:
  • CLI:
  • Rust SDK:
  • REST API:

Copy link

vercel bot commented Nov 20, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
sui-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Nov 21, 2024 8:15pm
3 Skipped Deployments
Name Status Preview Comments Updated (UTC)
multisig-toolkit ⬜️ Ignored (Inspect) Visit Preview Nov 21, 2024 8:15pm
sui-kiosk ⬜️ Ignored (Inspect) Visit Preview Nov 21, 2024 8:15pm
sui-typescript-docs ⬜️ Ignored (Inspect) Visit Preview Nov 21, 2024 8:15pm

@lxfind lxfind temporarily deployed to sui-typescript-aws-kms-test-env November 20, 2024 17:35 — with GitHub Actions Inactive
Copy link
Member

@amnn amnn left a comment

Choose a reason for hiding this comment

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

I think we're missing some files in the PR -- what's here seems reasonable, but I left some questions for your consideration! Thanks @lxfind .

#[clap(long)]
consistent_range: Option<u64>,
#[command(flatten)]
sequential_pipeline_config: SequentialPipelineConfig,
Copy link
Member

Choose a reason for hiding this comment

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

nit: this is even more specific than for sequential pipelines -- let's call it a ConsistencyConfig or something?

crates/sui-indexer-alt/Cargo.toml Outdated Show resolved Hide resolved
Comment on lines 347 to 351
// If true, the indexer will bootstrap from genesis.
// Otherwise it will skip the pipelines that rely on genesis data.
with_genesis: bool,
Copy link
Member

Choose a reason for hiding this comment

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

Is it worth doing this the other way? I.e. infer whether we need to bootstrap genesis based on whether the pipelines we're about to run need it or not? Seems like that would be less error-prone.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Is there a better way to infer that other than hardcode the list of pipelines that need genesis somewhere?

Copy link
Member

Choose a reason for hiding this comment

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

Hardcoding it is really the only way, but it's driven by the types, because the pipelines that need bootstrapping need a value that is only generated from the bootstrapping process to initialise themselves with.

crates/sui-indexer-alt/src/pipeline/sequential/mod.rs Outdated Show resolved Hide resolved
crates/sui-indexer-alt/src/main.rs Outdated Show resolved Hide resolved
Copy link
Member

@amnn amnn left a comment

Choose a reason for hiding this comment

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

Looks good! Just some small nits.

There's also the small thread about bootstrapping genesis -- as I was thinking about it, that discussion dove-tails with a separate discussion in the standalone synthetic benchmark generation logic where you get rid of checkpoint 0 -- is it worth simplifying things by keeping both? I.e. simulacrum always generates the genesis checkpoint, and we always bootstrap the genesis table, even during benchmarks?


[features]
default = []
benchmark = ["sui-synthetic-ingestion"] # This will be used to enable benchmark mode
Copy link
Member

Choose a reason for hiding this comment

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

This is mostly for my own education -- in some places, I've seen this written like it is here, and in other cases the feature name is prefixed with a "dep:" when it enables the dependency.

Is there a difference between the two?

Copy link
Contributor Author

@lxfind lxfind Nov 21, 2024

Choose a reason for hiding this comment

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

Good question. I am now confused on the difference too.

pipeline: Vec<String>,

#[command(flatten)]
sequential_pipeline_config: ConsistencyConfig,
Copy link
Member

Choose a reason for hiding this comment

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

nit: naming.

Suggested change
sequential_pipeline_config: ConsistencyConfig,
consistency_config: ConsistencyConfig,

Copy link
Member

Choose a reason for hiding this comment

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

nit: I don't think this belongs inside pipeline -- it's specific to our indexer, while pipeline is part of the indexer framework. Let's keep it at the top-level for now.

@lxfind
Copy link
Contributor Author

lxfind commented Nov 21, 2024

simulacrum always generates the genesis checkpoint, and we always bootstrap the genesis table, even during benchmarks?

I was hoping to be able to also download some checkpoint data from mainnet, and use them to benchmark the indexer. The genesis checkpoint would not be there.
Another option is to allow using some default genesis value in benchmark mode

@lxfind lxfind temporarily deployed to sui-typescript-aws-kms-test-env November 21, 2024 20:14 — with GitHub Actions Inactive
@lxfind lxfind enabled auto-merge (squash) November 21, 2024 20:16
@lxfind lxfind merged commit 66e0221 into main Nov 21, 2024
52 checks passed
@lxfind lxfind deleted the indexer-alt-benchmark branch November 21, 2024 20:43
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.

2 participants