• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Hundred of Processes Eating up CPU?

I'm not sure how to diagnose this problem and was hoping someone could point me in the right direction.

I have a website in code igniter that has hundreds of processes running and is tanking my cpu usage. If I restart mysql all the processes die and then CPU goes back to 2% usage, wait 3 days and it's back to 70%+ usage.

In htop I see hundreds of processes like this:
7377 username 15 0 98064 11604 5920 S 0.0 0.3 1:02.78 /usr/bin/php /home/username/public_html/index.php

All referencing the same file and same username.

pstack on any of them gives me the same thing:

#0 0x00000034d5ec5de0 in __read_nocancel () from /lib64/libc.so.6
#1 0x00000034daa86ee5 in vio_read_buff () from /usr/lib64/libmysqlclient.so.16
#2 0x00000034daa88129 in my_real_read () from /usr/lib64/libmysqlclient.so.16
#3 0x00000034daa88515 in my_net_read () from /usr/lib64/libmysqlclient.so.16
#4 0x00000034daa82152 in cli_safe_read () from /usr/lib64/libmysqlclient.so.16
#5 0x00000034daa83019 in cli_read_query_result () from /usr/lib64/libmysqlclient.so.16
#6 0x00000034daa818be in mysql_real_query () from /usr/lib64/libmysqlclient.so.16
#7 0x00000000005946f1 in php_mysql_do_query_general ()
#8 0x0000000000594b38 in php_mysql_do_query ()
#9 0x0000000000732709 in zend_do_fcall_common_helper_SPEC ()
#10 0x000000000073185e in execute ()
#11 0x00000000007321f8 in zend_do_fcall_common_helper_SPEC ()
#12 0x000000000073185e in execute ()
#13 0x000000000070044d in zend_call_function ()
#14 0x000000000064c3e7 in zif_call_user_func_array ()
#15 0x0000000000732709 in zend_do_fcall_common_helper_SPEC ()
#16 0x000000000073185e in execute ()
#17 0x000000000074fd42 in ZEND_INCLUDE_OR_EVAL_SPEC_TMP_HANDLER ()
#18 0x000000000073185e in execute ()
#19 0x000000000070af69 in zend_execute_scripts ()
#20 0x00000000006b7b78 in php_execute_script ()
#21 0x000000000079476f in main ()

I'm running WHM / CPanel and I tried looking at the apache logs, but I don't see anything significant.

grep 'username' error_log | less

The site is running code igniter and there's no special setup or anything, and it's not showing any PHP errors.

Outputs nothing new in over months. What would be the next steps in troubleshooting something like this?

Are you using MySQL transactions at all? An open-ended transaction can mess up performance in a hurry.

That's my first guess. It could be a lot of different things, probably. I'm not experienced with actual server performance, but I've seen bad transactions go haywire before.

What Aken said is right - transactions are the usual culprits in these kind of situations. If you are using MySql, then try running SHOW PROCESSLIST (from a client like phpmyadmin) to see which query (if any) is causing this.

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.