LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 06-22-2007, 12:50 PM   #1
isync
Member
 
Registered: Feb 2007
Posts: 32

Rep: Reputation: 15
Question Is it true: too many fcgi scripts eat all the resources?


I have the feeling that if I run multiple of my perl scripts under fcgi, my server tends to get unproportional load.

Can someone confirm this? One or two fcgi scripts seem to run fine, making it 3 or 4 seems to be too much... (alhtough their complexity/design is almost the same)
A hint for a memory leak??

Any comments welcome!

As you can see here: http://www.linuxquestions.org/questi...d.php?t=563760, this posting is somewhat related to my other performance problems...
 
Old 06-22-2007, 08:19 PM   #2
MensaWater
LQ Guru
 
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, CoreOS, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 7,831
Blog Entries: 15

Rep: Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669
It's actually not all that rare.

Linux/UNIX are "multiuser/multiprocess" operating systems. However, they are designed to run DIFFERENT processes all at once. When you run the SAME process multiple times at once they are each using the same resources (e.g. same file on same filesystem on same disk). It is this that causes processes to cause the system load to increase dramatically.

You can cause this on purpose with a simple shell script:

while true
do find /
done

If you run that in one terminal and top in another you'll see the CPU load increment fairly quickly. The reason is because the first find isn't done before the next one (and the next one and the next one...).

However, there is a simple solution for the above:

while true
do find /
sleep 300
done

The above would make it wait 5 minutes (300 seconds) after the first find until it got to the next find.

Similarly if you had 100 different users all kick off "find /" at the same time it would have pretty much the same result.

So it would depend a lot on what your fcqi scripts are doing. It might be worthwhile to put in simple check how many invocations of your scripts are running and put in a sleep or other governor so that it limits the number that run concurrently.

Last edited by MensaWater; 06-22-2007 at 09:59 PM.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
PHP5 under lighttpd with fcgi walidaly Linux - Software 5 03-17-2007 10:57 PM
PHP5.0.4 FCGI Process maxing resources neocookie Linux - Software 2 11-02-2005 07:23 AM
null values in bash scripts always true? jdupre Programming 5 09-27-2005 05:22 PM
Trying to find an easy distro, but doesnt eat resources for family. RHLinuxGUY Linux - Distributions 10 08-31-2004 12:19 AM
bash scripts which go bump in the night and the system resources who hate them dehuszar Programming 16 07-08-2004 03:24 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 02:50 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration