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

chore: Add misc/stress-test #1583

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

jefft0
Copy link
Contributor

@jefft0 jefft0 commented Jan 25, 2024

This PR adds a Go utility in misc/stress-test/stress-test-many-posts which adds millions of posts to the (local) boards realm to test how memory and transaction time change with lots of realm storage. See the README for how to use it. See this report for example graphs created from using this utility.

@thehowl
Copy link
Member

thehowl commented Jan 26, 2024

Great stuff!

@zivkovicmilos zivkovicmilos self-requested a review January 26, 2024 18:49
@jefft0 jefft0 force-pushed the chore/add-misc-stress-test branch from e08801f to 4c8bdf3 Compare January 29, 2024 13:04
@jefft0 jefft0 marked this pull request as ready for review January 29, 2024 13:09
@jefft0 jefft0 requested a review from a team as a code owner January 29, 2024 13:09
@moul moul mentioned this pull request Jan 31, 2024
7 tasks
@jefft0 jefft0 marked this pull request as draft February 2, 2024 09:52
@jefft0 jefft0 force-pushed the chore/add-misc-stress-test branch 2 times, most recently from dff0ef6 to 1bcaf7b Compare February 5, 2024 13:53
@jefft0 jefft0 force-pushed the chore/add-misc-stress-test branch 2 times, most recently from dd4bc2f to 813b077 Compare February 7, 2024 13:08
@jefft0 jefft0 force-pushed the chore/add-misc-stress-test branch from 813b077 to 59561b4 Compare February 14, 2024 12:33
@jefft0
Copy link
Contributor Author

jefft0 commented Feb 15, 2024

Interim results with gnoland

Here are some results with gnoland (on-disk storage) where the max allowed gas was increased for adding 500 posts each transaction. The stress test added a million posts.

Screenshot 2024-02-16 at 10 27 21

