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

test: makes network latency effective at earlier heights in benchmark tests #3747

Merged
merged 4 commits into from
Aug 1, 2024

Conversation

staheri14
Copy link
Contributor

Closes #3746

@staheri14 staheri14 changed the title teat: makes network latency effective at earlier heights in benchmark tests test: makes network latency effective at earlier heights in benchmark tests Jul 31, 2024
@staheri14 staheri14 self-assigned this Jul 31, 2024
@staheri14
Copy link
Contributor Author

I verified that the latency gets added at earlier stages of the experiment by inspecting the block times and the average delay between sending and receiving individual block parts.

Experiment without latency:

block_time_vs_size_1v2-t2-b60-bw5mb-tc11-tp80-l0-v1-8mb_8

Experiment with latency:

block_time_vs_size_1v2-t2-b60-bw5mb-tc11-tp80-l1-v1-8mb_8

As we can see, the block time increased in the experiment with latency compared to the one without latency, starting from the beginning of the experiment. The average block time also confirms this observation.

Furthermore, I inspected the average block part delay for height 10 in both experiments, and the results indicate that the latency was applied as expected:

  • Average block part delay without latency: 577.99 milliseconds
  • Average block part delay with latency: 1258.19 milliseconds

@staheri14 staheri14 marked this pull request as ready for review July 31, 2024 18:14
@staheri14 staheri14 requested a review from a team as a code owner July 31, 2024 18:14
@staheri14 staheri14 requested review from rach-id and ninabarbakadze and removed request for a team July 31, 2024 18:14
Copy link
Contributor

coderabbitai bot commented Jul 31, 2024

Walkthrough

Walkthrough

The recent changes focus on enhancing the benchmark testing framework by refining the node startup and synchronization processes. The Run method in benchmark.go has been updated to provide clearer logging and ensure that all nodes are synchronized before executing transactions. Additionally, the Testnet struct's methods in testnet.go have been refactored to improve modularity and better encapsulate the logic for starting and synchronizing nodes.

Changes

Files Change Summary
test/e2e/benchmark/benchmark.go Modified Run method to log specific messages, call StartNodes(), and wait for synchronization using WaitToSync(). Introduced structured logging for transaction client startup.
test/e2e/testnet/testnet.go Refactored Start method to use StartNodes and WaitToSync. Implemented new methods for node startup and synchronization to enhance code modularity.

Assessment against linked issues

Objective Addressed Explanation
Apply latency immediately after nodes start (#3746)
Ensure latency and jitter are applied without waiting to sync (#3746)

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

‼️ IMPORTANT
Auto-reply has been disabled for this repository in the CodeRabbit settings. The CodeRabbit bot will not respond to your replies unless it is explicitly tagged.

  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@staheri14 staheri14 enabled auto-merge (squash) July 31, 2024 18:14
@staheri14 staheri14 added the testing items that are strictly related to adding or extending test coverage label Jul 31, 2024
Copy link
Contributor

@cmwaters cmwaters left a comment

Choose a reason for hiding this comment

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

So if I understand this correctly, previously because we were waiting until all genesis nodes had produced their first block, this meant latency would only be added later on. Now we would do it as soon as the machine says it's up and running.

nit: I would prefer we integrate latency into the start function so test writers don't have to worry about that but that can be addressed later

@staheri14 staheri14 merged commit fc68533 into main Aug 1, 2024
33 of 34 checks passed
@staheri14 staheri14 deleted the sanaz/apply-latency-immediately branch August 1, 2024 16:15
@staheri14
Copy link
Contributor Author

staheri14 commented Aug 1, 2024

So if I understand this correctly, previously because we were waiting until all genesis nodes had produced their first block, this meant latency would only be added later on. Now we would do it as soon as the machine says it's up and running.

Your understanding is correct.

nit: I would prefer we integrate latency into the start function so test writers don't have to worry about that but that can be addressed later

This is handled in the BenchmarkTest.Run(), so test developers don't need to take any additional actions. As soon as latency is specified in the manifest, it will take effect in the test. However, this is not part of the testnet.Testnet functionalities (note that BenchmarkTest wraps around testnet.Testnet), as (I thought) adding latency is not necessarily required for other non-benchmark e2e tests. If you think we can benefit from net latency for those tests, let me know and I'll integrate it into Testnet.Start instead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
testing items that are strictly related to adding or extending test coverage
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Applying network latency in the earlier heights in benchmark tests
4 participants