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] Standalone synthetic ingestion #20270

Merged
merged 2 commits into from
Nov 20, 2024
Merged

Conversation

lxfind
Copy link
Contributor

@lxfind lxfind commented Nov 14, 2024

Description

Decouples ingestion and benchmarking, remove the benchmark related code from sui-indexer crate.
After this change, we will always first run synthetic ingestion to generate a workload, and then separately, run indexer to benchmark it.
This has a few benefits:

  1. We no longer need to maintain compatibility between indexer and indexer-alt in terms of benchmark integration. This is good because it is a lot easier to benchmark indexer-alt, since it supports stopping at a specific checkpoint.
  2. This will make it easier to use different types of ingestion workload.

Also cleaned up the ingestion generation code by allowing generation from checkpoint 0, and made sure that every checkpoint has the same number of transactions.

Test plan

Updated tests.

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 14, 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 20, 2024 6:26am
3 Skipped Deployments
Name Status Preview Comments Updated (UTC)
multisig-toolkit ⬜️ Ignored (Inspect) Visit Preview Nov 20, 2024 6:26am
sui-kiosk ⬜️ Ignored (Inspect) Visit Preview Nov 20, 2024 6:26am
sui-typescript-docs ⬜️ Ignored (Inspect) Visit Preview Nov 20, 2024 6:26am

@lxfind lxfind temporarily deployed to sui-typescript-aws-kms-test-env November 14, 2024 18:25 — with GitHub Actions Inactive
@lxfind lxfind requested review from wlmyng, gegaowp and amnn November 14, 2024 18:30
@lxfind lxfind force-pushed the standalone-synthetic-ingestion branch from 9be316b to 895565e Compare November 15, 2024 18:38
@lxfind lxfind temporarily deployed to sui-typescript-aws-kms-test-env November 15, 2024 18:38 — with GitHub Actions Inactive
fs::remove_file(ingestion_dir.join("1.chk")).await.unwrap();
effects.created()[0].0
};
sim.override_next_checkpoint_number(starting_checkpoint);
Copy link
Contributor

Choose a reason for hiding this comment

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

ah so this is what will set the next checkpoint file to starting_checkpoint.chk

Comment on lines 124 to 127
println!(
"About to build checkpoint, size: {}",
self.transactions.len()
);
Copy link
Contributor

Choose a reason for hiding this comment

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

do we want this println still?

Copy link
Contributor

@gegaowp gegaowp left a comment

Choose a reason for hiding this comment

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

overall looks good, left a couple of minor comments.

let bytes = tokio::fs::read(&path).await.unwrap();
let checkpoint_data: CheckpointData = Blob::from_bytes(&bytes).unwrap();
if checkpoint_data.transactions.len() != checkpoint_size as usize {
for tx in &checkpoint_data.transactions {
Copy link
Contributor

Choose a reason for hiding this comment

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

why do we want to print here, as there is another assert below?

assert_eq!(checkpoint_data.transactions.len(), checkpoint_size as usize);

// `request_gas` will create a transaction, which we don't want to include in the benchmark.
// Put it in a checkpoint and then remove the checkpoint file.
sim.create_checkpoint();
fs::remove_file(ingestion_dir.join("1.chk")).await.unwrap();
Copy link
Contributor

Choose a reason for hiding this comment

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

is remove_file necessary? as std::fs::write(path.join(file_name), blob.to_bytes())?; will overwrite 0.chk and 1.chk after override_next_checkpoint_number

  • if the test range covers cp 0 and cp 1, it will overwrite
  • otherwise these 2 files are not used?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I was hoping to have a mode where when you run benchmark from an ingestion dir, it automatically scan through all files in it

@lxfind lxfind temporarily deployed to sui-typescript-aws-kms-test-env November 20, 2024 06:24 — with GitHub Actions Inactive
@lxfind lxfind enabled auto-merge (squash) November 20, 2024 06:24
@lxfind lxfind merged commit 0241db6 into main Nov 20, 2024
52 checks passed
@lxfind lxfind deleted the standalone-synthetic-ingestion branch November 20, 2024 06:52
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.

3 participants