Solved

Monitoring PHP executed as CLI on Ubuntu

Posted on 2010-08-17
3
413 Views
Last Modified: 2013-12-06
I'm executing a php script as CLI, depending on the resources on the server it creates additional instances of itself to leverage as much of the CPU as possible.

The problem: I did a stress test and at first it worked phenomenally, but then ground down to a snail's pace. When I run "top" at the command line I have an abnormally large percentage of my cpu designated to (50-90% usually) %w (iowait) and almost all the rest is taken up by the idle process, which would make me assume that I have processing power to spare, but my MySQL queries are taking 300x longer then their benchmarks to execute, and it takes me what seems to be ages to even login to the server via ssh... so I know something is wrong.

My question is the following: How can I verify from the command line if, and how many instances are running (without looking at the MySQL database it's updating)? I'm pretty sure if I know how to do that, I can figure out what's going on... but if anyone has any other suggestions, I'll be glad to entertain those as well.
0
Comment
Question by:Jekyll_phd
3 Comments
 
LVL 18

Assisted Solution

by:TobiasHolm
TobiasHolm earned 250 total points
ID: 33461305
Hi!

You can try 'Cacti' to monitor your performance. It is in apt, so it is easy to install and also easy to config.

Ref: http://cacti.net/

Regards, Tobias
0
 
LVL 35

Accepted Solution

by:
torimar earned 250 total points
ID: 33463225
>> "How can I verify from the command line if, and how many instances are running"

How many instances of what? Your script? Use:

ps -ef | grep scriptname

You may, of course, also use that with 'grep mysql' or 'grep http'.

Hope I didn't misunderstand you.
0
 
LVL 2

Author Comment

by:Jekyll_phd
ID: 33464955
Thanks to both of you,

@Tobias- cacti looks pretty cool, and it'll definitely serve me well in the future.

for anyone else stumbling upon this thread, these two links proved to be useful in my install
http://www.ubuntugeek.com/install-and-configure-cacti-monitoring-tool-in-ubuntu-9-10-karmic-server.html
http://forums.cacti.net/about36427.html&highlight=ereg_replace++depreciated

@torimar- yes I really am that dumb. I was completely unaware of the ps command.

I'm splitting the points because Tobias's solution will help me avoid these jams in the future, but torimar's was immediately useful.
0

Featured Post

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Little introduction about CP: CP is a command on linux that use to copy files and folder from one location to another location. Example usage of CP as follow: cp /myfoder /pathto/destination/folder/ cp abc.tar.gz /pathto/destination/folder/ab…
Introduction We as admins face situation where we need to redirect websites to another. This may be required as a part of an upgrade keeping the old URL but website should be served from new URL. This document would brief you on different ways ca…
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

786 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question