htop
my.cnf
[client]
#password = your_password
port = 3306
socket = /tmp/mysql.sock
[mysqld]
port = 3306
socket = /tmp/mysql.sock
datadir = /data/mysql/var
skip-external-locking
key_buffer_size = 256M
max_allowed_packet = 40M #默认为 1M ( 2016-09-20 09:59 )
table_open_cache = 1024
sort_buffer_size = 4M
net_buffer_length = 8K
read_buffer_size = 4M
read_rnd_buffer_size = 512K
myisam_sort_buffer_size = 64M
thread_cache_size = 128
query_cache_size = 128M
tmp_table_size = 128M
#skip-networking
max_connections = 500
max_connect_errors = 100
open_files_limit = 65535
log-bin=mysql-bin
binlog_format=mixed
server-id = 1
expire_logs_days = 10
default_storage_engine = InnoDB
innodb_data_home_dir = /data/mysql/var
innodb_data_file_path = ibdata1:10M:autoextend
innodb_log_group_home_dir = /data/mysql/var
innodb_buffer_pool_size = 1024M
innodb_additional_mem_pool_size = 2M
innodb_log_file_size = 256M
innodb_log_buffer_size = 8M
innodb_flush_log_at_trx_commit = 1
innodb_lock_wait_timeout = 50
[mysqldump]
quick
max_allowed_packet = 25M
[mysql]
no-auto-rehash
[myisamchk]
key_buffer_size = 256M
sort_buffer_size = 4M
read_buffer = 2M
write_buffer = 2M
[mysqlhotcopy]
interactive-timeout
1
msg7086 2018-02-26 09:22:42 +08:00 1
内存占用 2.1%,我觉得还好啊?
|
3
chenqh 2018-02-26 09:26:26 +08:00 via iPhone 1
htop 的 bug 你用 top 看
|
4
msg7086 2018-02-26 09:28:24 +08:00 1
很多个 2.1%也是 2.1%啊,又不会加起来……
你先切成树状图看看,MySQL 那么多都是线程啊,内存是线程间共享的好么。 |
5
kungfuchicken 2018-02-26 09:28:26 +08:00 1
|
6
suconghou 2018-02-26 09:29:05 +08:00 1
|
7
my101du 2018-02-26 09:40:28 +08:00 1
根据这篇 http://seanlook.com/2017/10/13/mysql-table_open_cache_file_limits/ ,可能使用了预分配内存。
经测试,我在本地开发环境中使用 performance_schema_max_table_instances=400 table_definition_cache=400 table_open_cache=256 初始大概只占用 100M,运行一些查询后,也只有几百 M 的样子。 你的生产环境应该需要适当调整。 |
8
chenxytw 2018-02-26 10:22:47 +08:00 1
内存才占 2.1%...... 你的内存都用来干嘛了 0 0
和其他服务挤在一起了? 数据库如果为了比较良好的查询效率 0 0 当然是越高内存越好 0 0 |
9
realpg 2018-02-26 12:54:29 +08:00 3
加上一句这个,一般立竿见影:
performance_schema = OFF |
11
realpg 2019-10-25 00:09:37 +08:00 1
@mrjiejiejie #10
多年老中医好使吧。。。 |