100% of SWAP used, MySQL is cause, what to do?
Hello dear cPanel users,
on WHM server i found im using 100% of swap.
# free -m
total used free shared buffers cached
Mem: 17500 10805 6694 0 0 5934
-/+ buffers/cache: 4871 12628
Swap: 1024 1024 0
i read that someone adviced restarting mysql, httpd and i instantly i thought mysql is cause in my case. after restart, i see:
# free -m
total used free shared buffers cached
Mem: 17500 7366 10133 0 0 5991
-/+ buffers/cache: 1374 16125
Swap: 1024 11 1012
So it is back almost empty..
one can sort processes by ram usage by doing:
1) top -c
2) F key
3) o key
4) enter key
please what steps do you suggest to prevent swap being filled by mysql?
i have centos, mysql, i already ran mysqltunning scripts, here is my.cnf file
thank you
-
Hi, I need few details from you to understand the root causes of issue. 1) From top -c command, what is your output and which process is consuming more RAM & CPU utilization (like any particular DB or entire MySQL or anyother services) 2) Use the below command to check MySQL activity, some time you will face this kind of issues, if the DB using JOIN or COPY query. Also verify how long the query is running. root@xxx [~]# watch -n1 mysqladmin proc stat or root@xxx [~]# watch -n 1 mysqladmin processlist 0 -
@mageshm 1) top -c most processes are in maximum several hundreds of megabytes VIRT memory. Following process using around 5,6GB VIRT mysql 901 8.7 23.3 5755996 4187488 ? Sl 09:15 45:04 /usr/sbin/mysqld --basedir=/usr --datadir=/var/lib/mysql --plugin-dir=/usr/lib64/mysql/plugin --user=mysql --log-error=/var/lib/mysql/my.fqdn.hostname.err --open-files-limit=43762 --pid-file=/var/lib/mysql/my.fqdn.hostname.pid 2) there do not seems to be much slow queries, these are processes that are sitting there some seconds: | 162 | eximstats | localhost | eximstats | Sleep | 164 | | | | 2737 | root | localhost | | Sleep | 108 | | | | 34727 | modsec | localhost | modsec | Sleep | 1192 | | | | 120004 | leechprotect | localhost | leechprotect | Sleep | 13129 | | | | 206390 | root | localhost | | Query | 0 | | show processlist | +--------+---------------+-----------+---------------+---------+-------+-------+------------------+ 0 -
I'm not getting anything from top-c output, can you please take a screenshot and share with me if its possible. Also have a look into MySQL error log file which will help you to get some details. 0 -
i will not share my top -c output. i dont have mysql error log in /var/log, only slow_log and nothing strange in it. Anyone else please can help with some ideas on how to debug this please? Thank you 0 -
Hello :) You may need to consult with a qualified system administrator if the existing changes you have made based on a MySQL tuner have not helped. Thank you. 0
Please sign in to leave a comment.
Comments
5 comments