0

Somehow MySQL eats up 50% of my RAM on the server being used. I checked and there are no queries, show full processlist is empty. I restarted the mysqld and within a couple of minutes the RAM usage again went up to 40-50% while again no processes were running.

top - 14:51:55 up 1 day, 19 min,  1 user,  load average: 0.22, 0.32, 0.37
Tasks: 175 total,   1 running, 174 sleeping,   0 stopped,   0 zombie
Cpu(s):  2.3%us,  0.3%sy,  0.0%ni, 97.3%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st
Mem:   2038460k total,  1967892k used,    70568k free,    21840k buffers
Swap:  4095992k total,   458352k used,  3637640k free,   244896k cached

  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND
 2798 mysql     16   0 1254m 1.1g 4716 S  1.7 57.4   1:17.22 mysqld

I am not expert on this so I don't even know where to start looking. Anyone can give some suggestions on where to start looking? (i.e. is there a way to see what the memory is being used for?)

Here are some details on the server I have:

SERVER DATA

Kernel and CPU:     Linux 2.6.18-400.1.1.el5 on i686
Processor information:  Intel Core2 Duo CPU E7500 @ 2.93GHz, 2 cores
CPU load averages:  0.34 (1 min) 0.49 (5 mins) 0.44 (15 mins)
CPU usage:  11% user, 2% kernel, 6% IO, 81% idle
Real memory:    1.63 GB used, 1.94 GB total
Virtual memory:     447.02 MB used, 3.91 GB total
Local disk space:   59.03 GB used, 219.71 GB total

MySQL SETTINGS

bdb_log_buffer_size     262144
bulk_insert_buffer_size     8388608
concurrent_insert   1
connect_timeout     10
innodb_additional_mem_pool_size     1048576
innodb_buffer_pool_size     1073741824
innodb_doublewrite  ON
innodb_file_io_threads  4
join_buffer_size    131072
key_buffer_size     8384512
max_heap_table_size     16777216
max_insert_delayed_threads  20
max_join_size   4294967295
max_sort_length     1024
max_tmp_tables  32
max_write_lock_count    4294967295
multi_range_count   256
myisam_data_pointer_size    6
myisam_max_sort_file_size   2146435072
myisam_mmap_size    4294967295
myisam_sort_buffer_size     8388608
net_buffer_length   16384
preload_buffer_size     32768
query_alloc_block_size  8192
query_cache_limit   1048576
query_cache_min_res_unit    4096
query_cache_size    0
query_cache_type    ON
query_cache_wlock_invalidate    OFF
query_prealloc_size     8192
range_alloc_block_size  4096
read_buffer_size    131072
read_only   OFF
read_rnd_buffer_size    262144
sort_buffer_size    2097144
table_cache     64
tmp_table_size  33554432
wait_timeout    28800
  • So, MySQL is using 50% of your RAM and you are worried? Why do you need the RAM for, if not for programs to use it? – ypercubeᵀᴹ Mar 6 '15 at 14:10
  • @ypercube I am trying to debug something on this server whereby performance is one day good, the next day horrible. Right now the mysql service is busy like crazy for no reason. I want to know why that is. – koljanep Mar 6 '15 at 14:15
  • 1
    You have about 2GB of RAM and 4GB of swap and MySQL is using about 1.25GB of it. Seeing that about 0.45GB of swap memory is needed, that (swapping) may be the problem. Try to find out which processes need all that memory. If they are needed (I guess some of it is this Postfix), you could lower the amount of RAM that MySQL takes by lowering some mysql settings (for example innodb_buffer_pool_size is set to 1GB). – ypercubeᵀᴹ Mar 6 '15 at 14:25
  • 1
    For servers that run MySQL alone, it's not uncommon to have it set up so nnodb_buffer_pool_size uses up to (and sometimes more than) 70-80% of the available memory. If other processes are needed, more careful settings are needed. (like 70-80% of the memory left after other processes take over.) – ypercubeᵀᴹ Mar 6 '15 at 14:29
  • 1
    I also recently answered a related question. dba.stackexchange.com/a/94494/30545 – jynus Mar 6 '15 at 15:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.