I am very new to linux server .I am using centos.Sometimes my cpu gets overloaded because of the process mysqld over 100%
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND 2221 mysql 20 0 2810m 797m 5648 S 99.3 5.0 262:15.91 mysqld
So To debug I ran top command in ssh and I got below
Cpu(s): 2.9%us, 2.3%sy, 0.0%ni, 94.7%id, 0.0%wa, 0.0%hi, 0.1%si, 0.0%st Mem: 16291440k total, 14893024k used, 1398416k free, 1673232k buffers Swap: 16433144k total, 30168k used, 16402976k free, 10713048k cached
I dont understand anything in this but i see , Only one CPU (94.7%id) is used alot and other CPU are free.How to make mysql to share more cpu and reduce the load.
Answer
Row 3 : in top command indicates how the cpu is used. Understand each one separately
% of the CPU for user processes (2.9%us)
% of the CPU for system processes (2.3%sy)
% of the CPU processes with priority upgrade nice (0.0%ni)
% of the CPU not used (94.7%id)
% of the CPU processes waiting for I/O operations(0.0%wa)
% of the CPU serving hardware interrupts (0.0% hi)
% of the CPU serving software interrupts (0.1% si)
Row 4 and 5: Gives RAM (physical memory) and SWAP details.
This shows the Processes List
%CPU – % of CPU used by this process (99.3)
%MEM – % of RAM used by the process (5.0)
For CPU allocation refer
https://askubuntu.com/questions/115478/how-do-i-assign-different-cpu-cores-to-different-processes
Attribution
Source : Link , Question Author : Vishnu , Answer Author : Community