DirectAdmin安装TCMalloc优化MySQL
64位系统需要安装libunwind
wget http://download.savannah.gnu.org/releases/libunwind/libunwind-1.1.tar.gz tar zxvf libunwind-1.1-alpha.tar.gz cd libunwind-1.1-alpha/ CFLAGS=-fPIC ./configure make CFLAGS=-fPIC make CFLAGS=-fPIC install
安装TCMalloc
wget http://pkgs.fedoraproject.org/repo/pkgs/gperftools/gperftools-2.4.tar.gz/2171cea3bbe053036fb5d5d25176a160/gperftools-2.4.tar.gz tar zxvf gperftools-2.4.tar.gz cd gperftools-2.4/ ./configure make && make install echo "/usr/local/lib" > /etc/ld.so.conf.d/usr_local_lib.conf /sbin/ldconfig
MySQL载入
vi /usr/bin/mysqld_safe #找到 # executing mysqld_safe,在下面加入: export LD_PRELOAD=/usr/local/lib/libtcmalloc.so service mysqld restart #检查是否生效 lsof -n | grep tcmalloc
优化MySQL配置文件
[mysqld] # WEED 2015-06-06 #default-storage-engine=MyISAM open_files_limit=60000 innodb_file_per_table=1 local-infile=0 key_buffer_size = 32M max_allowed_packet = 128M max_connections = 150 max_user_connections = 50 wait_timeout=30 interactive_timeout=45 connect_timeout=10 tmp-table-size = 256M max-heap-table-size = 256M sort_buffer_size = 1M read_buffer_size = 2M read_rnd_buffer_size = 8M myisam_sort_buffer_size = 64M thread_cache_size = 8 query_cache_size = 32M innodb-flush-method = O_DIRECT innodb-log-files-in-group = 2 innodb-flush-log-at-trx-commit = 1 innodb-buffer-pool-size = 64M #innodb-buffer-pool-instances = 2 innodb_buffer_pool_instances = 1 join_buffer_size = 32M table_open_cache=64 innodb_buffer_pool_size=2G innodb_thread_concurrency=8 tmpdir = /dev/shm [mysqldump] quick max_allowed_packet = 16M [mysql] no-auto-rehash [myisamchk] key_buffer = 256M sort_buffer_size = 256M read_buffer = 2M write_buffer = 2M [mysqlhotcopy] interactive-timeout
该处可参考:http://help.directadmin.com/item.php?id=44