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
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 61 additions & 0 deletions misc/stress-test/stress-test-many-posts/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# stress-test-many-posts

This is a utility which adds millions of posts to the (local) boards realm to test how memory and
transaction time change with lots of realm storage.

## Run

Start a local gno.land:

```
cd gno/gno.land
make install
gnoland start -lazy
```

Start gnoweb. In a separate terminal enter:

```
gnoweb
```

Run the utility. In a separate terminal enter:

```
cd gno/misc/stress-test/stress-test-many-posts
go run .
```

## Monitor

By default gno.land starts with r/demo/boards where `testboard` is board #1. This utility adds millions of replies to the first post on that board.
To monitor progress, in a web browser go to http://127.0.0.1:8888/r/demo/boards:testboard . The first post says something like "(100 replies)".
Refresh your browser to see this number increase.

## Optional speedup

This utility adds 50 replies per transaction (as allowed by the maximum gas of 100 million). By default gno.land does one transaction every
5 seconds. It is optional but recommended to decrease this time to 1 second as follows:

* In the terminal where you started gno.land, hit ctrl-C
* In a text editor, open `gnoland-data/config/config.toml`
* Change `timeout_commit` to "1s"
* Save and close the text editor.
* Restart gno.land by entering `gnoland start -lazy`
* In the terminal where you started the test, restart it by entering `go run .`

Now data is added 5 times faster. This can reduce adding a million replies from days to hours.

## Test output

The utility prints results to the terminal in CSV which you can paste into a spreadsheet to analyze and graph.
Below is a sample output. On average the transaction time is 1 second (if you did the optional speedup), but
can be longer if the system becomes burdened with lots of data in memory.

```
nPosts, avg. for 50 posts [s], min for 50 posts [s], max for 50 posts [s]
1000, 1.044250, 1.015000, 1.136000
2000, 1.048650, 0.999000, 1.106000
3000, 1.047950, 1.021000, 1.079000
4000, 1.046450, 1.028000, 1.072000
```
69 changes: 69 additions & 0 deletions misc/stress-test/stress-test-many-posts/go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
module stress_test_many_posts

go 1.22

toolchain go1.22.5

require (
connectrpc.com/connect v1.14.0
github.com/gnolang/gnonative v1.0.1
)

require (
connectrpc.com/grpchealth v1.2.0 // indirect
connectrpc.com/grpcreflect v1.2.0 // indirect
github.com/btcsuite/btcd/btcec/v2 v2.3.4 // indirect
github.com/btcsuite/btcd/btcutil v1.1.5 // indirect
github.com/cenkalti/backoff/v4 v4.3.0 // indirect
github.com/cockroachdb/apd/v3 v3.2.1 // indirect
github.com/cosmos/ledger-cosmos-go v0.13.3 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.3.0 // indirect
github.com/gnolang/gno v0.0.0-20240429153043-de2fc456c1cd // indirect
github.com/gnolang/overflow v0.0.0-20170615021017-4d914c927216 // indirect
github.com/go-logr/logr v1.4.2 // indirect
github.com/go-logr/stdr v1.2.2 // indirect
github.com/golang/protobuf v1.5.4 // indirect
github.com/golang/snappy v0.0.4 // indirect
github.com/google/uuid v1.6.0 // indirect
github.com/gorilla/websocket v1.5.3 // indirect
github.com/grpc-ecosystem/grpc-gateway/v2 v2.20.0 // indirect
github.com/libp2p/go-buffer-pool v0.1.0 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/rs/cors v1.11.0 // indirect
github.com/rs/xid v1.5.0 // indirect
github.com/stretchr/testify v1.9.0 // indirect
github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7 // indirect
github.com/zondax/hid v0.9.2 // indirect
github.com/zondax/ledger-go v0.14.3 // indirect
go.opentelemetry.io/otel v1.28.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc v1.28.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp v1.28.0 // indirect
go.opentelemetry.io/otel/metric v1.28.0 // indirect
go.opentelemetry.io/otel/sdk v1.28.0 // indirect
go.opentelemetry.io/otel/sdk/metric v1.28.0 // indirect
go.opentelemetry.io/otel/trace v1.28.0 // indirect
go.opentelemetry.io/proto/otlp v1.3.1 // indirect
go.uber.org/multierr v1.11.0 // indirect
go.uber.org/zap v1.27.0 // indirect
golang.org/x/crypto v0.25.0 // indirect
golang.org/x/exp v0.0.0-20240613232115-7f521ea00fb8 // indirect
golang.org/x/mobile v0.0.0-20230531173138-3c911d8e3eda // indirect
golang.org/x/mod v0.19.0 // indirect
golang.org/x/net v0.27.0 // indirect
golang.org/x/sync v0.7.0 // indirect
golang.org/x/sys v0.22.0 // indirect
golang.org/x/text v0.16.0 // indirect
golang.org/x/tools v0.23.0 // indirect
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20240701130421-f6361c86f094 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240701130421-f6361c86f094 // indirect
google.golang.org/grpc v1.65.0 // indirect
google.golang.org/protobuf v1.34.2 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
moul.io/u v1.27.0 // indirect
)

replace github.com/gnolang/gno => ../../../
Loading
Loading