Skip to content

Commit

Permalink
Update wasp, use steps load profile (#10180)
Browse files Browse the repository at this point in the history
* update wasp

* update wasp
  • Loading branch information
skudasov authored Aug 14, 2023
1 parent 9efa475 commit 3dbc025
Show file tree
Hide file tree
Showing 8 changed files with 70 additions and 26 deletions.
3 changes: 2 additions & 1 deletion integration-tests/docker/test_env/test_env.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,8 @@ func (te *CLClusterTestEnv) StartClNodes(nodeConfig *chainlink.Config, count int
}
n := NewClNode([]string{te.Network.Name}, nodeConfig,
WithNodeContainerName(nodeContainerName),
WithDbContainerName(dbContainerName))
WithDbContainerName(dbContainerName),
)
err := n.StartContainer()
if err != nil {
mu.Lock()
Expand Down
4 changes: 2 additions & 2 deletions integration-tests/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ require (
github.com/smartcontractkit/libocr v0.0.0-20230802221916-2271752fa829
github.com/smartcontractkit/ocr2keepers v0.7.8
github.com/smartcontractkit/ocr2vrf v0.0.0-20230804151440-2f1eb1e20687
github.com/smartcontractkit/wasp v0.2.7
github.com/smartcontractkit/wasp v0.2.9
github.com/spf13/cobra v1.6.1
github.com/stretchr/testify v1.8.4
github.com/testcontainers/testcontainers-go v0.22.0
Expand Down Expand Up @@ -366,7 +366,7 @@ require (
github.com/prometheus/procfs v0.11.0 // indirect
github.com/prometheus/prometheus v0.45.0 // indirect
github.com/pyroscope-io/client v0.7.1 // indirect
github.com/pyroscope-io/godeltaprof v0.1.0 // indirect
github.com/pyroscope-io/godeltaprof v0.1.2 // indirect
github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 // indirect
github.com/rivo/uniseg v0.4.4 // indirect
github.com/robfig/cron/v3 v3.0.1 // indirect
Expand Down
8 changes: 4 additions & 4 deletions integration-tests/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -2163,8 +2163,8 @@ github.com/prometheus/prometheus v0.43.1-0.20230327151049-211ae4f1f0a2/go.mod h1
github.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU=
github.com/pyroscope-io/client v0.7.1 h1:yFRhj3vbgjBxehvxQmedmUWJQ4CAfCHhn+itPsuWsHw=
github.com/pyroscope-io/client v0.7.1/go.mod h1:4h21iOU4pUOq0prKyDlvYRL+SCKsBc5wKiEtV+rJGqU=
github.com/pyroscope-io/godeltaprof v0.1.0 h1:UBqtjt0yZi4jTxqZmLAs34XG6ycS3vUTlhEUSq4NHLE=
github.com/pyroscope-io/godeltaprof v0.1.0/go.mod h1:psMITXp90+8pFenXkKIpNhrfmI9saQnPbba27VIaiQE=
github.com/pyroscope-io/godeltaprof v0.1.2 h1:MdlEmYELd5w+lvIzmZvXGNMVzW2Qc9jDMuJaPOR75g4=
github.com/pyroscope-io/godeltaprof v0.1.2/go.mod h1:psMITXp90+8pFenXkKIpNhrfmI9saQnPbba27VIaiQE=
github.com/rakyll/statik v0.1.7 h1:OF3QCZUuyPxuGEP7B4ypUa7sB/iHtqOTDYZXGM8KOdQ=
github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 h1:N/ElC8H3+5XpJzTSTfLsJV/mx9Q9g7kxmchpfZyxgzM=
github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4=
Expand Down Expand Up @@ -2265,8 +2265,8 @@ github.com/smartcontractkit/tdh2/go/ocr2/decryptionplugin v0.0.0-20230808152300-
github.com/smartcontractkit/tdh2/go/ocr2/decryptionplugin v0.0.0-20230808152300-d34f9201db27/go.mod h1:q6f4fe39oZPdsh1i57WznEZgxd8siidMaSFq3wdPmVg=
github.com/smartcontractkit/tdh2/go/tdh2 v0.0.0-20230808152300-d34f9201db27 h1:azEVb1iB0gClMoakc3DMlWXM6j/hgzH2gWUCB8H16VA=
github.com/smartcontractkit/tdh2/go/tdh2 v0.0.0-20230808152300-d34f9201db27/go.mod h1:G5Sd/yzHWf26rQ+X0nG9E0buKPqRGPMJAfk2gwCzOOw=
github.com/smartcontractkit/wasp v0.2.7 h1:9SZ1grPvoNDpxCcQgQi917ifXrjt5JhV/J978HkD0d4=
github.com/smartcontractkit/wasp v0.2.7/go.mod h1:gS2oenc6VEGfewgeqDpVFOSrCZIZX10rVl1PAo+vsxc=
github.com/smartcontractkit/wasp v0.2.9 h1:gIKuhRjdqQCj61OrdxqKZ2vAuXxs+PlibygYkFlP4l8=
github.com/smartcontractkit/wasp v0.2.9/go.mod h1:skquNdMbKxIrHi5O8Kyukf66AaaXuEpEEaSTxfHbhak=
github.com/smartcontractkit/wsrpc v0.7.2 h1:iBXzMeg7vc5YoezIQBq896y25BARw7OKbhrb6vPbtRQ=
github.com/smartcontractkit/wsrpc v0.7.2/go.mod h1:sj7QX2NQibhkhxTfs3KOhAj/5xwgqMipTvJVSssT9i0=
github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc=
Expand Down
22 changes: 22 additions & 0 deletions integration-tests/load/vrfv2/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
### VRFv2 Load tests

## Usage
```
export LOKI_TOKEN=...
export LOKI_URL=...
go test -v -run TestVRFV2Load/vrfv2_soak_test
```

### Dashboards

Deploying dashboard:
```
export GRAFANA_URL=...
export GRAFANA_TOKEN=...
export DATA_SOURCE_NAME=grafanacloud-logs
export DASHBOARD_FOLDER=LoadTests
export DASHBOARD_NAME=${JobTypeName, for example WaspVRFv2}
go run dashboard.go
```
16 changes: 9 additions & 7 deletions integration-tests/load/vrfv2/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,16 +45,18 @@ type SoakVolume struct {
}

type Load struct {
RPSFrom int64 `toml:"rps_from"`
RPSTo int64 `toml:"rps_to"`
Duration *models.Duration `toml:"duration"`
RPSFrom int64 `toml:"rps_from"`
RPSIncrease int64 `toml:"rps_increase"`
RPSSteps int `toml:"rps_steps"`
Duration *models.Duration `toml:"duration"`
}

type LoadVolume struct {
ProductsFrom int64 `toml:"products_from"`
ProductsTo int64 `toml:"products_to"`
Pace *models.Duration `toml:"pace"`
Duration *models.Duration `toml:"duration"`
ProductsFrom int64 `toml:"products_from"`
ProductsIncrease int64 `toml:"products_increase"`
ProductsSteps int `toml:"products_steps"`
Pace *models.Duration `toml:"pace"`
Duration *models.Duration `toml:"duration"`
}

func ReadConfig() (*PerformanceConfig, error) {
Expand Down
14 changes: 8 additions & 6 deletions integration-tests/load/vrfv2/config.toml
Original file line number Diff line number Diff line change
@@ -1,24 +1,26 @@
# testing one product (jobs + contracts) by varying RPS
[Soak]
rps = 1
duration = "10m"
duration = "3m"

[Load]
rps_from = 1
rps_to = 5
duration = "10m"
rps_increase = 1
rps_steps = 10
duration = "3m"

# testing multiple products (jobs + contracts) by varying instances, deploying more of the same type with stable RPS for each product
[SoakVolume]
products = 5
pace = "1s"
duration = "10m"
duration = "3m"

[LoadVolume]
products_from = 1
products_to = 5
products_increase = 1
products_steps = 10
pace = "1s"
duration = "10m"
duration = "3m"

[Common]
node_funds = 10
Expand Down
24 changes: 20 additions & 4 deletions integration-tests/load/vrfv2/vrfv2_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,10 @@ func TestVRFV2Load(t *testing.T) {

// is our "job" stable at all, no memory leaks, no flaking performance under some RPS?
t.Run("vrfv2 soak test", func(t *testing.T) {
singleFeedConfig.Schedule = wasp.Plain(cfg.Soak.RPS, cfg.Soak.Duration.Duration())
singleFeedConfig.Schedule = wasp.Plain(
cfg.Soak.RPS,
cfg.Soak.Duration.Duration(),
)
_, err := wasp.NewProfile().
Add(wasp.NewGenerator(singleFeedConfig)).
Run(true)
Expand All @@ -49,7 +52,12 @@ func TestVRFV2Load(t *testing.T) {

// what are the limits for one "job", figuring out the max/optimal performance params by increasing RPS and varying configuration
t.Run("vrfv2 load test", func(t *testing.T) {
singleFeedConfig.Schedule = wasp.Line(cfg.Load.RPSFrom, cfg.Load.RPSTo, cfg.Load.Duration.Duration())
singleFeedConfig.Schedule = wasp.Steps(
cfg.Load.RPSFrom,
cfg.Load.RPSIncrease,
cfg.Load.RPSSteps,
cfg.Load.Duration.Duration(),
)
_, err = wasp.NewProfile().
Add(wasp.NewGenerator(singleFeedConfig)).
Run(true)
Expand All @@ -58,7 +66,10 @@ func TestVRFV2Load(t *testing.T) {

// how many "jobs" of the same type we can run at once at a stable load with optimal configuration?
t.Run("vrfv2 volume soak test", func(t *testing.T) {
multiFeedConfig.Schedule = wasp.Plain(cfg.SoakVolume.Products, cfg.SoakVolume.Duration.Duration())
multiFeedConfig.Schedule = wasp.Plain(
cfg.SoakVolume.Products,
cfg.SoakVolume.Duration.Duration(),
)
_, err = wasp.NewProfile().
Add(wasp.NewGenerator(multiFeedConfig)).
Run(true)
Expand All @@ -67,7 +78,12 @@ func TestVRFV2Load(t *testing.T) {

// what are the limits if we add more and more "jobs/products" of the same type, each "job" have a stable RPS we vary only amount of jobs
t.Run("vrfv2 volume load test", func(t *testing.T) {
multiFeedConfig.Schedule = wasp.Line(cfg.LoadVolume.ProductsFrom, cfg.LoadVolume.ProductsTo, cfg.LoadVolume.Duration.Duration())
multiFeedConfig.Schedule = wasp.Steps(
cfg.LoadVolume.ProductsFrom,
cfg.LoadVolume.ProductsIncrease,
cfg.LoadVolume.ProductsSteps,
cfg.LoadVolume.Duration.Duration(),
)
_, err = wasp.NewProfile().
Add(wasp.NewGenerator(multiFeedConfig)).
Run(true)
Expand Down
5 changes: 3 additions & 2 deletions integration-tests/load/vrfv2/vu.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ func (m *JobVolumeVU) Teardown(_ *wasp.Generator) error {

func (m *JobVolumeVU) Call(l *wasp.Generator) {
time.Sleep(m.pace)
tn := time.Now()
err := m.contracts.LoadTestConsumer.RequestRandomness(
m.keyHash,
vrfConst.SubID,
Expand All @@ -76,10 +77,10 @@ func (m *JobVolumeVU) Call(l *wasp.Generator) {
vrfConst.RandomnessRequestCountPerRequest,
)
if err != nil {
l.ResponsesChan <- &wasp.CallResult{Error: err.Error(), Failed: true}
l.ResponsesChan <- &wasp.CallResult{Duration: time.Since(tn), Error: err.Error(), Failed: true}
return
}
l.ResponsesChan <- &wasp.CallResult{}
l.ResponsesChan <- &wasp.CallResult{Duration: time.Since(tn)}
}

func (m *JobVolumeVU) Stop(_ *wasp.Generator) {
Expand Down

0 comments on commit 3dbc025

Please sign in to comment.