I ran into a strange problem with a Magento Store. The server was crashing when we hat a little traffic-peak so I checked what was going on. Using htop I found out that PHP5 CGI is using up to 100% CPU on a single hit. I am on a vps but the ressources should be enough to handle one hit. Since I am using Magento I think (hope) that it isn't badly written PHP, but I don't really know. I am also using varnish as a cache, so Apache runs on port 8080, but that shouldn't really matter.
OS is Ubuntu 12.04.5 LTS
My question: How can I track down what is causing this? What is a good and systematic approach to find the culprit?
These are the last entries in my Apache error log. I didn't see anything too unusual.
[Tue Apr 28 16:38:54 2015] [warn] RSA server certificate CommonName (CN) `Parallels Panel' does NOT match server name!?
[Tue Apr 28 16:38:54 2015] [warn] RSA server certificate CommonName (CN) `Parallels Panel' does NOT match server name!?
[Tue Apr 28 16:38:54 2015] [warn] RSA server certificate CommonName (CN) `Parallels Panel' does NOT match server name!?
[Tue Apr 28 16:38:54 2015] [warn] RSA server certificate CommonName (CN) `Parallels Panel' does NOT match server name!?
[Tue Apr 28 16:38:54 2015] [warn] RSA server certificate CommonName (CN) `Parallels Panel' does NOT match server name!?
[Tue Apr 28 16:38:54 2015] [warn] Init: Name-based SSL virtual hosts only work for clients with TLS server name indication support (RFC 4366)
[Tue Apr 28 16:38:54 2015] [notice] suEXEC mechanism enabled (wrapper: /usr/lib/apache2/suexec)
[Tue Apr 28 16:38:54 2015] [notice] Digest: generating secret for digest authentication ...
[Tue Apr 28 16:38:54 2015] [notice] Digest: done
[Tue Apr 28 16:38:54 2015] [error] python_init: Python version mismatch, expected '2.7.2+', found '2.7.3'.
[Tue Apr 28 16:38:54 2015] [error] python_init: Python executable found '/usr/bin/python'.
[Tue Apr 28 16:38:54 2015] [error] python_init: Python path being used '/usr/lib/python2.7/:/usr/lib/python2.7/plat-linux2:/usr/lib/python2.7/lib-tk:/usr/lib/python2.7/lib-old:/usr/lib/python2.7/lib-dynload'.
[Tue Apr 28 16:38:54 2015] [notice] mod_python: Creating 8 session mutexes based on 40 max processes and 0 max threads.
[Tue Apr 28 16:38:54 2015] [notice] mod_python: using mutex_directory /tmp
[Tue Apr 28 16:38:54 2015] [warn] RSA server certificate CommonName (CN) `Parallels Panel' does NOT match server name!?
[Tue Apr 28 16:38:54 2015] [warn] RSA server certificate CommonName (CN) `Parallels Panel' does NOT match server name!?
[Tue Apr 28 16:38:54 2015] [warn] RSA server certificate CommonName (CN) `Parallels Panel' does NOT match server name!?
[Tue Apr 28 16:38:54 2015] [warn] RSA server certificate CommonName (CN) `Parallels Panel' does NOT match server name!?
[Tue Apr 28 16:38:54 2015] [warn] RSA server certificate CommonName (CN) `Parallels Panel' does NOT match server name!?
[Tue Apr 28 16:38:54 2015] [warn] Init: Name-based SSL virtual hosts only work for clients with TLS server name indication support (RFC 4366)
[Tue Apr 28 16:38:54 2015] [notice] Apache/2.2.22 (Ubuntu) DAV/2 mod_fcgid/2.3.6 mod_python/3.3.1 Python/2.7.3 mod_ssl/2.2.22 OpenSSL/1.0.1 mod_perl/2.0.5 Perl/v5.14.2 configured -- resuming normal operations
[Tue Apr 28 16:39:07 2015] [notice] caught SIGTERM, shutting down
[Tue Apr 28 16:39:09 2015] [warn] RSA server certificate CommonName (CN) `Parallels Panel' does NOT match server name!?
[Tue Apr 28 16:39:09 2015] [warn] RSA server certificate CommonName (CN) `Parallels Panel' does NOT match server name!?
[Tue Apr 28 16:39:09 2015] [warn] RSA server certificate CommonName (CN) `Parallels Panel' does NOT match server name!?
[Tue Apr 28 16:39:09 2015] [warn] RSA server certificate CommonName (CN) `Parallels Panel' does NOT match server name!?
[Tue Apr 28 16:39:09 2015] [warn] RSA server certificate CommonName (CN) `Parallels Panel' does NOT match server name!?
[Tue Apr 28 16:39:09 2015] [warn] Init: Name-based SSL virtual hosts only work for clients with TLS server name indication support (RFC 4366)
[Tue Apr 28 16:39:09 2015] [notice] suEXEC mechanism enabled (wrapper: /usr/lib/apache2/suexec)
[Tue Apr 28 16:39:09 2015] [notice] Digest: generating secret for digest authentication ...
[Tue Apr 28 16:39:09 2015] [notice] Digest: done
This is the result of $ top
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
6452 someuser 20 0 323m 78m 9136 R 85 0.5 0:08.91 php5-cgi
6456 someuser 20 0 296m 52m 9144 R 65 0.3 0:07.14 php5-cgi
6454 someuser 20 0 294m 50m 9232 S 62 0.3 0:07.43 php5-cgi
6448 someuser 20 0 0 0 0 Z 49 0.0 0:13.56 php5-cgi <defunct>
6446 someuser 20 0 0 0 0 Z 43 0.0 0:29.30 php5-cgi <defunct>
I can provide you with more information but at the moment I just don't know where to start looking.
Thanks!