@@ -762,39 +762,20 @@ Note: Hosted API documentation can be found
762
762
## Performance debugging
763
763
764
764
OpenShift integrates the go ` pprof ` tooling to make it easy to capture CPU and
765
- heap dumps for running systems. The following modes are available for the
766
- ` openshift ` binary (including all the CLI variants) :
765
+ heap dumps for running systems. The pprof endpoint is available at ` /debug/pprof/ `
766
+ on the secured HTTPS port for the ` openshift ` binary :
767
767
768
- * ` OPENSHIFT_PROFILE ` environment variable:
769
- * ` cpu ` - will start a CPU profile on startup and write ` ./cpu.pprof ` .
770
- Contains samples for the entire run at the native sampling resolution (100hz).
771
- Note: CPU profiling for Go does not currently work on Mac OS X - the stats are
772
- not correctly sampled
773
- * ` mem ` - generate a running heap dump that tracks allocations to
774
- ` ./mem.pprof `
775
- * ` block ` - will start a block wait time analysis and write ` ./block.pprof `
776
- * ` web ` - start the pprof webserver in process at http://127.0.0.1:6060/debug/pprof
777
- (you can open this in a browser). This supports ` OPENSHIFT_PROFILE_HOST= `
778
- and ` OPENSHIFT_PROFILE_PORT= ` to change default ip ` 127.0.0.1 ` and default port ` 6060 ` .
779
-
780
- In order to start the server in CPU profiling mode, run:
781
-
782
- $ OPENSHIFT_PROFILE=cpu sudo ./_output/local/bin/linux/amd64/openshift start
783
-
784
- Or, if running OpenShift under systemd, append this to
785
- ` /etc/sysconfig/atomic-openshift-{master,node} `
786
-
787
- OPENSHIFT_PROFILE=cpu
768
+ $ oc get --raw /debug/pprof/profile --as=system:admin > cpu.pprof
788
769
789
770
To view profiles, you use
790
771
[ pprof] ( http://goog-perftools.sourceforge.net/doc/cpu_profiler.html ) which is
791
- part of ` go tool ` . You must pass the binary you are debugging (for symbols)
792
- and a captured pprof . For instance, to view a ` cpu ` profile from above, you
793
- would run OpenShift to completion, and then run:
772
+ part of ` go tool ` . You must pass the captured pprof file (for source lines
773
+ you will need to build the binary locally) . For instance, to view a ` cpu ` profile
774
+ from above, you would run OpenShift to completion, and then run:
794
775
795
- $ go tool pprof ./_output/local/bin/linux/amd64/openshift cpu.pprof
776
+ $ go tool pprof cpu.pprof
796
777
or
797
- $ go tool pprof $(which openshift) /var/lib/origin/cpu.pprof
778
+ $ go tool pprof /var/lib/origin/cpu.pprof
798
779
799
780
This will open the ` pprof ` shell, and you can then run:
800
781
@@ -817,19 +798,18 @@ to launch a web browser window showing you where CPU time is going.
817
798
` pprof ` supports CLI arguments for looking at profiles in different ways -
818
799
memory profiles by default show allocated space:
819
800
820
- $ go tool pprof ./_output/local/bin/linux/amd64/openshift mem.pprof
801
+ $ go tool pprof mem.pprof
821
802
822
803
but you can also see the allocated object counts:
823
804
824
- $ go tool pprof --alloc_objects ./_output/local/bin/linux/amd64/openshift
825
- mem.pprof
805
+ $ go tool pprof --alloc_objects mem.pprof
826
806
827
807
Finally, when using the ` web ` profile mode, you can have the go tool directly
828
- fetch your profiles via HTTP:
808
+ fetch your profiles via HTTP for services that only expose their profiling
809
+ contents over an unsecured HTTP endpoint:
829
810
830
811
# for a 30s CPU trace
831
- $ go tool pprof ./_output/local/bin/linux/amd64/openshift
832
- http://127.0.0.1:6060/debug/pprof/profile
812
+ $ go tool pprof http://127.0.0.1:6060/debug/pprof/profile
833
813
834
814
# for a snapshot heap dump at the current time, showing total allocations
835
815
$ go tool pprof --alloc_space ./_output/local/bin/linux/amd64/openshift
0 commit comments