|
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.
|