-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Add doc on gas balancing #6392
Add doc on gas balancing #6392
Conversation
Signed-off-by: Jakub Sztandera <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for writing this up. I think we should get @ZenGround0's review before merging.
## Gas Balancing | ||
|
||
The gas balancing process targets to set gas costs of syscalls to be in line with | ||
10 gas per nanosecond on reference hardware. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: can we link to the reference hardware section?
|
||
#### Reference hardware | ||
|
||
The reference hardware is TR3970x with 128GB of RAM. This is what was available at the time and |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do we mean by "the time"? Can we give a date (e.g., 202007 on the rampup to mainnet launch ← this is just me making something up)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
both at the physical time (~06-2020) and what we had in our hands
Before building `lotus-bench` make sure `EnableGasTracing` in `chain/vm/runtime.go` is set to `true`. | ||
|
||
The process can be started using `./lotus-bench import` with `--car` flag set to the location of | ||
CAR chain export. `--start-epoch` and `--end-epoch` can be used to to limit the range of epochs to run |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will users know where to get a CAR chain export?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm assuming it will be a developer reading these docs, so I assume they will know.
The output will be a `bench.json` file containing information about every syscall invoked | ||
and the time taken by these invocations. This file can grow to be quite big in size so make sure you have |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Idea: maybe include a couple of sample lines below for reference/
In these cases the recommended way to estimate gas for given syscall is to perform an `in-vivo` benchmark. | ||
In the past `in-vitro` as in standalone benchmarks were found to be highly inaccurate when compared to results |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see in-vivo and in-vitro. Which is it? Also potentially adjust below
The best place to hook-in such benchmark is message execution loop in | ||
`chain/stmgr/stmgr.go` in `ApplyBlocks()`. Depending of time required to complete the syscall it might be |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a sample PR can point to that has this?
Resolves #6186
I'll keep adding into there.