APM: running at 100% processor

Wayne Walker wwalker at broadq.com
Tue Apr 1 13:34:37 CST 2003


On Tue, Apr 01, 2003 at 12:08:18PM -0600, Goldilox wrote:
> Hi, I'm back again.
> 
> I guess I figured out that Perl doesn't handle NULL cells in a database at all
> (other than spewing warnings everywhere). Does anybody have a clue why this
> would be?

Be more specific.  I use Perl::DBI for 99% of my database driven apps
and there are lots of NULL fields.  perl will normally return undef for
a NULL field.

> My next question is in regards to running one of my scripts. I run one script
> (or plan to run it) every ten minutes to create a cache of database output for
> web users (since this server could easily be getting a lot of traffic during
> bad weather). On my machine here it runs at 100% processor power for the entire
> time it runs (couple minutes). I haven't tried it yet on the more powerful web
> server (Windows 2000 server), but I am curious if there is anything I need to
> do to make the script run at less than 100% to allow the server to accomplish
> its other tasks without being bogged down my my script running in the
> background? I guess this is probably a sysadmin question rather than a Perl
> question - but I figured someone here might have run into the same problem?

Any well written application on a well written operating system will use
100% of the available processor if no other process needs the CPU.

Find a BIG file (foo) and run this:

gzip -9 foo &

when your ap is using 100%.  You should see that gzip almost immediately
gets 50% of the CPU.

Now run renice 20 <pid of your app> 

gzip will probably get about 80% of the CPU now since your app has said
it is "nice" and therefore should get a lesser amount of CPU when other
higher priority processes need the CPU, but notice that even when
"niced" the nice process still gets CPU, just not as much as it would
have if "normal" priority.

Now, kill gzip.

Notice that even though your app is nice 20, giving up as much cpu as
the scheduler will allow to other processes, your app is again using
nearly 100% of the CPU time.  As it should until another process wants
the CPU.

> 
> Rhett
> 
> _______________________________________________
> Austin mailing list
> Austin at mail.pm.org
> http://mail.pm.org/mailman/listinfo/austin

-- 

Wayne Walker

www.broadq.com :)  Bringing digital video and audio to the living room



More information about the Austin mailing list