Any ideas why cgi's (for Apache) are eating up CPU at 99%?

Any ideas why cgi's (for Apache) are eating up CPU at 99%?

Post by Dan Fost » Wed, 01 Nov 1995 04:00:00



Howdy!
        Appreciated previous posters' replies... very helpful!

        Now in the progress of spiffying up the web services into
something beyond just some cgi's, counter, and users' HTML pages.

        Got SSI's and Apache configured to my satisfaction... first 30
seconds, it zooooooomed. :)

        Question:

        All of a sudden, the web server (486DX4/120? running Linux 1.3.3)
and Apache 0.8.14 is *really* slagging. Looking at ps Saxugw over two days
seems to indicate two things. (btw, this is a 32 meg machine - 32 of physical
RAM in addition to ~40 megs of swap with a single drive.. a barracuda, I
think).

        1) the parent httpd process has an large amount of CPU time - i.e.
1:00 worth of CPU every 60 seconds. Is this normal?

        2) What I'm more interested right now is why cgi's are eating
up so much... i.e. typically they (most are counters) are eating up 99% of
the CPU. If it isn't 99%, it's between 20-25% with the parent httpd eating
around 75%.

        Is this normal? I have no real frame of reference to compare. If
not, would this indicate a bug, or more likely, a mis-tuned server?

        Right now, the site is getting around 160,000 hits/day (say...
approx 6000 hits/hr). MinSpareServers is 5, MaxSpareServers is 10,
StartServers is 5, MaxClients is 100, and MaxRequeustsPerChild is 30.

        Also, I'm now seeing about a billion lines in the error log
for: send timed out for [site], script timed out, and receive timed
out. What does this mean/indicate?

        Any suggestions on how to tune more effectively under Linux?
I noticed some docs on this on www.apache.org, but seemed to be a bit
on the sparse side - was hoping anybody with experience with Apache/Linux
(or even just Apache in general) could offer more tips.

        Any help or pointers would *greatly* be appreciated, suffice
to say! ;-) As I'm really stumped, I'll summarize any posts/mail for
the net.

-Dan
System Manager
E-Znet, Inc.

 
 
 

Any ideas why cgi's (for Apache) are eating up CPU at 99%?

Post by Piercarlo Gran » Fri, 03 Nov 1995 04:00:00


Dan>         All of a sudden, the web server (486DX4/120? running Linux 1.3.3)
Dan> and Apache 0.8.14 is *really* slagging. Looking at ps Saxugw over
Dan> two days seems to indicate two things. (btw, this is a 32 meg
Dan> machine - 32 of physical RAM in addition to ~40 megs of swap with a
Dan> single drive.. a barracuda, I think).

Dan>         1) the parent httpd process has an large amount of CPU time - i.e.
Dan> 1:00 worth of CPU every 60 seconds. Is this normal?

It's ridiculously high: httpd processes normally do just IO, they are
not CPU bound.

Dan>         2) What I'm more interested right now is why cgi's are eating
Dan> up so much... i.e. typically they (most are counters) are eating up 99% of
Dan> the CPU. If it isn't 99%, it's between 20-25% with the parent httpd eating
Dan> around 75%.

You can cure CGI problems by using the patch that binds Python, a rather
nice and easy to learn scripting language, into Apache. The result is
that CGI scripts no longer result in forking.

Dan>         Is this normal? I have no real frame of reference to compare. If
Dan> not, would this indicate a bug, or more likely, a mis-tuned server?

It's surely bizarre. What are you doing with those CGI scripts? just
counters as you say? Or are you serving pages, for example?

Dan>         Right now, the site is getting around 160,000 hits/day (say...
Dan> approx 6000 hits/hr).

Which is less than two per second -- should be no sweat. But of coruse
they do cluster during the day, so you are experiencing peak loads of
several hits per second.

 
 
 

1. syslogd eating 99% of CPU, HELP!

Can someone please tell me what is meant by "Bad file number"?  My CPU is being
gobbled up by the syslogd recording a bad file number error message, and I
have no idea what could be causing this.  Here is an excerpt from my
/var/log/messages file near the time of a reboot, which shows the error:

Aug  1 19:17:47 fatman last message repeated 313211 times
Aug  1 19:18:13 fatman last message repeated 117897 times
Aug  1 19:18:13 fatman syslogd: exiting on signal 15
Jul 31 19:18:56 fatman syslogd 1.3-0#6: restart.
Jul 31 19:18:56 fatman kernel: klogd 1.3-0, log source = /proc/kmsg started.
Jul 31 19:18:56 fatman syslogd 1.3-0#6: restart.
Jul 31 19:18:56 fatman syslogd: select: Bad file number
Aug  1 19:19:03 fatman last message repeated 28504 times
Aug  1 19:20:04 fatman last message repeated 327754 times
Aug  1 19:21:05 fatman last message repeated 338313 times

(I don't know why the date temporarily switches either, but I'm less concerned
about that at the moment.)

This is really destroying my CPU speed, as you can see from the output of
"top":

  PID USER     PRI  NI SIZE  RES SHRD STAT %CPU %MEM  TIME COMMAND
  191 root      11   0  848  188  128 R    97.4  1.2 38:01 /sbin/syslogd

I would like to get this fixed ASAP.

Thanks,

Eric Sharkey

2. apache config problems

3. Apache eating 99% of swap space

4. modem/sound help

5. L 99 99 99 error while booting

6. lilo setup overwrote win95 boot record

7. Shape Ups,Men's Shape Ups,Men's Skechers Shape Ups - new styles!

8. Dynamic passwords and Chap, how?

9. Installed mandrake 9.0, now I'm greeted with "99 99 99 99"... please help!

10. my cgi eating CPU

11. 'update' eats all my CPU time!!

12. apache/mod_perl/cgi:Why doesn't the script terminate when the browser closes connection?

13. 2 UPS's, 1 monitor, and (n) CPU's possible?