pprof 分析mysqld 記憶體呼叫(筆記)

darren__chan發表於2021-12-14
----   Install TCMALLOC
   
1.unpack
tar zxvf   gperftools-2.9.1.tar.gz
./configure   --enable-frame-pointers --prefix=/usr/lib --libdir=/usr/lib
make   && make install 
IF:
configure:   WARNING: No frame pointers and no libunwind. Using experimental backtrace   capturing via l
workaround:
or
yum -y   install libunwind
   
   
   
   
   
----   tracking mysqld 
[mysql@00-0C-29-46-BE-F3 ~]LD_PRELOAD=/usr/lib/libtcmalloc_and_profiler.so.4 HEAPPROFILE=/tmp/mysql-profile /usr/local/mysql/bin/mysqld --defaults-file=/etc/my3307.cnf
Starting tracking the heap
----   Install google-perftools
[root@00-0C-29-46-BE-F3 /etc/yum.repos.d]# yum install google-perftools
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * base: mirrors.aliyun.com
 * extras: mirrors.aliyun.com
 * updates: mirrors.aliyun.com
Resolving Dependencies
--> Running transaction check
---> Package pprof.noarch 0:2.6.1-1.el7 will be installed
--> Processing Dependency: graphviz for package: pprof-2.6.1-1.el7.noarch
--> Running transaction check
---> Package graphviz.x86_64 0:2.30.1-22.el7 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
===========================================================================================================================================================================================
 Package                                      Arch                                       Version                                            Repository                                Size
===========================================================================================================================================================================================
Installing:
 pprof                                        noarch                                     2.6.1-1.el7                                        base                                      52 k
Installing for dependencies:
 graphviz                                     x86_64                                     2.30.1-22.el7                                      base                                     1.3 M
Transaction Summary
===========================================================================================================================================================================================
Install  1 Package (+1 Dependent package)
Total download size: 1.3 M
Installed size: 4.0 M
Is this ok [y/d/N]: y
Downloading packages:
warning: /var/cache/yum/x86_64/7/base/packages/pprof-2.6.1-1.el7.noarch.rpm: Header V3 RSA/SHA256 Signature, key ID f4a80eb5: NOKEY                      ]  0.0 B/s |    0 B  --:--:-- ETA 
Public key for pprof-2.6.1-1.el7.noarch.rpm is not installed
(1/2): pprof-2.6.1-1.el7.noarch.rpm                                                                                                                                 |  52 kB  00:00:00     
(2/2): graphviz-2.30.1-22.el7.x86_64.rpm                                                                                                                            | 1.3 MB  00:00:00     
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                                                                      1.3 MB/s | 1.3 MB  00:00:01     
Retrieving key from 
Importing GPG key 0xF4A80EB5:
 Userid     : "CentOS-7 Key (CentOS 7 Official Signing Key) <security@centos.org>"
 Fingerprint: 6341 ab27 53d7 8a78 a7c2 7bb1 24c6 a8a7 f4a8 0eb5
 From       : 
Is this ok [y/N]: y
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : graphviz-2.30.1-22.el7.x86_64                                                                                                                                           1/2 
  Installing : pprof-2.6.1-1.el7.noarch                                                                                                                                                2/2 
  Verifying  : pprof-2.6.1-1.el7.noarch                                                                                                                                                1/2 
  Verifying  : graphviz-2.30.1-22.el7.x86_64                                                                                                                                           2/2 
Installed:
  pprof.noarch 0:2.6.1-1.el7                                                                                                                                                               
Dependency Installed:
  graphviz.x86_64 0:2.30.1-22.el7                                                                                                                                                          
Complete!
----   Generate svg report
[root@00-0C-29-46-BE-F3 /tmp]# pprof --svg  /usr/local/mysql/bin/mysqld mysql-profile.0001.heap 
Using local file /usr/local/mysql/bin/mysqld.
Using local file mysql-profile.0001.heap.
Dropping nodes with <= 0.5 MB; edges with <= 0.1 abs(MB)
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
 "
<!-- Generated by graphviz version 2.30.1 (20201013.1554)
 -->
<!-- Title: /usr/local/mysql/bin/mysqld; 100.0 MB Pages: 1 -->
<svg width="100%" height="100%"


來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/29863023/viewspace-2847735/,如需轉載,請註明出處,否則將追究法律責任。

相關文章