diff options
author | Fabricio Voznika <fvoznika@google.com> | 2019-04-04 22:31:51 -0700 |
---|---|---|
committer | Fabricio Voznika <fvoznika@gmail.com> | 2019-04-04 22:54:46 -0700 |
commit | cd5ded7e062f8c9f2b8771039f461ff60218ec72 (patch) | |
tree | 3755c5d58be85f310f7d789e347abe37f792e31d /content/docs/user_guide | |
parent | e9504bfdf21809ff41a066fbbdccb33e43023bd4 (diff) |
Update debugging.md
Diffstat (limited to 'content/docs/user_guide')
-rw-r--r-- | content/docs/user_guide/debugging.md | 32 |
1 files changed, 15 insertions, 17 deletions
diff --git a/content/docs/user_guide/debugging.md b/content/docs/user_guide/debugging.md index 47ddb8127..f8a5999fd 100644 --- a/content/docs/user_guide/debugging.md +++ b/content/docs/user_guide/debugging.md @@ -32,14 +32,12 @@ Run your container again, and inspect the files under `/tmp/runsc`. The log file with name `boot` will contain the strace logs from your application, which can be useful for identifying missing or broken system calls in gVisor. -## Stack Trace +## Stack traces -`runsc debug --stacks` command allows stack traces to be collected while the -sandbox is running which can be useful to troubleshoot issues or just to learn -more about gVisor. It connects to the sandbox process, collects a stack dump, -and writes it to the console. - -Here is an example: +The command `runsc debug --stacks` collects stack traces while the sandbox is +running which can be useful to troubleshoot issues or just to learn more about +gVisor. It connects to the sandbox process, collects a stack dump, and writes +it to the console. For example: ```bash docker run --runtime=runsc --rm -d alpine sh -c "while true; do echo running; sleep .1; done" @@ -52,10 +50,9 @@ sudo runsc --root /var/run/docker/runtime-runsc/moby debug --stacks 63254c6ab3a6 > `/var/run/docker/runtime-[runtime-name]/moby`. If in doubt, `--root` is logged to > `runsc` logs. - ## Profiling -`runsc` integrates with Go profilling tools and gives you easy commands to profile +`runsc` integrates with Go profiling tools and gives you easy commands to profile CPU and heap usage. First you need to enable `--profile` in the command line options before starting the container: @@ -72,18 +69,18 @@ before starting the container: } ``` -> Note: Enabling profiler loosens the seccomp protection added to the sandbox, +> Note: Enabling profiling loosens the seccomp protection added to the sandbox, > and should not be run in production under normal circumstances. Then restart docker to refresh the runtime options. While the container is running, execute `runsc debug` to collect profile information and save to a file. Here are the options available: - * **--profile-heap:** It generates heap profile to the speficied file. - * **--profile-cpu:** It enables CPU profiler, waits for `--profile-delay` seconds + * **--profile-heap:** Generates heap profile to the speficied file. + * **--profile-cpu:** Enables CPU profiler, waits for `--profile-delay` seconds and generates CPU profile to the speficied file. -Here is an example:: +For example: ```bash docker run --runtime=runsc-prof --rm -d alpine sleep 1000 @@ -93,12 +90,13 @@ sudo runsc --root /var/run/docker/runtime-runsc-prof/moby debug --profile-heap=/ sudo runsc --root /var/run/docker/runtime-runsc-prof/moby debug --profile-cpu=/tmp/cpu.prof --profile-delay=30 63254c6ab3a6989623fa1fb53616951eed31ac605a2637bb9ddba5d8d404b35b ``` -The resulting files can be opened using `go tool pprof` or [pprof] -(https://github.com/google/pprof/blob/master/doc/README.md). The examples below -create image file (`.svg`) with the heap profile and writes the top functions -using CPU to the console: +The resulting files can be opened using `go tool pprof` or [pprof]. The examples +below create image file (`.svg`) with the heap profile and writes the top +functions using CPU to the console: ```bash go tool pprof -svg /usr/local/bin/runsc /tmp/heap.prof go tool pprof -top /usr/local/bin/runsc /tmp/cpu.prof ``` + +[pprof]: https://github.com/google/pprof/blob/master/doc/README.md |