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

Add doc on gas balancing #6392

Merged
merged 1 commit into from
Jun 4, 2021
Merged

Add doc on gas balancing #6392

merged 1 commit into from
Jun 4, 2021

Conversation

Kubuxu
Copy link
Contributor

@Kubuxu Kubuxu commented Jun 4, 2021

Resolves #6186

I'll keep adding into there.

Signed-off-by: Jakub Sztandera <[email protected]>
@magik6k magik6k merged commit 393b60f into master Jun 4, 2021
@magik6k magik6k deleted the docs/gas branch June 4, 2021 19:25
Copy link
Member

@BigLep BigLep left a 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.
Copy link
Member

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
Copy link
Member

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)

Copy link
Contributor Author

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
Copy link
Member

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?

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'm assuming it will be a developer reading these docs, so I assume they will know.

Comment on lines +25 to +26
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
Copy link
Member

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/

Comment on lines +46 to +47
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
Copy link
Member

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

Comment on lines +51 to +52
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
Copy link
Member

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?

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.

Determining gas costs of aggregate porep verification
3 participants