github.com/coreos/rocket@v1.30.1-0.20200224141603-171c416fac02/Documentation/performance/README.md (about) 1 # Benchmarks 2 3 rkt has a utility called rkt-monitor that will run rkt with an example 4 workload, and track the memory and CPU usage. It does this by exec'ing rkt with 5 an ACI or pod manifest, watching the resource consumption for rkt and all 6 children processes, and after a timeout killing rkt and printing the results. 7 8 ## Running the Benchmarks 9 10 To run the benchmarks, one must have both a built version of rkt-monitor and an 11 ACI or pod manifest. Additionally, rkt must be available on the `PATH`. 12 13 To build rkt-monitor, `cd` to `tests/rkt-monitor` and run the `build` script in 14 that directory. 15 16 To build one of the provided workloads, run any of the `build-*` scripts in 17 `tests/rkt-monitor`. All scripts require acbuild to be available on the current 18 `PATH`. The script will produce either an ACI, or a directory with multiple 19 ACIs and a pod manifest. In the case of the latter, the ACIs in the created 20 directory must be imported into rkt's cas before running rkt-monitor, via the 21 command `rkt fetch --insecure-options=image <newDirectory>/*`. 22 23 With rkt-monitor and an ACI or a pod manifest, now the benchmarks can be run 24 via `./rkt-monitor <workload>`. 25 26 There are four flags available to influence how rkt-monitor runs. `-r ` set the 27 number of benchmark experiment repetitions, `-f` save output to files in a 28 temporary directory with `rkt_benchmark` prefix, `-v` will print out the current 29 resource usage of each process every second. `-d` can be used to specify a 30 duration to run the tests for (default of 10s). For example, `-d 30s` will run 31 the tests for 30 seconds. 32 33 # Profiling 34 35 rkt will provide two hidden global flags `--cpuprofile` and `--memprofile` that can be used for performance profiling. 36 Setting `--cpuprofile=$FILE` will make rkt write down the CPU profiles to the `$FILE`. 37 Setting `--memprofile=$FILE` will make rkt write down the Memory profile to the `$FILE`. 38 Note that memory profile will only be written down before rkt exits, so during the execution 39 of rkt, the memory profile will be empty. 40 41 The profile result can be viewed by go's profiling tool, for example: 42 43 ```shell 44 $ sudo /usr/bin/rkt --cpuprofile=/tmp/cpu.profile --memprofile=/tmp/mem.profile gc --grace-period=0 45 $ go tool pprof /usr/bin/rkt /tmp/cpu.profile 46 $ go tool pprof /usr/bin/rkt /tmp/mem.profile 47 ``` 48 49 For more profiling tips, please see [Profiling Go Programs][profiling]. 50 51 52 [profiling]: https://blog.golang.org/profiling-go-programs