Skip to content
This repository was archived by the owner on Apr 25, 2023. It is now read-only.

Commit bde8f7d

Browse files
committed
docs: Add pprof profiling instructions
Signed-off-by: Simão Reis <[email protected]>
1 parent ece7f12 commit bde8f7d

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

docs/userguide.md

+35
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
- [`spec.placement.clusters` is not provided, `spec.placement.clusterSelector` is provided but empty](#specplacementclusters-is-not-provided-specplacementclusterselector-is-provided-but-empty)
3535
- [`spec.placement.clusters` is not provided, `spec.placement.clusterSelector` is provided and not empty](#specplacementclusters-is-not-provided-specplacementclusterselector-is-provided-and-not-empty)
3636
- [Troubleshooting](#troubleshooting)
37+
- [Profiling](#profiling)
3738
- [Cleanup](#cleanup)
3839
- [Deployment Cleanup](#deployment-cleanup)
3940
- [Namespace-scoped control plane](#namespace-scoped-control-plane)
@@ -815,6 +816,40 @@ It may also be useful to inspect the KubeFed controller log as follows:
815816
kubectl logs deployment/kubefed-controller-manager -n kube-federation-system
816817
```
817818

819+
## Profiling
820+
821+
[pprof](https://golang.org/pkg/net/http/pprof/) is a tool for visualization and
822+
analysis of profiling data.
823+
824+
To gather kubefed profiling data you need to access the kubefed
825+
controller-manager at port 8080. You can setup port forward to access the pprof
826+
debug endpoints of that pod.
827+
828+
```bash
829+
kubectl -n kube-federation-system port-forward pod/kubefed-controller-manager-XXXXX 8080:8080
830+
```
831+
832+
In another terminal you can collect the pprof profiles using curl.
833+
834+
Collect goroutine pprof as well as stack trace report and full stack traces.
835+
```bash
836+
837+
curl localhost:8080/debug/pprof/goroutine -o goroutine.pprof
838+
curl localhost:8080/debug/pprof/goroutine?debug=1 -o goroutine-debug-1.pprof
839+
curl localhost:8080/debug/pprof/goroutine?debug=2 -o goroutine-debug-2.pprof
840+
```
841+
842+
843+
Collect 30s cpu profile
844+
```bash
845+
curl localhost:8080/debug/pprof/profile -o cpu-profile.pprof
846+
```
847+
848+
Collect memory heap profile
849+
```bash
850+
curl localhost:8080/debug/pprof/heap -o heap.pprof
851+
```
852+
818853
## Cleanup
819854

820855
### Deployment Cleanup

0 commit comments

Comments
 (0)