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

VM benchmark framework #526

Closed
4 of 5 tasks
Voxelot opened this issue Aug 2, 2022 · 2 comments
Closed
4 of 5 tasks

VM benchmark framework #526

Voxelot opened this issue Aug 2, 2022 · 2 comments
Labels
architecture Something related to the architecture or the architecture description itself. documentation Improvements or additions to documentation

Comments

@Voxelot
Copy link
Member

Voxelot commented Aug 2, 2022

  • Setup a benchmark script in “fuel-core/fuel-tests/benches” using Criterion for each opcode in isolation, running against a full node on RocksDB

    • Criterion Harness using a sync executor (Add fuel-benches #616)
    • Opcode Benchmarks
      • For each opcode being tested, repeat inside the script a large number of times to ensure that the vm is being exercised a relatively large amount of time compared to the rest of the node
      • For instructions that can’t be measured in isolation (for example CALL), exclude the benchmarked times of the dependent opcodes used for setup.
      • For opcodes with variable execution time depending on the arguments (e.g. cost of MCP is based on the number of bytes being copied), we should parameterize a range of values to establish a linear fee model (constant ADD, linear MCP/MCL, logarithmic via merklized storage access)
  • Framework to adjust opcode gas cost based on relative performance differences between opcodes. #667

    • Use NOOP as the base unit of cost (1)
    • All other opcodes are priced based on how many times slower they are compared to NOOP
    • Should be a rerunnable script that automatically processes the output from the benchmark harness
  • Target some kind of low-medium cpu ec2 instance type (i.e. the minimum requirements for a validator)

    • Set block size based on target TPS after opcodes are priced

Future Work

  • Consider disabling VM instruction inlining to enable real-time prod monitoring of opcodes using perf
  • Investigate how much these relative opcode costs change based on different machine hardware
@Voxelot Voxelot changed the title Gas benchmark framework VM benchmark framework Aug 2, 2022
@ControlCplusControlV
Copy link
Contributor

I am assuming we would use cargo bench for this, do we also want to modify configs or added a cpu limiting programmer for capped performance on machines to adjust for background usage when benchmarking? (I remember a Go optimization talk on Slack stickers noticeably impacting benchmarking).

We could also clone the sway-applications repo to run that repo's tests against fuel-core to get a real world benchmark, then have a seperate set of tests dedicated to trying to find DOS vectors (like 17000 NOPs to see if runtime is mostly in line with gas costs)

@Voxelot
Copy link
Member Author

Voxelot commented Aug 12, 2022

cargo bench is typically for micro-benchmarking use-cases. I'm thinking we may need to setup a custom harness with it's own CLI for this 🤔

@Voxelot Voxelot moved this from Todo to In Progress in Fuel Network Sep 5, 2022
@Voxelot Voxelot moved this to Todo in Fuel Network Sep 5, 2022
@xgreenx xgreenx added documentation Improvements or additions to documentation architecture Something related to the architecture or the architecture description itself. labels Sep 12, 2022
@Voxelot Voxelot closed this as completed Jan 23, 2023
@github-project-automation github-project-automation bot moved this from In Progress to Done in Fuel Network Jan 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
architecture Something related to the architecture or the architecture description itself. documentation Improvements or additions to documentation
Projects
Status: Done
Development

No branches or pull requests

4 participants