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

Problem: tx delivery performance is not benchmarked #916

Merged
merged 1 commit into from Mar 14, 2023

Conversation

yihuang
Copy link
Collaborator

@yihuang yihuang commented Mar 7, 2023

Solution:

  • add the first benchmark for tx delivery (typical erc20 transfers)

Test Results

$ go test -run=^$ -bench=BenchmarkERC20Transfer -benchmem ./app
goos: darwin
goarch: amd64
pkg: github.com/crypto-org-chain/cronos/v2/app
cpu: Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz
BenchmarkERC20Transfer/memdb-12         	       1	1316400164 ns/op	277784600 B/op	 4731271 allocs/op
BenchmarkERC20Transfer/leveldb-12       	       1	1385148085 ns/op	278984336 B/op	 4729347 allocs/op
PASS
ok  	github.com/crypto-org-chain/cronos/v2/app	5.249s
  • it takes around 1.3s to execute a block with 1000 erc20 transfer txs
  • profile shows ante handler spend a little bit more than msg execution
  • goleveldb result is very close to memdb.
  • ethereum sender recovery is a hotspot, another one seems to be GetParams.

👮🏻👮🏻👮🏻 !!!! REFERENCE THE PROBLEM YOUR ARE SOLVING IN THE PR TITLE AND DESCRIBE YOUR SOLUTION HERE !!!! DO NOT FORGET !!!! 👮🏻👮🏻👮🏻

PR Checklist:

  • Have you read the CONTRIBUTING.md?
  • Does your PR follow the C4 patch requirements?
  • Have you rebased your work on top of the latest master?
  • Have you checked your code compiles? (make)
  • Have you included tests for any non-trivial functionality?
  • Have you checked your code passes the unit tests? (make test)
  • Have you checked your code formatting is correct? (go fmt)
  • Have you checked your basic code style is fine? (golangci-lint run)
  • If you added any dependencies, have you checked they do not contain any known vulnerabilities? (go list -json -m all | nancy sleuth)
  • If your changes affect the client infrastructure, have you run the integration test?
  • If your changes affect public APIs, does your PR follow the C4 evolution of public contracts?
  • If your code changes public APIs, have you incremented the crate version numbers and documented your changes in the CHANGELOG.md?
  • If you are contributing for the first time, please read the agreement in CONTRIBUTING.md now and add a comment to this pull request stating that your PR is in accordance with the Developer's Certificate of Origin.

Thank you for your code, it's appreciated! :)

@yihuang yihuang requested a review from a team as a code owner March 7, 2023 10:44
@yihuang yihuang requested review from JayT106 and leejw51crypto and removed request for a team March 7, 2023 10:44
@yihuang yihuang marked this pull request as draft March 7, 2023 10:44
Solution:
- add the first benchmark for tx delivery
@yihuang yihuang marked this pull request as ready for review March 14, 2023 08:10
@yihuang yihuang requested a review from mmsqe March 14, 2023 08:10
Copy link
Collaborator

@mmsqe mmsqe left a comment

Choose a reason for hiding this comment

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

runMsgs seems heavier than ante handles
Screenshot 2023-03-14 at 4 44 29 PM

@yihuang
Copy link
Collaborator Author

yihuang commented Mar 14, 2023

runMsgs seems heavier than ante handles

that's allocation?

@mmsqe
Copy link
Collaborator

mmsqe commented Mar 14, 2023

runMsgs seems heavier than ante handles

that's allocation?

yes, and cpuprofile shows
Screenshot 2023-03-14 at 4 54 24 PM

@yihuang
Copy link
Collaborator Author

yihuang commented Mar 14, 2023

runMsgs seems heavier than ante handles

that's allocation?

yes, and cpuprofile shows

ok, they are close enough, the result is not exactly the same in different runs

@yihuang yihuang enabled auto-merge (squash) March 14, 2023 08:58
@yihuang yihuang merged commit cae36bb into crypto-org-chain:main Mar 14, 2023
mmsqe pushed a commit to mmsqe/cronos that referenced this pull request Mar 16, 2023
…#916)

Solution:
- add the first benchmark for tx delivery
mmsqe added a commit that referenced this pull request Mar 16, 2023
* Problem: tx delivery performance is not benchmarked (#916)

Solution:
- add the first benchmark for tx delivery

* Problem: go 1.20.2 is not used (#926)

* Problem: go 1.20.2 is not used

Solution:
- update nixpkgs to recent master
- re-enable coverage report for integration tests

* enlarge timeout

---------

Co-authored-by: mmsqe <mavis@crypto.com>

* Problem: eth tx sender recovery is slow (#928)

* Problem: eth tx sender recovery is slow

Solution:
- update ethermint dependency, do it once in ante handler and cache the result

* fix build

* update upstream

* fix lint

* fix versiondb

* fix memiavl

* fix upgrade integration test

---------

Co-authored-by: mmsqe <mavis@crypto.com>

* fix lint

* fix test

* point to rpc fix only

* no report coverage

---------

Co-authored-by: yihuang <huang@crypto.com>
AleksandM pushed a commit to AleksandM/cronos that referenced this pull request Jan 23, 2024
…n#932)

* Problem: tx delivery performance is not benchmarked (crypto-org-chain#916)

Solution:
- add the first benchmark for tx delivery

* Problem: go 1.20.2 is not used (crypto-org-chain#926)

* Problem: go 1.20.2 is not used

Solution:
- update nixpkgs to recent master
- re-enable coverage report for integration tests

* enlarge timeout

---------

Co-authored-by: mmsqe <mavis@crypto.com>

* Problem: eth tx sender recovery is slow (crypto-org-chain#928)

* Problem: eth tx sender recovery is slow

Solution:
- update ethermint dependency, do it once in ante handler and cache
the result

* fix build

* update upstream

* fix lint

* fix versiondb

* fix memiavl

* fix upgrade integration test

---------

Co-authored-by: mmsqe <mavis@crypto.com>

* fix lint

* fix test

* point to rpc fix only

* no report coverage

---------

Co-authored-by: yihuang <huang@crypto.com>
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.

None yet

2 participants