On average, it took 5 seconds to add 500 posts. This remained fairly constant. (I was testing this on my working Mac. The extra time during 600 000 and 700 000 was because my browser was temporarily using a lot of memory. This wouldn't happen on a dedicated node.) Here is the gnoland memory usage:

Screenshot 2024-02-16 at 10 27 43

It uses a baseline 330 MB RAM for zero posts and 418 MB RAM for one million posts, with fairly linear increase. That's 88 bytes per post, which is much more reasonable than 20 000 bytes per post for in-memory storage. When gnodev supports on-disk storage, we'll repeat this experiment using it.

@jefft0 jefft0 force-pushed the chore/add-misc-stress-test branch from 59561b4 to 8bfc2f2 Compare March 21, 2024 12:39
Copy link

codecov bot commented Mar 21, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 60.21%. Comparing base (8bd07c9) to head (ec5a336).

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1583      +/-   ##
==========================================
- Coverage   60.21%   60.21%   -0.01%     
==========================================
  Files         561      561              
  Lines       75071    75071              
==========================================
- Hits        45205    45201       -4     
- Misses      26485    26490       +5     
+ Partials     3381     3380       -1     
Flag Coverage Δ
contribs/gnodev 61.40% <ø> (ø)
contribs/gnofaucet 14.46% <ø> (-0.86%) ⬇️
gno.land 64.75% <ø> (ø)
misc/genstd 80.54% <ø> (ø)
misc/logos 19.88% <ø> (-0.36%) ⬇️
tm2 61.95% <ø> (-0.07%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@thehowl
Copy link
Member

thehowl commented Mar 21, 2024

@jefft0 what's the status on this PR? Do you need feedback or directions of how to move forward?

@jefft0
Copy link
Contributor Author

jefft0 commented Mar 21, 2024

@jefft0 what's the status on this PR? Do you need feedback or directions of how to move forward?

I'm still settling on the best way to run the tests. Right now it uses a clone of r/demo/boards running on a local gnoland. The clone is needed to fix this problem.

Also, it's necessary to rebuild gnoland with a hack to increase the MaxGas so that more operations can be done per transaction to stuff data into the node. Otherwise it takes forever. Can MaxGas be configured on the command line to start gnoland? (It has -genesis-max-vm-cycles but this doesn't prevent the "invalid gas" error.)

Should this PR be merged if it needs hacks like this to get it running?

@thehowl
Copy link
Member

thehowl commented Mar 21, 2024

(It has -genesis-max-vm-cycles but this doesn't prevent the "invalid gas" error.)

It currently doesn't do anything, because NewApp in gno.land/pkg/gnoland/app.go doesn't have cfg.MaxCycles = maxCycles. (lol).

I'm making a PR to fix that, but I wanted to add the unused-param linter to avoid this happening again, and I'm now in a rabbit hole. In any case, thought I'd mention this here so you can at least sort it out with a patch on your side. (Or use gnodev, which shouldn't have this issue)

Should this PR be merged if it needs hacks like this to get it running?

No, fair point. Let's wait on the outstanding issues. It may also be nice, for this PR specifically, to add instructions in a README on how to run the stress test. Let's re-consider how to add this after fixing max-vm-cycles and the GetOrigCaller issue.

@jefft0 jefft0 force-pushed the chore/add-misc-stress-test branch 3 times, most recently from 082bf29 to 1b914ff Compare March 26, 2024 09:42
@jefft0 jefft0 force-pushed the chore/add-misc-stress-test branch 2 times, most recently from 39cb609 to a2406df Compare April 3, 2024 07:50
@jefft0 jefft0 force-pushed the chore/add-misc-stress-test branch from a2406df to 1468ff0 Compare April 22, 2024 09:22
@piux2 piux2 self-requested a review April 22, 2024 15:30
@jefft0 jefft0 force-pushed the chore/add-misc-stress-test branch from 1468ff0 to 1d1c629 Compare April 23, 2024 10:16
@jefft0 jefft0 force-pushed the chore/add-misc-stress-test branch from 1d1c629 to 712b6f2 Compare April 30, 2024 15:59
@jefft0 jefft0 force-pushed the chore/add-misc-stress-test branch from 712b6f2 to 011f014 Compare May 13, 2024 12:09
@jefft0 jefft0 force-pushed the chore/add-misc-stress-test branch from 011f014 to d7f1216 Compare June 4, 2024 10:02
leohhhn added a commit that referenced this pull request Jun 24, 2024
…() to PrevRealm().IsUser() (#2358)

In r/demo/boards, `std.AssertOriginCall()` blocks calling the API from
another realm. But it also prevents using MsgRun for testing as we do in
PR #1583. Therefore, we change to check `std.PrevRealm().IsUser()`. This
still blocks another realm from calling the code, but allows being
[called by
MsgRun](https://github.com/gnolang/gno/blob/d7f12167eff72cd4a12e9e8b8aaa30dc241bfb6c/misc/stress-test/stress-test-many-posts/main.go#L148-L156)
where a user keypair sends the transaction.

<details><summary>Contributors' checklist...</summary>

- [x] Added new tests, or not needed, or not feasible
- [x] Provided an example (e.g. screenshot) to aid review or the PR is
self-explanatory
- [x] Updated the official documentation or not needed
- [x] No breaking changes were made, or a `BREAKING CHANGE: xxx` message
was included in the description
- [x] Added references to related issues and PRs
</details>

---------

Signed-off-by: Jeff Thompson <[email protected]>
Co-authored-by: Leon Hudak <[email protected]>
@jefft0 jefft0 force-pushed the chore/add-misc-stress-test branch 3 times, most recently from 9a32a24 to 907101f Compare June 24, 2024 13:00
Signed-off-by: Jeff Thompson <[email protected]>
@jefft0 jefft0 force-pushed the chore/add-misc-stress-test branch from 907101f to d7338dd Compare June 24, 2024 13:03
@jefft0 jefft0 marked this pull request as ready for review June 24, 2024 13:04
@jefft0
Copy link
Contributor Author

jefft0 commented Jun 24, 2024

Hi @thehowl . Thanks to the merging of #2358, this utility doesn't need hacks to run. I added a README and changed from Draft to Read to Review.

@jefft0 jefft0 added 🐞 bug Something isn't working and removed 🐞 bug Something isn't working labels Jul 1, 2024
gfanton pushed a commit to gfanton/gno that referenced this pull request Jul 23, 2024
…() to PrevRealm().IsUser() (gnolang#2358)

In r/demo/boards, `std.AssertOriginCall()` blocks calling the API from
another realm. But it also prevents using MsgRun for testing as we do in
PR gnolang#1583. Therefore, we change to check `std.PrevRealm().IsUser()`. This
still blocks another realm from calling the code, but allows being
[called by
MsgRun](https://github.com/gnolang/gno/blob/d7f12167eff72cd4a12e9e8b8aaa30dc241bfb6c/misc/stress-test/stress-test-many-posts/main.go#L148-L156)
where a user keypair sends the transaction.

<details><summary>Contributors' checklist...</summary>

- [x] Added new tests, or not needed, or not feasible
- [x] Provided an example (e.g. screenshot) to aid review or the PR is
self-explanatory
- [x] Updated the official documentation or not needed
- [x] No breaking changes were made, or a `BREAKING CHANGE: xxx` message
was included in the description
- [x] Added references to related issues and PRs
</details>

---------

Signed-off-by: Jeff Thompson <[email protected]>
Co-authored-by: Leon Hudak <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: In Progress
Status: No status
Status: In Review
Development

Successfully merging this pull request may close these issues.

3 participants