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

DVT-1057 replace block data structure with LRU cache to fix memory leak #148

Merged
merged 24 commits into from
Nov 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
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
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,9 @@ You can then generate some load to make sure that blocks with transactions are b
$ polycli loadtest --verbosity 700 --chain-id 1337 --concurrency 1 --requests 1000 --rate-limit 5 --mode c --rpc-url http://127.0.0.1:8545
```

## Monitor Debug
`polycli monitor --rpc-url http://34.117.145.249:80 -v 700 &> log.txt`

# Contributing

- If you add a new loadtest mode, don't forget to update the loadtest mode string by running the following command: `cd cmd/loadtest && stringer -type=loadTestMode`. You can install [stringer](https://pkg.go.dev/golang.org/x/tools/cmd/stringer) with `go install golang.org/x/tools/cmd/stringer@latest`.
Expand Down
13 changes: 10 additions & 3 deletions cmd/monitor/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,10 @@ var (
usage string

// flags
rpcUrl string
batchSizeValue string
intervalStr string
rpcUrl string
batchSizeValue string
blockCacheLimit int
intervalStr string
)

// MonitorCmd represents the monitor command
Expand All @@ -37,6 +38,7 @@ var MonitorCmd = &cobra.Command{
func init() {
MonitorCmd.PersistentFlags().StringVarP(&rpcUrl, "rpc-url", "r", "http://localhost:8545", "The RPC endpoint url")
MonitorCmd.PersistentFlags().StringVarP(&batchSizeValue, "batch-size", "b", "auto", "Number of requests per batch")
MonitorCmd.PersistentFlags().IntVarP(&blockCacheLimit, "cache-limit", "c", 100, "Number of cached blocks for the LRU block data structure (Min 100)")
MonitorCmd.PersistentFlags().StringVarP(&intervalStr, "interval", "i", "5s", "Amount of time between batch block rpc calls")
}

Expand Down Expand Up @@ -66,5 +68,10 @@ func checkFlags() (err error) {
}
}

// Check batch-size flag.
if blockCacheLimit < 100 {
return fmt.Errorf("block-cache can't be less than 100")
}

return nil
}
Loading