zoukankan      html  css  js  c++  java
  • mysql安装tcmalloc

    TCMalloc(Thread-Caching Malloc)是google-perftools工具中的一个,与标准的glibc库的malloc相比,TCMalloc在内存的分配上效率和速度要高得多,可以提高Mysql服务器在高并发情况下

    的性能,降低系统负载.

    该项目地址为:https://code.google.com/p/gperftools/

    1、64位操作系统请先安装libunwind库,32位操作系统不要安装
    wget http://download.savannah.gnu.org/releases/libunwind/libunwind-0.99-alpha.tar.gz
    tar zxvf libunwind-0.99-alpha.tar.gz
    cd libunwind-0.99-alpha/
    CFLAGS=-fPIC ./configure
    make CFLAGS=-fPIC
    make CFLAGS=-fPIC install

    2.下载对应gperftools
    https://code.google.com/p/gperftools/downloads/list


    解压配置并安装
    ./configure
    make && make install


    echo "/usr/local/lib" > /etc/ld.so.conf.d/usr_local_lib.conf
    /sbin/ldconfig

    3.修改mysql启动脚本:
    vi /usr/bin/mysqld_safe
    在# executing mysqld_safe的下一行,加上:
    export LD_PRELOAD=/usr/local/lib/libtcmalloc.so

    4、使用lsof命令查看tcmalloc是否起效:
    /usr/sbin/lsof -n | grep tcmalloc

    我在实际安装中,将
    A.export LD_PRELOAD=/usr/local/lib/libtcmalloc.so
    加入
    /etc/init.d/mysqld 文件中,使用service mysqld restart重启mysql服务
    lsof可看到
    mysqld_sa 5781    root  mem       REG              253,0  2168565     920481 /usr/local/lib/libtcmalloc.so.4.1.1


    B.将
    export LD_PRELOAD=/usr/local/lib/libtcmalloc.so
    加入/usr/bin/mysqld_safe
    使用/usr/bin/mysqld_safe &
    启动
    lsof可看到
    mysqld    6032   mysql  mem       REG              253,0  2168565     920481 /usr/local/lib/libtcmalloc.so.4.1.1

    对于该问题产生,不甚明了,与网上其他朋友配置并看到的不一致.但能肯定的是无论A方法还是B方法,tcmalloc都已经工作在mysql上了.





  • 相关阅读:
    poj 3026 Borg Maze
    poj2828 Buy Tickets
    poj3264 Balanced Lineup
    高精度运算
    poj1035 Spell checker
    poj2318 TOYS 点积叉积理解
    求两直线交点的一般做法
    C语言I博客作业05
    C语言I博客作业04
    C语言I博客作业07
  • 原文地址:https://www.cnblogs.com/itfenqing/p/4429433.html
Copyright © 2011-2022 走看看