InfoGrab Docs

프로파일링

pprof 프로파일 수집.

Teleport는 Go의 진단 기능을 활용하여 프로파일링 데이터를 수집하고 내보냅니다. 프로파일은 CPU 급증의 원인, 메모리 누수 출처, 또는 데드락 이유를 파악하는 데 도움이 됩니다. Debug Service 사용 # Teleport Debug Service는 관리자가 시작 시 pprof 엔드포인트를 활성화하지 않고도 진단 프로파일을 수집할 수 있게 합니다. 기본적으로 활성화된 이 서비스는 로컬 전용 접근을 보장하며 동일한 인스턴스 내부에서 사용해야 합니다. teleport debug profile 은 pprof 프로파일 목록을 수집합니다. 압축된 tarball( .tar.gz )을 STDOUT으로 출력합니다. tar 를 사용하여 압축을 풀거나 결과를 파일로 저장할 수 있습니다. 기본적으로 goroutine , heap , profile 프로파일을 수집합니다. 수집된 각 프로파일은 tarball 내부에 해당 파일을 가집니다. 예를 들어 goroutine,trace,heap 을 수집하면 goroutine.pprof , trace.pprof , heap.pprof 파일이 생성됩니다. # Collect default profiles and save to a file. $ teleport debug profile > pprof.tar.gz $ tar xvf pprof.tar.gz # Collect default profiles and decompress it. $ teleport debug profile | tar xzv -C ./ # Collect "trace" and "mutex" profiles and save to a file. $ teleport debug profile trace,mutex > pprof.tar.gz # Collect profiles setting the profiling time in seconds $ teleport debug profile -s 20 trace > pprof.tar.gz Kubernetes 클러스터에서 Teleport를 실행 중인 경우 대화형 세션 없이 직접 로컬 디렉토리로 프로파일을 수집할 수 있습니다: $ kubectl -n teleport exec my-pod -- teleport debug profile > pprof.tar.gz 내용을 추출한 후 go tool 명령으로 탐색하고 시각화할 수 있습니다: # Opens the terminal interactive explorer $ go tool pprof heap.pprof # Opens the web visualizer $ go tool pprof -http : heap.pprof # Visualize trace profiles $ go tool trace trace.pprof 진단 엔드포인트 사용 # 프로파일링 엔드포인트는 --debug 플래그가 제공된 경우에만 활성화됩니다. Teleport's diagnostic HTTP endpoints are disabled by default. You can enable them via: En