Click here to get back home

Does sleep increase server load?

 HomeNewsGroups | Search | About
 comp.lang.perl.misc    Post an article   get this group's latest topics as an RSS feed add this group's latest topics to your My MSN content add this group's latest topics to your My Yahoo content
Subject Author Date
Does sleep increase server load? Jason Carlton 06-19-2008
Posted by xhoster on June 19, 2008, 5:26 pm
Please log in for more thread options
> I'm pretty sure that this is a basic question, but I simply don't know
> the answer. Does the sleep command increase the server load at all
> while running?
>
> The reason I ask, I have a contact form that spam robots typically try
> to use to send junk. I have some very basic filters in place that
> catch 99.9% of it, which is great, but the robots still waste my
> server resources in trying to utilize it. So, I was thinking of
> dropping them into a loop; something along the lines of:
>
> if ($spam_criteria eq "true") {
> while (1 > 0) {
> sleep 200;
> }
> }
>
> else {
> # send email
> }

How do you detect when the spammer process loses patience and drops there
end of the connection? In some settings, like CGI, something outside
your perl script (e.g. the Apache httpd) might detect this dropped
connection and then kill your script for you. But if that doesn't happen,
then your loop will never end. You will soon pile up hundreds or thousands
of sleeping processes. They will use a negligible amount of CPU time, but
they will fill up your OS's the "process table" and cause problems.

Xho

--
-------------------- http://NewsReader.Com/ --------------------
The costs of publication of this article were defrayed in part by the
payment of page charges. This article must therefore be hereby marked
advertisement in accordance with 18 U.S.C. Section 1734 solely to indicate
this fact.

Similar ThreadsPosted
how to load a picture to an oracle database with the Load a pictureto Oracle with DBI perl module December 3, 2004, 3:37 pm
increase performance June 9, 2005, 3:43 am
Strange speed-increase by separating "if"s July 21, 2005, 11:51 am
Re: need help with a cart I inherited, need to increase number of total characters allowed October 22, 2007, 2:07 am
Re: need help with a cart I inherited, need to increase number of total characters allowed October 22, 2007, 2:13 am
Re: need help with a cart I inherited, need to increase number of total characters allowed October 22, 2007, 10:34 am
Using "Sleep " September 9, 2004, 2:09 pm
Sleep for less than a second? December 2, 2005, 10:30 pm
FAQ 8.16 How can I sleep() or alarm() for under a second? March 3, 2005, 6:03 pm
FAQ 8.16 How can I sleep() or alarm() for under a second? June 7, 2005, 5:03 am

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap