*. 대상 : DBSVR (mariadb 10.4.18 , CentOS Linux release 7.6.1810 (Core))
*. 메모리 할당자 : tcmalloc
http://goog-perftools.sourceforge.net/doc/tcmalloc.html
https://mysqldba.tistory.com/271 <-- 설치 및 my.cnf 설정
*. 적용 시간 : 2021-05-13 10:51:27 KST
##########################################################################
## gperftools 설치
##########################################################################
sudo yum install google-perftools <-- old
yum install gperftools
Installed:
gperftools.x86_64 0:2.6.1-1.el7
Dependency Installed:
atk.x86_64 0:2.28.1-1.el7 cairo.x86_64 0:1.15.12-3.el7 cups-libs.x86_64 1:1.6.3-35.el7 dejavu-fonts-common.noarch 0:2.33-6.el7 dejavu-sans-fonts.noarch 0:2.33-6.el7
fontconfig.x86_64 0:2.13.0-4.3.el7 fontpackages-filesystem.noarch 0:1.44-8.el7 fribidi.x86_64 0:1.0.2-1.el7 gd.x86_64 0:2.0.35-26.el7 gdk-pixbuf2.x86_64 0:2.36.12-3.el7
ghostscript.x86_64 0:9.07-31.el7_6.11 ghostscript-fonts.noarch 0:5.50-32.el7 gperftools-devel.x86_64 0:2.6.1-1.el7 gperftools-libs.x86_64 0:2.6.1-1.el7 graphite2.x86_64 0:1.3.10-1.el7_3
graphviz.x86_64 0:2.30.1-21.el7 gtk-update-icon-cache.x86_64 0:3.22.30-3.el7 gtk2.x86_64 0:2.24.31-1.el7 harfbuzz.x86_64 0:1.7.5-2.el7 hicolor-icon-theme.noarch 0:0.12-7.el7
jasper-libs.x86_64 0:1.900.1-33.el7 jbigkit-libs.x86_64 0:2.0-11.el7 lcms2.x86_64 0:2.6-3.el7 libICE.x86_64 0:1.0.9-9.el7 libSM.x86_64 0:1.2.2-2.el7
libX11.x86_64 0:1.6.5-2.el7 libX11-common.noarch 0:1.6.5-2.el7 libXau.x86_64 0:1.0.8-2.1.el7 libXaw.x86_64 0:1.0.13-4.el7 libXcomposite.x86_64 0:0.4.4-4.1.el7
libXcursor.x86_64 0:1.1.15-1.el7 libXdamage.x86_64 0:1.1.4-4.1.el7 libXext.x86_64 0:1.3.3-3.el7 libXfixes.x86_64 0:5.0.3-1.el7 libXft.x86_64 0:2.3.2-2.el7
libXi.x86_64 0:1.7.9-1.el7 libXinerama.x86_64 0:1.1.3-2.1.el7 libXmu.x86_64 0:1.1.2-2.el7 libXpm.x86_64 0:3.5.12-1.el7 libXrandr.x86_64 0:1.5.1-2.el7
libXrender.x86_64 0:0.9.10-1.el7 libXt.x86_64 0:1.1.5-3.el7 libXxf86vm.x86_64 0:1.1.4-1.el7 libfontenc.x86_64 0:1.1.3-3.el7 libglvnd.x86_64 1:1.0.1-0.8.git5baa1e5.el7
libglvnd-egl.x86_64 1:1.0.1-0.8.git5baa1e5.el7 libglvnd-glx.x86_64 1:1.0.1-0.8.git5baa1e5.el7 librsvg2.x86_64 0:2.40.20-1.el7 libthai.x86_64 0:0.1.14-9.el7 libtiff.x86_64 0:4.0.3-27.el7_3
libtool-ltdl.x86_64 0:2.4.2-22.el7_3 libwayland-client.x86_64 0:1.15.0-1.el7 libwayland-server.x86_64 0:1.15.0-1.el7 libxcb.x86_64 0:1.13-1.el7 libxshmfence.x86_64 0:1.2-1.el7
mesa-libEGL.x86_64 0:18.0.5-4.el7_6 mesa-libGL.x86_64 0:18.0.5-4.el7_6 mesa-libgbm.x86_64 0:18.0.5-4.el7_6 mesa-libglapi.x86_64 0:18.0.5-4.el7_6 pango.x86_64 0:1.42.4-2.el7_6
poppler-data.noarch 0:0.4.6-3.el7 pprof.noarch 0:2.6.1-1.el7 urw-fonts.noarch 0:2.4-16.el7 xorg-x11-font-utils.x86_64 1:7.5-21.el7
Complete!
*. 설치 확인
[root@DBSVR ~]# cd /usr/lib64
[root@DBSVR lib64]# ll libtc*
lrwxrwxrwx 1 root root 33 May 13 10:34 libtcmalloc_and_profiler.so -> libtcmalloc_and_profiler.so.4.4.5
lrwxrwxrwx 1 root root 33 May 13 10:34 libtcmalloc_and_profiler.so.4 -> libtcmalloc_and_profiler.so.4.4.5
-rwxr-xr-x 1 root root 322192 Apr 11 2018 libtcmalloc_and_profiler.so.4.4.5
lrwxrwxrwx 1 root root 26 May 13 10:34 libtcmalloc_debug.so -> libtcmalloc_debug.so.4.4.5
lrwxrwxrwx 1 root root 26 May 13 10:34 libtcmalloc_debug.so.4 -> libtcmalloc_debug.so.4.4.5
-rwxr-xr-x 1 root root 358608 Apr 11 2018 libtcmalloc_debug.so.4.4.5
lrwxrwxrwx 1 root root 34 May 13 10:34 libtcmalloc_minimal_debug.so -> libtcmalloc_minimal_debug.so.4.4.5
lrwxrwxrwx 1 root root 34 May 13 10:34 libtcmalloc_minimal_debug.so.4 -> libtcmalloc_minimal_debug.so.4.4.5
-rwxr-xr-x 1 root root 212288 Apr 11 2018 libtcmalloc_minimal_debug.so.4.4.5
lrwxrwxrwx 1 root root 28 May 13 10:34 libtcmalloc_minimal.so -> libtcmalloc_minimal.so.4.4.5 <--- 이파일
lrwxrwxrwx 1 root root 28 May 13 10:34 libtcmalloc_minimal.so.4 -> libtcmalloc_minimal.so.4.4.5 <--- 이파일
-rwxr-xr-x 1 root root 154776 Apr 11 2018 libtcmalloc_minimal.so.4.4.5
lrwxrwxrwx 1 root root 20 May 13 10:34 libtcmalloc.so -> libtcmalloc.so.4.4.5
lrwxrwxrwx 1 root root 20 May 13 10:34 libtcmalloc.so.4 -> libtcmalloc.so.4.4.5
-rwxr-xr-x 1 root root 301136 Apr 11 2018 libtcmalloc.so.4.4.5
*. 메모리 할당자 경로 : /usr/lib64/libtcmalloc_minimal.so
##########################################################################
## mariadb.service 설정 변경
##########################################################################
*. 서비스 파일 경로 /usr/lib/systemd/system/mariadb.service
--------------------------------------------------------------------------
[Service]
# for gperftools - tcmalloc
Environment="LD_PRELOAD=/usr/lib64/libtcmalloc_minimal.so.4"
--------------------------------------------------------------------------
[root@DBSVR lib]# systemctl daemon-reload
##########################################################################
## 적용확인
##########################################################################
*. 적용전
SQL > SHOW GLOBAL VARIABLES LIKE 'version_malloc_library';
Variable_name Value
---------------------- --------
version_malloc_library system
*. 적용
[root@DBSVR lib]# systemctl stop mariadb.service
[root@DBSVR lib]# systemctl start mariadb.service
*. 적용후
SQL > SHOW GLOBAL VARIABLES LIKE 'version_malloc_library';
Variable_name Value
---------------------- ---------------------------
version_malloc_library tcmalloc gperftools 2.6.1
[root@DBSVR lib]# systemctl status mariadb.service
● mariadb.service - MariaDB 10.4.18 database server
Loaded: loaded (/usr/lib/systemd/system/mariadb.service; disabled; vendor preset: disabled)
Drop-In: /etc/systemd/system/mariadb.service.d
└─migrated-from-my.cnf-settings.conf
Active: active (running) since Thu 2021-05-13 10:51:27 KST; 2min 18s ago
Docs: man:mysqld(8)
https://mariadb.com/kb/en/library/systemd/
Process: 700 ExecStartPost=/bin/sh -c systemctl unset-environment _WSREP_START_POSITION (code=exited, status=0/SUCCESS)
Process: 563 ExecStartPre=/bin/sh -c [ ! -e /usr/bin/galera_recovery ] && VAR= || VAR=`cd /usr/bin/..; /usr/bin/galera_recovery`; [ $? -eq 0 ] && systemctl set-environment _WSREP_START_POSITION=$VAR || exit 1 (code=exited, status=0/SUCCESS)
Process: 561 ExecStartPre=/bin/sh -c systemctl unset-environment _WSREP_START_POSITION (code=exited, status=0/SUCCESS)
Main PID: 667 (mysqld)
Status: "Taking your SQL requests now..."
CGroup: /system.slice/mariadb.service
└─667 /usr/sbin/mysqld
May 13 10:51:27 DBSVR mysqld[667]: 210513 10:51:27 server_audit: server_audit_incl_users set to 'root'.
May 13 10:51:27 DBSVR mysqld[667]: 210513 10:51:27 server_audit: MariaDB Audit Plugin version 1.4.10 STARTED.
May 13 10:51:27 DBSVR mysqld[667]: 210513 10:51:27 server_audit: Query cache is enabled with the TABLE events. Some table reads can be veiled.210513 10:51:27 server_audit: logging started to the f...rver_audit.log.
May 13 10:51:27 DBSVR mysqld[667]: 2021-05-13 10:51:27 0 [Note] Server socket created on IP: '::'.
May 13 10:51:27 DBSVR mysqld[667]: 2021-05-13 10:51:27 0 [Warning] 'proxies_priv' entry '@% root@DBSVR' ignored in --skip-name-resolve mode.
May 13 10:51:27 DBSVR mysqld[667]: 2021-05-13 10:51:27 0 [Note] Reading of all Master_info entries succeeded
May 13 10:51:27 DBSVR mysqld[667]: 2021-05-13 10:51:27 0 [Note] Added new Master_info '' to hash table
May 13 10:51:27 DBSVR mysqld[667]: 2021-05-13 10:51:27 0 [Note] /usr/sbin/mysqld: ready for connections.
May 13 10:51:27 DBSVR mysqld[667]: Version: '10.4.18-MariaDB' socket: '/var/lib/mysql/mysql.sock' port: 3306 MariaDB Server
May 13 10:51:27 DBSVR systemd[1]: Started MariaDB 10.4.18 database server.