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

Add command to loadtest against RPC endpoints #2072

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

codchen
Copy link
Collaborator

@codchen codchen commented Feb 12, 2025

Describe your changes and provide context

Usage:

seid evm-rpc-load --config=<path-to-config>

Example config is included in this commit.

Testing performed to validate your change

local sei test

seid evm-rpc-load --config=cmd/seid/cmd/config/rpc_load.json

made 2272476 requests for load 0 with an average latency of 131 micro seconds

unit tests

Comment on lines 76 to 82
go func() {
defer wg.Done()
for {
select {
case <-ctx.Done():
return
default:
var res interface{}
now := time.Now()
if err := rpcclient.CallContext(ctx, &res, load.Method, typedParams...); err != nil {
if !strings.Contains(err.Error(), "context deadline exceeded") {
fmt.Printf("calling %s encountered error %s\n", load.Method, err)
}
return
}
callCounts[i].Add(1)
latencies[i].Add(time.Since(now).Microseconds())
serializedRes, _ := json.Marshal(res)
if load.ExpectedResult != "" && string(serializedRes) != load.ExpectedResult {
fmt.Printf("calling %s expected %s but got %s\n", load.Method, load.ExpectedResult, string(serializedRes))
return
}
}
}
}()

Check notice

Code scanning / CodeQL

Spawning a Go routine Note

Spawning a Go routine may be a possible source of non-determinism
return
default:
var res interface{}
now := time.Now()

Check warning

Code scanning / CodeQL

Calling the system time Warning

Calling the system time may be a possible source of non-determinism
@codchen codchen force-pushed the tony/rpc-loadtest branch 2 times, most recently from c884450 to 611047f Compare February 12, 2025 08:38
@sei-protocol sei-protocol deleted a comment from codecov bot Feb 12, 2025
Copy link

codecov bot commented Feb 12, 2025

Codecov Report

Attention: Patch coverage is 58.38509% with 67 lines in your changes missing coverage. Please review.

Project coverage is 58.37%. Comparing base (3a3af97) to head (611047f).

Files with missing lines Patch % Lines
cmd/seid/cmd/evmrpcload.go 58.75% 63 Missing and 3 partials ⚠️
cmd/seid/cmd/root.go 0.00% 1 Missing ⚠️

❌ Your project check has failed because the head coverage (58.37%) is below the target coverage (60.00%). You can increase the head coverage or adjust the target coverage.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #2072      +/-   ##
==========================================
- Coverage   61.41%   58.37%   -3.04%     
==========================================
  Files         264      274      +10     
  Lines       24647    26143    +1496     
==========================================
+ Hits        15136    15261     +125     
- Misses       8383     9748    +1365     
- Partials     1128     1134       +6     
Files with missing lines Coverage Δ
cmd/seid/cmd/root.go 0.00% <0.00%> (ø)
cmd/seid/cmd/evmrpcload.go 58.75% <58.75%> (ø)

... and 11 files with indirect coverage changes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants