Too Much Processing (CPU)

G

Garrett Smith

I received a notice from my web host that my app uses too much CPU:

| 25399 [username] 20 0 333m 156m 11m S 90.5 0.5 2296:08 jsvc
|
| The next to the last column shows total CPU time in hours.

How did the web host generate the information for CPU usage? What does
it mean? What can I do about it?
 
G

Garrett Smith

markspace said:
Garrett said:
I received a notice from my web host that my app uses too much CPU:

| 25399 [username] 20 0 333m 156m 11m S 90.5 0.5 2296:08 jsvc
|
| The next to the last column shows total CPU time in hours.

How did the web host generate the information for CPU usage? What does
it mean? What can I do about it?


Normally CPU usage accounting is built into the OS. Example:

<http://www.faqs.org/docs/Linux-mini/Process-Accounting.html>

What is means is that you used up your allocated CPU and you need to
wait until next month or you need to buy a bigger package. Or it means
you have a run-away process that just chewed up you whole month's
allocation.

Apparently I was not clear enough. How is the number |2296:08| to be
interpreted? What unit? Seconds?
What you can do about it is: determine root cause, then take appropriate
measure (write a cheque, or fix the bug).

How can I determine the root cause of the issue and how can I fix it
(what can I do about it)?
 
R

Roedy Green

How did the web host generate the information for CPU usage? What does
it mean? What can I do about it?

If your host is a Pentium, it has a machine cycle counting register.
If the OS samples it, it can do accounting by process. See
http://mindprod.com/products1.html#PENTIUM
--
Roedy Green Canadian Mind Products
http://mindprod.com

I advocate that super programmers who can juggle vastly more complex balls than average guys can, should be banned, by management, from dragging the average crowd into system complexity zones where the whole team will start to drown.
~ Jan V.
 
R

Roedy Green

You could set up Tomcat or other womb on your local machine, and use
the usual debugging/profiling tools to find out where your apps are
chewing up CPU time. Chances are it will be the same place it is
eating up time on the server.
--
Roedy Green Canadian Mind Products
http://mindprod.com

I advocate that super programmers who can juggle vastly more complex balls than average guys can, should be banned, by management, from dragging the average crowd into system complexity zones where the whole team will start to drown.
~ Jan V.
 
G

Garrett Smith

Roedy said:
You could set up Tomcat or other womb on your local machine, and use
the usual debugging/profiling tools to find out where your apps are
chewing up CPU time. Chances are it will be the same place it is
eating up time on the server.

I have tomcat 6 running locally. SOme of the blog entries are different
here, as I have not backed up my mysql db locally, so it is not exactly
the same.

I can use a bookmarklet to fire requests on a 10 or so browsers here to
simulate a heavier load.

Which tool can I use to determine what is chewing up CPU time?
 
G

Garrett Smith

[snip informative explanation]

Thanks.
If you need more information about your processes, you'll need to ask
your service provider.

I need to get the right answers that lead to finding the problem. Which
questions to ask about "processes"?

I am trying to fix anything that throws an error in the log file, as
errors are obviously bad for performance.

I have my own JVM and this should be configurable. I do not know how to
do that, but first I am trying to find the source of that problem.

I have asked them a few questions (below). The response was shut down
service. No answer to any of:-

| I am noticing about a threefold decrease in performance on the new
| server. Latency was about 1-2s, but now about 5-6s.
|
| Is there something different in JAVA_OPTS or CATALINA_OPTS? Can I
| access these variables? Where?
|
| (I removed some tags from my blog and restarted tomcat again. Latency
| was not noticeably improved.)
|
| Which options can I set for the JVM?
|
| There seem to be a good deal of options that could be tweaked, e.g.
| "SurvivorRatio, NewSize, MaxNewSize".
| http://java.sun.com/javase/technologies/hotspot/gc/gc_tuning_6.html
|
| Can I set options? (such as, for example: "-server -ms256m -mx256m
| -XX:NewSize=128m -XX:MaxNewSize=128m -XX:SurvivorRatio=4" ) How?
|
| How can I monitor CPU remotely?
|

If you need help profiling a specific Java
application, you're in the right place here, but you'll need to provide
more information.

I'll read the man page for "top" to see what I can monitor locally.

I am running a webapp on Tomcat 6.
 
M

Martin Gregorie

I have tomcat 6 running locally. SOme of the blog entries are different
here, as I have not backed up my mysql db locally, so it is not exactly
the same.

I can use a bookmarklet to fire requests on a 10 or so browsers here to
simulate a heavier load.

Which tool can I use to determine what is chewing up CPU time?
You don't say what OS you're using, though its probably a *nix since you
have manpages and 'top'.

On that assumption, install the sysstat package if you don't already have
it and use pidstat with either the -t option (show threads separately) or
the -T option (show child processes) to gather process statistics.

Seeing you're evidently looking at short bursts of activity, you probably
need to set the sampling rate somewhere between 1 and 5 secs which means
the data volume it spits out will be large. Be prepared to capture its
output in a file and to hack up a Perl or awk script to summarise the
useful data. If you think paging may be involved, use the -r option.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top