일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | ||||
4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 | 12 | 13 | 14 | 15 | 16 | 17 |
18 | 19 | 20 | 21 | 22 | 23 | 24 |
25 | 26 | 27 | 28 | 29 | 30 | 31 |
- Go디자인패턴
- Line차트
- 챠트그리기
- Golang부하테스트
- GObenchmark
- vue3
- go리플렉션성능
- Golangbenchmark
- snoflake
- go로드맵
- golang벤치마크
- Golang디자인패턴
- vue3 axios
- Golang벤치마킹
- Go성능테스트
- Iperf3
- vue3-chartjs
- 디자인패컨
- line챠트
- Go벤치마크
- 대역폭측정하기
- Vue.js
- Golang성능테스트
- 리플렉션성능
- vue3 통신
- golang uuid
- GO벤치마킹
- 디자인패턴학습필요성
- pprof
- GO부하테스트
- Today
- Total
import ( "코딩", "행복", "즐거움" )
pprof 본문
pprof??
GO의 프로파일링(profile) 도구다
우리 팀에서는 이 도구로 메모리 누수를 잡은 적이 있다.
매우 유용한 도구이기 때문에 Go로 프로젝트를 한다면
추천한다.
Go의 웹프레임워크 중에 가장 유명한 gin 을 사용 중인데
gin의 pprof 패키지는 이걸 사용한다.
https://github.com/DeanThompson/ginpprof
GitHub - DeanThompson/ginpprof: A wrapper for golang web framework gin to use net/http/pprof easily.
A wrapper for golang web framework gin to use net/http/pprof easily. - GitHub - DeanThompson/ginpprof: A wrapper for golang web framework gin to use net/http/pprof easily.
github.com
ginpprof를 import 하고 Wrap()를 사용하여 프로젝트와 연결 한다.
"github.com/DeanThompson/ginpprof"
ginpprof.Wrap(...)
위의 ... 부분에 *gin.Engine 을 연결 해주면 된다.
이후 서버를 띄우고 나면 언제든지 웹 페이지를 통해서 프로파일 정보를 가져올 수 있다.
http://localhost:3000/debug/pprof/
프로파일링을 그래프화 해서 한눈에 볼 수 있다.
아래와 같이 링크주소로 요청 하면
파일을 내려 받게 된다.
http://localhost:3000/debug/pprof/heap
http://localhost:3000/debug/pprof/profile
위 파일들을 아래 사이트에서 upload하고
웹에서 분석 할 수 있다.
https://pprofweb.evanjones.ca/
PProf Web Interface
PProf Web Interface Upload a file to explore it using the Pprof web interface. See the documentation/source code. This is currently a hack: it runs in Google Cloud Run, which will restart instances whenever it wants. This means your state may get lost at a
pprofweb.evanjones.ca
'GO' 카테고리의 다른 글
GO 백엔드 개발자 학습 로드맵 (0) | 2022.11.16 |
---|---|
GO 디자인 패턴에 관심이 있다면 ?? (0) | 2022.11.16 |
Golang 벤치마킹 함수 성능 개선 (0) | 2022.11.15 |
메모리 절약 패키지, fieldalignment 사용 (0) | 2022.10.03 |
Go 필드 정렬해서 메모리 절약하기 (0) | 2022.10.03 |