Should I use CFTHREAD to slow down bot traffic?

156 views Asked by At

We recently migrated our site from application.CFM to application.CFC. The CFM version could handle our excessive bot traffic, but our CFC version can't. We are trying to figure out why the CFC problem is. In the meantime, we are trying to limit bot traffic.

Currently, I am looking for a solution within the code base to slow bot traffic. We can do this by looking at the user agent as well as IP address.

We have used the code below to successfully stop many bots.

<cffunction name="OnRequestStart">
    <cfif find("bot", cgi.httP_USER_AGENT)>
       <cfabort>
    </cfif>
</cffunction>

Obviously, we do want some bot traffic. But right now, we can't handle all of the bot traffic. It appears that as soon as we you abort to stop a request, another request is right behind it and eventually they bring down our server.

Instead of stopping the bots, what would the ramifications be of using CFTHREAD to slow the bots?

<cffunction name="OnRequestStart">
    <cfif find("bot", cgi.httP_USER_AGENT)>
        <cfthread action="sleep" duration="5"></cfthread>
    </cfif>
</cffunction>

Would using CFTHREAD just stack up the requests and eventually kill our server or would the bots respond with fewer requests per hour?

0

There are 0 answers