MySQL does NOT use available memory

I am moving from a public web hosting company to VPS. And I'm trying to find the best configuration for my system.

For 1 specific table with half a million records, 1 query, which takes several seconds on the previous server, now takes minutes.

I am trying to improve the response time of my server, so I bought more memory (I have 2 GB of RAM, and I can still buy more resources, if necessary, and 2 cores). I also "tricked" by copying my.cnf of the old company to my VPS:

[mysqld]
read_buffer_size=8M
read_rnd_buffer_size=8M
sort_buffer_size=32M
innodb_additional_mem_pool_size=503M
innodb_flush_log_at_trx_commit=1
innodb_log_buffer_size=16M
innodb_buffer_pool_size=1007M
innodb_log_file_size=256M
innodb_thread_concurrency=8
innodb_autoextend_increment=128
max_connections=8059
max_user_connections=50
thread_cache_size=128
thread_stack=196608
binlog_cache_size=2M
net_read_timeout=30
net_retry_count=10
net_write_timeout=30
thread_concurrency=10
open_files_limit=9940
max_heap_table_size=32M
tmp_table_size=64M
key_buffer_size=512M
key_buffer=128M
myisam_sort_buffer_size=64M
join_buffer=16M
record_buffer=8M
wait_timeout=300
connect_timeout=10
max_allowed_packet=16M
max_connect_errors=100
table_cache=1024
query_cache_size=32M
query_cache_type=1
ft_min_word_len=4
datadir=/var/lib/mysql
tmpdir=/tmp
socket=/var/lib/mysql/mysql.sock
old-passwords=0
[mysqldump]
quick
max_allowed_packet=16M
[myisamchk]
key_buffer=64M
sort_buffer=64M
read_buffer=16M
write_buffer=16M

The problem is that the request is still slow and the server is not using the available memory!

              total       used       free     shared    buffers     cached
Mem:          2002       1986         15          0          6       1079
-/+ buffers/cache:        901       1101
Swap:         1747          2       1745

Any suggestions?

Hi

+5
source share
1 answer

https://github.com/rackerhacker/MySQLTuner-perl

MySQL, .

2gb. IE max_connections = 8059 , .

[mysqld]
max_connections=100
innodb_buffer_pool_size=256M
query_cache_size=256M
key_buffer_size=256M
innodb_flush_log_at_trx_commit=0
innodb_flush_method=O_DIRECT
query_cache_type=1
query_cache_limit=2M
table_cache=1024
join_buffer_size=4M
thread_cache_size=128
tmp_table_size=256M
max_heap_table_size=256MB

2gb RAM MySQL 2gb,

+4

All Articles