gno icon indicating copy to clipboard operation
gno copied to clipboard

chore: Add misc/stress-test

Open jefft0 opened this issue 1 year ago • 7 comments

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.

jefft0 avatar Jan 25 '24 11:01 jefft0

Great stuff!

thehowl avatar Jan 26 '24 09:01 thehowl

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 avatar Feb 15 '24 14:02 jefft0

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

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%) :arrow_down:
gno.land 64.75% <ø> (ø)
misc/genstd 80.54% <ø> (ø)
misc/logos 19.88% <ø> (-0.36%) :arrow_down:
tm2 61.95% <ø> (-0.07%) :arrow_down:

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

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

codecov[bot] avatar Mar 21 '24 12:03 codecov[bot]

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

thehowl avatar Mar 21 '24 15:03 thehowl

@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?

jefft0 avatar Mar 21 '24 15:03 jefft0

(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.

thehowl avatar Mar 21 '24 16:03 thehowl

Hi @thehowl . Thanks to the merging of https://github.com/gnolang/gno/pull/2358, this utility doesn't need hacks to run. I added a README and changed from Draft to Read to Review.

jefft0 avatar Jun 24 '24 13:06 jefft0