Skip to content

Commit

Permalink
Revert "Revert "DVT-1057 replace block data structure with LRU cache …
Browse files Browse the repository at this point in the history
…to fix memory leak (#148)""

This reverts commit f174e63.
  • Loading branch information
gatsbyz committed Nov 14, 2023
1 parent f174e63 commit f06209e
Show file tree
Hide file tree
Showing 6 changed files with 270 additions and 186 deletions.
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

0 comments on commit f06209e

Please sign in to comment.