Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Monitoring PHP executed as CLI on Ubuntu

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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Coding C# in Linux 8 119
Web resource - Man pages for SUSE Enterprise Linux 11 1 40
CentOS 7 Linux for HP DL380 G4 32Bits 7 45
LogmeIn using Linux Ubuntu 16.04 6 58
The purpose of this article is to demonstrate how we can upgrade Python from version 2.7.6 to Python 2.7.10 on the Linux Mint operating system. I am using an Oracle Virtual Box where I have installed Linux Mint operating system version 17.2. Once yo…
The purpose of this article is to demonstrate how we can use conditional statements using Python.
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

791 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