Solved

Monitoring PHP executed as CLI on Ubuntu

Posted on 2010-08-17
3
405 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

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

This document is written for Red Hat Enterprise Linux AS release 4 and ORACLE 10g.  Earlier releases can be installed using this document as well however there are some additional steps for packages to be installed see Metalink. Disclaimer: I hav…
In my business, I use the LTS (Long Term Support) versions of Linux. My workstations do real work, and so I rarely have the patience to deal with silly problems caused by an upgraded kernel that had experimental software on it to begin with from a r…
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.

747 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now