View Full Version : cgi and perl
deeanglo
2003-08-01, 12:18 PM
Is it possible to find out which scripts are producing the most load on my server.
I have red hat 7.3
awsolutions
2003-08-01, 12:31 PM
Hello,
One way to try and catch a script would be to run the command "top" and watch for it to pop up.
Another method would be to run "pstree" and see if it pops up there.
You could even go one step further and type "watch -n0 pstree"
Then you can wait to see the script pop up over and over. Unless you have a script that is causing a serious server load (over 4.0 constantly) then I wouldn't worry. Spikes in scripts are normal, especially if all members of a script (e-mails script, forum and such) are being sent a message.
Hope this helps,
Brian
OOagent137
2003-08-01, 19:59 PM
If I wanted a listing of all the scripts being run on my server in a week's time, and the average load taken up and the max load to show up next to the script, how could I do that? I am using RedHat as well.
awsolutions
2003-08-01, 20:00 PM
No Idea.....Either write your own shell script to do it or search freshmeat.net and see if soemone built a program like that would be my two suggestions.
OOagent137
2003-08-01, 20:57 PM
Well, I'm curious then. How does everyone else make sure no customer just eats up all the resources? I mean, how do you watch out for those sort of things?
awsolutions
2003-08-01, 23:08 PM
Hello,
Well in php you can set system resources to a max using the /etc/php.ini file. If you edit that you will see many comments that explain what every function does and then you can set it accordingly.
With cgi it's not so easy! This is what makes cgi so dangerous. Some hosters have even disabled cgi entirely on their system do to their inability to control resources. The only real way that I have heard of people controlling cgi resources is using a custom kernel that does such. grsecurity.org is something that I have been referred to in the past but have not had time or resources to tinker with.
-Brian
knightfoo
2003-08-01, 23:38 PM
Originally posted by OOagent137
Well, I'm curious then. How does everyone else make sure no customer just eats up all the resources? I mean, how do you watch out for those sort of things?
There are apache configuration directives which you can use to put a cap on resources consumed by forked processes (i.e. CGI scripts). This won't tell you what is using the most resources, but it will keep users from messing things up too badly.
http://httpd.apache.org/docs/mod/core.html#rlimitcpu
http://httpd.apache.org/docs/mod/core.html#rlimitmem
http://httpd.apache.org/docs/mod/core.html#rlimitnproc
-knightfoo
OOagent137
2003-08-02, 04:40 AM
Thanks for the help, this is a VERY important issue. I really appreciate it. I'm leaving for vacation soon, so I might not get a chance to look over all of this, but I'm sure when I get back I'll have plenty more questions about it :)
vBulletin® v3.6.8, Copyright ©2000-2008, Jelsoft Enterprises Ltd.