����λ�ã���ҳ > �����̳� > �̳� > �ο�
���ʹ�� pprof ����λ���� Golang ���⣬�Ѿ���һ�� Gopher ����Ҫ���յıر������ˡ�������ʵ�ʹ�����Ҳ����ʹ��������λ�������⡣�����кܶ����������� pprof ��ʹ�ã�����ʵ�ʵ�����ʹ�ó�����ȴ�͸������µ������Ķ�����Щ���졣 �������ϴ󲿷����¶�������㣬ʹ�������д� we
���ʹ�� pprof ����λ���� Golang ���⣬�Ѿ���һ�� Gopher ����Ҫ���յıر������ˡ�������ʵ�ʹ�����Ҳ����ʹ��������λ�������⡣�����кܶ����������� pprof ��ʹ�ã�����ʵ�ʵ�����ʹ�ó�����ȴ�͸������µ������Ķ�����Щ���졣
�������ϴ󲿷����¶�������㣬ʹ�������д� web �˿ڣ���������� web ���棬���Ÿ���������� web ����鿴���������������ʵ������ǣ����ǵ����Ϸ�������������� centos ����ϵͳ�еģ����ڰ�ȫ���⣬���⣬�԰칫���粻���ܿ���web ���ʶ˿ڣ����޴�ͨ�� web ����鿴����������ʴˣ�web �������������������á�
���ϻ���һЩ���¸����㣬���ʹ�� go tool pprof ����������ʽ��λ���⡣���������ص�ǰ�������Ҫ��װ go ���ߡ���������˵������Ǽ��䲻����ģ����ǵ�����������ʹ�þ���װ����������ֻ�ᰲװ����õ�ҵ��������ļ��������ᰲװ go ���ߡ���������ʹ����άȨ������װ go ����ʴˣ���ϣ��֪������ go ���ߵ�ʱ��������Щʲô��
��ʵ��ʹ�õ�����������ʲô�����أ�- k8s ��������״̬�� centos7 ����ϵͳ�ľ��񣬾����д��������Ҫ�Ķ������������֮�⣬ֻ��װ�˻����� vi��curl ���
��ô��Ѱ��һ���ܲ���Ҫ��װ���ܿ������ Golang ��������İ취�����д˼�¼��
���ȣ�first of all���ɸ���Ϊ����֮��������׾������ڷ����п�����һ�� pprof �˿ڡ����ǵķ����� web ���͵ķ����ṩ http��ֻ��Ҫ����һ�д��뼴�ɡ�
import _ "net/http/pprof"
������� web ����Ļ����������������Ŀ�֮�⣬����Ҫ����һ�� goroutine ����������
go func() {
log.Println(http.ListenAndServe("localhost:6060", nil))
}()
��ˣ�����ķ������й����У�����ͨ�����ص� 6060 �˿����������ݻ�ȡ������֮�󣬲��������͡�
pprof ��һ���ײͣ������в��ٲ�ʳ�������ǽ�����Ҫ���ģ�����Ҫ���������붨λ�����⣬���������뿴�����¼������⣺
����ÿ�����⣬���Ƕ���Ҫʹ�� pprof �׼��ж�Ӧ�Ĺ����������
��������������� goroutine ���� Golang ���棬����һ��Ð������ô���ף����������ںܶ�ط��� go һ��������ȥ�������Ƿ���Щ����������Ԥ�ڻ������أ������������Ҫ�õ� pprof ����� goroutine �����������з����ˡ�
�� go �У����� goroutine�����Dz�����Ҫ��װ go tool ���ߣ�pprof �˿��ṩ����ֱ��ʹ�� curl ������ж�λ����������Ҳ������õķ�����
����������Ҫ��ȷ��goroutine �ķֲ���һ��״ֵ̬���ǿ���ֱ�Ӵ�ӡ�����ģ���ǰ�������ж��� goroutine���ֱ�������Щ�����������ġ�������Ҫ����ʱ��β�����
curl -o goroutine.log localhost:6060/debug/pprof/goroutine?debug=1
����� debug=1 ��������ʾ����ĸ�ʽ������ֵ�ֱ��� 1/2�Ͳ��
����дdebug=1 ��ʱ��������ǿɶ����ı�����һ�ְ��պ���ջ��������Ľ���ı���
goroutine profile: total 2065
933 @ 0x4492d6 0x415e4c 0x4158b8 0x153ddf1 0x159a61e 0x47aa41
# 0x153ddf0 github.com/Shopify/sarama.(*partitionProducer).dispatch+0x1b0 /root/go/pkg/mod/github.com/!shopify/[email protected]/async_producer.go:545
# 0x159a61d github.com/Shopify/sarama.withRecover+0x3d /root/go/pkg/mod/github.com/!shopify/[email protected]/utils.go:43
194 @ 0x4492d6 0x415e4c 0x4158b8 0x153f385 0x159a61e 0x47aa41
# 0x153f384 github.com/Shopify/sarama.(*asyncProducer).newBrokerProducer.func1+0x64 /root/go/pkg/mod/github.com/!shopify/[email protected]/async_producer.go:694
# 0x159a61d github.com/Shopify/sarama.withRecover+0x3d /root/go/pkg/mod/github.com/!shopify/[email protected]/utils.go:43
�������ı���˵���˵�ǰ�����ܹ������� 2065 �� goroutine�������г���������ǰ�� 2 ����ջ��
github.com/Shopify/sarama.(*partitionProducer).dispatch
������ 933 �� goroutine����Ԥ����
github.com/Shopify/sarama.(*asyncProducer).newBrokerProducer.func1
������ 194 �� goroutine����Ԥ����
��������ǰ����ռ�� goroutine �����Ķ�ջ���ʹ����֪��ҵ������Ƿ��� goroutine й©�ˡ�debug=1 Ҳ������õķ�����ʽ��
��д debug=2 ��ʱ�������Ҳ�ǿɶ����ı�������������ǰ��� goroutine ����Ľ���ı���
goroutine 34890598 [running]:
runtime/pprof.writeGoroutineStacks({0x2917520, 0xc002716c40})
/usr/go/src/runtime/pprof/pprof.go:693 +0x70
runtime/pprof.writeGoroutine({0x2917520, 0xc002716c40}, 0x0)
/usr/go/src/runtime/pprof/pprof.go:682 +0x2b
runtime/pprof.(*Profile).WriteTo(0x21ae7e0, {0x2917520, 0xc002716c40}, 0xc)
/usr/go/src/runtime/pprof/pprof.go:331 +0x14b
net/http/pprof.handler.ServeHTTP({0xc00b075ea1, 0xc000153000}, {0x2939d10, 0xc002716c40}, 0xc00b075e94)
/usr/go/src/net/http/pprof/pprof.go:253 +0x49a
net/http/pprof.Index({0x2939d10, 0xc002716c40}, 0xc007f8ce00)
/usr/go/src/net/http/pprof/pprof.go:371 +0x12e
net/http.HandlerFunc.ServeHTTP(0xc00428aa30, {0x2939d10, 0xc002716c40}, 0xc00b075eab)
/usr/go/src/net/http/server.go:2047 +0x2f
...
goroutine 1 [select, 6426 minutes]:
git.code.oa.com/my-go/server.(*Server).Serve(0xc000014cb0)
/root/go/pkg/mod/[email protected]/server/serve_unix.go:46 +0x3ae
main.main()
/data/__qci/root-workspaces/__qci-pipeline-251750-1/main.go:111 +0x4d6
goroutine 19 [syscall, 702 minutes]:
syscall.Syscall6(0xe8, 0x7, 0xc00020fbec, 0x7, 0xffffffffffffffff, 0x0, 0x0)
/usr/go/src/syscall/asm_linux_amd64.s:43 +0x5
golang.org/x/sys/unix.EpollWait(0x2, {0xc00020fbec, 0x2, 0xc0091c98c0}, 0xc00020fcb4)
/root/go/pkg/mod/golang.org/x/[email protected]/unix/zsyscall_linux_amd64.go:56 +0x58
github.com/fsnotify/fsnotify.(*fdPoller).wait(0xc000122300)
/root/go/pkg/mod/github.com/fsnotify/[email protected]/inotify_poller.go:86 +0x7d
github.com/fsnotify/fsnotify.(*Watcher).readEvents(0xc00010e690)
/root/go/pkg/mod/github.com/fsnotify/[email protected]/inotify.go:192 +0x2b0
created by github.com/fsnotify/fsnotify.NewWatcher
/root/go/pkg/mod/github.com/fsnotify/[email protected]/inotify.go:59 +0x1c7
����ı��dz���������ÿ�� goroutine �Ķ�ջ��Ϣ������״̬������ʱ�������˳���������ͼ������ 3 �� gorouine ��
debug=2 �ķ�ʽ�����õľ��� goroutine ������ʱ���͸���ϸ�Ķ�ջ��Ϣ����ʹ�� debug=1 ��λ�����ɶ�ջ��ʱ���ö�ջ�ĺ���ȥ debug=2 ���ң��ܴ�ſ��������Ѿ�������ã�������Ķ�ջ����Щ����ǰ�ǿ����ĸ�ϵͳ�����У��ܸ��춨λ���⡣
������ debug ��ֵ�ǿ���ֱ���ڿ���̨ͨ�� curl �� vi���в鿴�ģ����������dz�����ġ������ָ�� debug ������� goroutine.log �򿪾���һ�ֶ��������룬����ֻ��ͨ�� go tool pprof ���ߴ򿪣�������û��go tool �Ļ����У�����Ҫ��취��װ go ���ߣ��������ص��� go ���ߵĻ��������Ķ��ˡ���Ȼʹ�� go tool ���ߺ��鷳���������ܿ����������Ϣ��
curl -o goroutine.log localhost:11014/debug/pprof/goroutine
go tool pprof goroutine.log
�������̨�������ʹ�õľ���
top [100]
�������
top 100
(pprof) top100
Showing nodes accounting for 2027, 99.75% of 2032 total
Dropped 204 nodes (cum <= 10)
flat flat% sum% cum cum%
2027 99.75% 99.75% 2027 99.75% runtime.gopark
0 0% 99.75% 186 9.15% bufio.(*Reader).Peek
0 0% 99.75% 19 0.94% bufio.(*Reader).Read
0 0% 99.75% 187 9.20% bufio.(*Reader).fill
0 0% 99.75% 32 1.57% my-go/kafka.(*singleConsumerHandler).ConsumeClaim
0 0% 99.75% 16 0.79% my-go/transport.(*serverTransport).servePacket
0 0% 99.75% 16 0.79% my-go/transport.(*serverTransport).serveUDP
0 0% 99.75% 16 0.79% github.com/Shopify/sarama.(*Broker).Fetch
0 0% 99.75% 16 0.79% github.com/Shopify/sarama.(*Broker).readFull
0 0% 99.75% 62 3.05% github.com/Shopify/sarama.(*Broker).responseReceiver
0 0% 99.75% 16 0.79% github.com/Shopify/sarama.(*Broker).sendAndReceive
0 0% 99.75% 168 8.27% github.com/Shopify/sarama.(*asyncProducer).newBrokerProducer.func1
0 0% 99.75% 16 0.79% github.com/Shopify/sarama.(*brokerConsumer).fetchNewMessages
0 0% 99.75% 17 0.84% github.com/Shopify/sarama.(*brokerConsumer).subscriptionConsumer
0 0% 99.75% 17 0.84% github.com/Shopify/sarama.(*brokerConsumer).subscriptionManager
0 0% 99.75% 168 8.27% github.com/Shopify/sarama.(*brokerProducer).run
0 0% 99.75% 16 0.79% github.com/Shopify/sarama.(*bufConn).Read
0 0% 99.75% 32 1.57% github.com/Shopify/sarama.(*consumerGroupSession).consume
0 0% 99.75% 33 1.62% github.com/Shopify/sarama.(*consumerGroupSession).consume.func1
0 0% 99.75% 33 1.62% github.com/Shopify/sarama.(*consumerGroupSession).consume.func2
0 0% 99.75% 33 1.62% github.com/Shopify/sarama.(*partitionConsumer).dispatcher
0 0% 99.75% 33 1.62% github.com/Shopify/sarama.(*partitionConsumer).responseFeeder
0 0% 99.75% 933 45.92% github.com/Shopify/sarama.(*partitionProducer).dispatch
0 0% 99.75% 33 1.62% github.com/Shopify/sarama.newConsumerGroupClaim.func1
0 0% 99.75% 33 1.62% github.com/Shopify/sarama.newConsumerGroupSession.func1
0 0% 99.75% 32 1.57% github.com/Shopify/sarama.newConsumerGroupSession.func2
0 0% 99.75% 1453 71.51% github.com/Shopify/sarama.withRecover
��� top ������ʵ������Ϣ��ֵ�úú���ĥ��ĥ�ˡ�
Showing nodes accounting for 2027, 99.75% of 2032 total
����� top 100 �Ѿ�չʾ������ 2032 �� goroutine �е� 2027 ���ˣ�ռ�� 99.75%������ͨ����������Ǿ���֪����top 100 ���Ѿ��ܹ������ˣ����Բ�ͬ������ top �ĸ����ˡ�
���Ǽ�ʹ�� top100������ȫ��չʾҲ̫���ˣ�����������Ҫ����һЩ������
Dropped 204 nodes (cum <= 10)
�������ǣ������б������� cum <= 10 �ĺ��������� cum ֵ��ʲô��˼�أ�����һ��˵��
flat, sum, cum ������ֵ�� pprof �ĸ��������ж�����֣�Ҫ֪�����ǵ���˼���ܽ�һ��������
�����ӣ��������и���������funcA -> funcB -> funcC������ funcA/B/C �У����˺�������֮�⣬���Ǻ�������Ҳ����Դ��� goroutine�����Ǽ��� funcA/B/C ���Ժ��������� goroutine ��Ϊ 1/2/3��
��ô���� funcB ���ԣ����� flat ָ���� funcB ��������Լ�������������Ϊ 2���� sum ��ʾ���� funB ������������������ĺ��� funcA ��ͬ������ goroutine ��������Ϊ 1+2 =3���� cum ��ʾ���� funB �������õĺ��� funcC ������ goroutine ��������Ϊ 2+3 = 5��
��ÿ��������������ָ�������к����е�ռ�Ⱦ�Ϊ����ָ���Ӧ�İٷֱȣ�flat% sum% cum%��
��������Щ�����Ǿ�������Ϊʲô�ڵ�һ�е�gopark ����������ֵ�ˡ�
flat flat% sum% cum cum%
2027 99.75% 99.75% 2027 99.75% runtime.gopark
����һ����ײ㺯�����������е� goroutine ����֮�󶼻������������������������ goroutine ��Ϊ flat�� 2027������û���²���ã���������cum ҲΪ 2027��
�ٿ�һ���ڶ��е���ֵ��
flat flat% sum% cum cum%
0 0% 99.75% 186 9.15% bufio.(*Reader).Peek
bufio.(*Reader).Peek
����������������� goroutine��flat = 0�������ǵ������ĺ��������� goroutine ռ�� ( 99.75% )�������²���ô����� 186 �� goroutine��ռ�� 9.15%��
��������Ҫ���� goroutine й©��ʱ��Ҫ���ĸ�ֵ�أ�- �Եģ�cum��
�ҵ� cum ռ�����ĺ���������һ�����Ƕ�����ҷ�ϵͳ���ú���������Ϊϵͳ���ú���������������⣩����ô���Ǿ�֪�����ǵ��ĸ�Ӧ�ú������� goroutine й©��
��������˵�£��е�����˵������һ���� list + ������ �ķ�ʽ���г���ռ����Դ���������У���Ȼ�У���������ʹ���龰��Ϊ������ - ��Ҫ������������װԴ��+�����⡣��������������������Dz����ܵģ��������list ������ʵ�ʷ��������Լ��Ǻ����õ��ġ�
���������һ�� cpu ���ǵ����⣬���Ǿ���Ҫʹ��pprof �׼��е� profile ��������λ���ĸ�����ռ�� cpu �Ƚ϶ࡣ
����������Ҫ��ȷһ�£�
����˵��Ҫ��λһ������� cpu �������⣬����������ʵ������һ��ʱ��θ������������Ҫ��λʲôʱ����ڵ� cpu ���ġ��� - ���ﵱȻ�޷���λ��ȥʱ��� cpu ���ģ�����ֻ�ܶ�λ������ʱ�俪ʼһ��ʱ���ڵ� cpu ���ģ����������ڿ�ʼ�� 30s ��Ϊȡ�����������������ʱ���ڵ� cpu ��ʱ�ֲ���������������Ҫ�� pprof �˿����������λץȡ 30s �ڵ����ģ�ͬ��������ʹ�� curl ����ɡ�
curl -o profile.log localhost:6060/debug/pprof/profile?seconds=30
���������������seconds - ָ������ʱ�䣬�ܺ����⡣����������� profile.log ����һ�ֶ��������룬profile ��û�� debug �����ģ���ֻ��ͨ�� go tool pprof ���ߴ򿪡�������ǰ�װ go ���ߣ��������� profile.log ���� go ���ߵĻ��������Dz����Ķ���- ������DZȽ��鷳��һ���ˡ�
�������ң��Ķ��ķ���ͬ goroutine �� top �������ƣ�Ψһ��ͬ���ǣ��������Դ�����˺������ĵ� cpu ʱ�䡣
(pprof) top100
Showing nodes accounting for 4.26s, 79.92% of 5.33s total
Dropped 370 nodes (cum <= 0.03s)
Showing top 100 nodes out of 395
flat flat% sum% cum cum%
0.49s 9.19% 9.19% 0.73s 13.70% runtime.scanobject
0.43s 8.07% 17.26% 0.43s 8.07% runtime.futex
0.32s 6.00% 23.26% 0.35s 6.57% syscall.Syscall
0.23s 4.32% 27.58% 0.53s 9.94% runtime.mallocgc
0.19s 3.56% 31.14% 0.19s 3.56% runtime.epollwait
0.13s 2.44% 33.58% 0.13s 2.44% runtime.greyobject
0.13s 2.44% 36.02% 0.14s 2.63% runtime.heapBitsSetType
0.13s 2.44% 38.46% 0.13s 2.44% runtime.memmove
0.12s 2.25% 40.71% 0.12s 2.25% runtime.findObject
0.12s 2.25% 42.96% 0.12s 2.25% runtime.usleep
0.10s 1.88% 44.84% 0.80s 15.01% runtime.findrunnable
0.10s 1.88% 46.72% 0.26s 4.88% runtime.stealWork
0.08s 1.50% 48.22% 0.08s 1.50% [libc-2.28.so]
0.08s 1.50% 49.72% 0.11s 2.06% runtime.mapaccess2
0.08s 1.50% 51.22% 0.08s 1.50% runtime.memclrNoHeapPointers
0.06s 1.13% 52.35% 0.11s 2.06% go.uber.org/zap/zapcore.(*jsonEncoder).tryAddRuneSelf
0.05s 0.94% 53.28% 0.19s 3.56% google.golang.org/protobuf/internal/impl.(*MessageInfo).unmarshalPointer
0.05s 0.94% 54.22% 0.06s 1.13% runtime.lock2
0.05s 0.94% 55.16% 0.15s 2.81% runtime.mapassign_faststr
0.05s 0.94% 56.10% 0.05s 0.94% runtime.step
��η���������㿴�� goroutine �ǽڣ���֪������һ����·�ˣ����û�п������Ϸ��� - 1 �� cum ֵ��2 ���˳���ϵͳ�������ã���һ��ռ������Ӧ�ú���������Ŀ�꺯���ˣ�Ȼ��������룬��û��ʲô for ��Ñ������û��ʲô�� cpu ����Ϊ���������ˡ�
��û�� goroutine й©��ǰ���£��ڴ�Ϊʲôռ����ô���أ�������Ҫ pprof �׼��е��������ߣ�allocs �� heap��
Ϊʲô�������أ����������IJ�����allocs ��������ij��������ʷ���������е��ڴ棨�����Ѿ������˵ģ����� heap �������ǵ�ǰ��Ծ���ڴ�ռ�ö������������ܿ��� allocs �е���ֵ��� heap ���˷dz��࣬һ������ʹ�� heap �Ƚ϶ࡣ
������������� debug ���������� debug ����ֻ��Ϊ 1 ����û�С�ͬ goroutine ����һ����û�� debug ������ֻ��ͨ�� go tool �����������鷳Щ��
�����������һ���� debug=1 �Ŀɶ����ı���
curl -o allocs1.log localhost:6606/debug/pprof/allocs?debug=1
����˵һ�£�allocs �� heap ��������ʹ�� debug=1 �IJ�������ʾ��������ʵ����һ���ģ��ɶ����ı����治�������˵�ǰ��Ծ���ڴ���Ϣ��Ҳ��������ʷ�������ڴ���Ϣ�������������չʾ��
heap profile: 169: 18537048 [35672473: 126318298296] @ heap/1048576
1: 1810432 [1: 1810432] @ 0x41dbee 0x41d99c 0x1b75345 0x456203 0x456151 0x456151 0x456151 0x448ec6 0x47aa41
# 0x1b75344 github.com/mozillazg/go-pinyin.init+0x3c4 /root/go/pkg/mod/github.com/mozillazg/[email protected]/pinyin_dict.go:5
# 0x456202 runtime.doInit+0x122 /usr/go/src/runtime/proc.go:6498
# 0x456150 runtime.doInit+0x70 /usr/go/src/runtime/proc.go:6475
# 0x456150 runtime.doInit+0x70 /usr/go/src/runtime/proc.go:6475
# 0x456150 runtime.doInit+0x70 /usr/go/src/runtime/proc.go:6475
# 0x448ec5 runtime.main+0x1e5 /usr/go/src/runtime/proc.go:238
��һ��
169: 18537048 [35672473: 126318298296]
�������ǣ��������Ŀǰ��Ծ 169 ������ռ���ֽ���18537048����ʷ�й� 35672473 ������ռ���ֽ��� 126318298296�� 1048576 ��ʾ�ڴ������Ƶ�ʣ�Ĭ�ϲ���Ƶ����512kb ���������Ƶ�����������ڴ����Ƶ�ʣ�1024 x 1024����
�ڶ���
1: 1810432 [1: 1810432]
�������ǣ����������ջ��Ծ 1 ������ռ���ֽ��� 1810432����ʷֻ�й� 1 ������ռ���ֽ��� 1810432��
����ʵ��˵�������ڴ��������� curl �ķ�ʽ���ῴ�ĺ��ۣ���Ϊ��������û���κ�̫�����壬����ռ������ڴ�ģ������Ƿdz������ģ�Ҫ�������漸������֪���ĸ�ռ���ڴ�󲻺�����
����ͨ�� go tool �������鿴top ��Ϊ��ݣ�
������ allocs ����� top
(pprof) top10
Showing nodes accounting for 8273GB, 47.42% of 17444.69GB total
Dropped 2963 nodes (cum <= 87.22GB)
Showing top 10 nodes out of 267
flat flat% sum% cum cum%
1948.96GB 11.17% 11.17% 1948.96GB 11.17% go.uber.org/zap/buffer.(*Buffer).AppendByte (inline)
1260.22GB 7.22% 18.40% 1260.22GB 7.22% my-go/codec.MetaData.Clone
895.47GB 5.13% 23.53% 3649.40GB 20.92% go.uber.org/zap/zapcore.(*ioCore).Write
894.80GB 5.13% 28.66% 987.35GB 5.66% google.golang.org/protobuf/internal/encoding/text.(*Encoder).WriteName (inline)
813.76GB 4.66% 33.32% 813.76GB 4.66% go.uber.org/zap/internal/bufferpool.init.func1
780.93GB 4.48% 37.80% 3200.55GB 18.35% fmt.Sprintf
������ heap ����� top
Showing nodes accounting for 47.06MB, 50.44% of 93.30MB total
Showing top 10 nodes out of 487
flat flat% sum% cum cum%
12.93MB 13.86% 13.86% 12.93MB 13.86% google.golang.org/protobuf/internal/strs.(*Builder).AppendFullName
9.06MB 9.71% 23.57% 17.50MB 18.75% google.golang.org/protobuf/internal/filedesc.(*Message).unmarshalFull
6.11MB 6.54% 30.12% 6.11MB 6.54% github.com/rcrowley/go-metrics.newExpDecaySampleHeap
3.50MB 3.75% 33.87% 6.50MB 6.97% my-go/pkg/model/pb.v2ServiceInstancesToV1
3.01MB 3.22% 37.09% 3.01MB 3.22% github.com/Shopify/sarama.(*asyncProducer).newPartitionProducer
3MB 3.22% 40.31% 3MB 3.22% my-go/pkg/model/pb.v2StringToV1WrapperString (inline)
������Ҳ�ܿ�����alloc ����ֵ�� heap ���˲��٣����֮�£�heap ������ڷ�����ǰ�����ڴ�ռ�ø������á�
pprof �׼��л��кܶ๤�ߣ�����Щ�����أ����÷���ȥ�ǣ�ֱ�� curl Ҳ�ܿ�������
curl http://localhost:6606/debug/pprof/
����� html �����µ�������Ϣ��
204775 allocs
0 block
0 cmdline
1882 goroutine
204775 heap
0 mutex
0 profile
18 threadcreate
0 trace
allocs: A sampling of all past memory allocations
block: Stack traces that led to blocking on synchronization primitives
cmdline: The command line invocation of the current program
goroutine: Stack traces of all current goroutines
heap: A sampling of memory allocations of live objects. You can specify the gc GET parameter to run GC before taking the heap sample.
mutex: Stack traces of holders of contended mutexes
profile: CPU profile. You can specify the duration in the seconds GET parameter. After you get the profile file, use the go tool pprof command to investigate the profile.
threadcreate: Stack traces that led to the creation of new OS threads
trace: A trace of execution of the current program. You can specify the duration in the seconds GET parameter. After you get the trace file, use the go tool trace command to investigate the trace.
�� Claude �����ǽ����£�
���� Go (golang)
pprof
���ṩ�IJ�ͬ�ķ�������,ÿ�����߶����ض���Ŀ��,���ڷ����͵��� Go Ӧ�ó�����������⡣������ÿ�����ߵĹ���:
seconds
GET ����ָ�������ij���ʱ�䡣
seconds
GET ����ָ��׷�ٵij���ʱ�䡣
��Щ���߶���������Ż� Go Ӧ�ó�������ܷdz��м�ֵ,�ر����ڴ������ӵIJ���ϵͳ���ڴ��ܼ��͹�������ʱ��
�������������һ����Ϻ���ʹ���ˣ������õ�ʱ���ټ�¼�ɣ�����һֱҲ�ò�������ô��Ӧ���Ǿ�Ż����鵽����ʱ���Ӷࡣ
https://mp.weixin.qq.com/s/_MWtrXYWm5pzT8Rt3r_YDQ
https://www.cnblogs.com/hobbybear/p/17292713.html
https://go.dev/doc/diagnostics
https://jvns.ca/blog/2017/09/24/profiling-go-with-pprof/
https://segmentfault.com/a/1190000016412013
https://segmentfault.com/a/1190000019222661
https://blog.wolfogre.com/posts/go-ppof-practice/
ʹ��Blender���ɳ���ģ��
�Ķ�ȫ����������ERA5�����ط���
�Ķ�Xpath���������﷨
�Ķ�����ѧϰ�������繹�����£�
�Ķ���ΪMateƷ��ʢ�䣺HarmonyOS NEXT�ӳ�����Ϸ���ܵõ�����ͷ�
�Ķ�ʵ�ֶ��󼯺���DataTable���໥ת��
�Ķ�Ӳ�̵Ļ���֪ʶ��ѡ��ָ��
�Ķ�������й��ƶ��ı�ͼ��ײ�
�Ķ�����NEXTԪ�����������ѿ����ϼ���Ʒ
�Ķ��ᳲ���С������������Ƽ��رշ���
�Ķ������ArcMap�����н���դ��ͼ���ز�������
�Ķ��㷨�����ݽṹ 1 - ģ��
�Ķ���Ѷ�����߿ͷ���Ӫ��ϵͳ����
�Ķ���Ѷ��Ƶҹ��ģʽ���ý̳�
�Ķ����ں���NEXT��Ѫ���Ŵ���������������
�Ķ�5. Spring Cloud OpenFeign ����ʽ WebService �ͻ��˵ij���ϸʹ��
�Ķ�Java����ģʽ����̬�����Ͷ�̬�����ĶԱȷ���
�Ķ�Win11�ʼDZ����Զ�����Ӧ�õ���ɫ����ʾ����
�Ķ�˼�� V1.5.6 ��׿��
��ս�귨 V7.5.0 ��׿��
У��������������׵������� V1.0 ��׿��
��˸֮�� V1.9.7 ��׿��
������Ե����� v1.0.4 ��׿��
������֮ŠV5.2.3 ��׿��
��������������Դ V1.0 ��׿��
���֮Ϣ V1.0 ��׿��
��ħ������������䣩 V1.0 ��׿��
���ں�������ϵ�����������������վ�����������������Ƽ�����
Ƶ�� ����Ƶ��������ר������������׿�������app����
�Ƽ� ��Ô���������°��������ܿ������ز���
���� ����ɫ������������ ���������ս������������
ɨ��ά�����������ֻ��汾��
ɨ��ά����������΢�Ź��ںţ�
��վ�������������������ϴ��������ַ���İ�Ȩ���뷢�ʼ�[email protected]
��ICP��2022002427��-10 �湫��������43070202000427��© 2013~2025 haote.com ������